Upload to server

uploading
This commit is contained in:
2025-08-02 05:20:17 +07:00
commit a5eccbd452
984 changed files with 3031800 additions and 0 deletions

View File

@@ -0,0 +1,165 @@
using System;
using System.Management;
using System.Security.Cryptography;
using System.Security;
using System.Collections;
using System.Text;
namespace PatientMan
{
/// <summary>
/// Generates a 16 byte Unique Identification code of a computer
/// Example: 4876-8DB5-EE85-69D3-FE52-8CF7-395D-2EA9
/// </summary>
public class FingerPrint
{
private static string fingerPrint = string.Empty;
public static string Value()
{
if (string.IsNullOrEmpty(fingerPrint))
{
fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId()
//+"\nDISK >> "+ diskId() + "\nVIDEO >> " + videoId() +"\nMAC >> "+ macId()
);
}
return fingerPrint;
}
private static string GetHash(string s)
{
MD5 sec = new MD5CryptoServiceProvider();
ASCIIEncoding enc = new ASCIIEncoding();
byte[] bt = enc.GetBytes(s);
return GetHexString(sec.ComputeHash(bt));
}
private static string GetHexString(byte[] bt)
{
string s = string.Empty;
for (int i = 0; i < bt.Length; i++)
{
byte b = bt[i];
int n, n1, n2;
n = (int)b;
n1 = n & 15;
n2 = (n >> 4) & 15;
if (n2 > 9)
s += ((char)(n2 - 10 + (int)'A')).ToString();
else
s += n2.ToString();
if (n1 > 9)
s += ((char)(n1 - 10 + (int)'A')).ToString();
else
s += n1.ToString();
if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-";
}
return s;
}
#region Original Device ID Getting Code
//Return a hardware identifier
private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
string result = "";
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
if (mo[wmiMustBeTrue].ToString() == "True")
{
//Only get the first one
if (result == "")
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
}
return result;
}
//Return a hardware identifier
private static string identifier(string wmiClass, string wmiProperty)
{
string result = "";
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
//Only get the first one
if (result == "")
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
return result;
}
private static string cpuId()
{
//Uses first CPU identifier available in order of preference
//Don't get all identifiers, as very time consuming
string retVal = identifier("Win32_Processor", "UniqueId");
if (retVal == "") //If no UniqueID, use ProcessorID
{
retVal = identifier("Win32_Processor", "ProcessorId");
if (retVal == "") //If no ProcessorId, use Name
{
retVal = identifier("Win32_Processor", "Name");
if (retVal == "") //If no Name, use Manufacturer
{
retVal = identifier("Win32_Processor", "Manufacturer");
}
//Add clock speed for extra security
retVal += identifier("Win32_Processor", "MaxClockSpeed");
}
}
return retVal;
}
//BIOS Identifier
private static string biosId()
{
return identifier("Win32_BIOS", "Manufacturer")
+ identifier("Win32_BIOS", "SMBIOSBIOSVersion")
+ identifier("Win32_BIOS", "IdentificationCode")
+ identifier("Win32_BIOS", "SerialNumber")
+ identifier("Win32_BIOS", "ReleaseDate")
+ identifier("Win32_BIOS", "Version");
}
//Main physical hard drive ID
private static string diskId()
{
return identifier("Win32_DiskDrive", "Model")
+ identifier("Win32_DiskDrive", "Manufacturer")
+ identifier("Win32_DiskDrive", "Signature")
+ identifier("Win32_DiskDrive", "TotalHeads");
}
//Motherboard ID
private static string baseId()
{
return identifier("Win32_BaseBoard", "Model")
+ identifier("Win32_BaseBoard", "Manufacturer")
+ identifier("Win32_BaseBoard", "Name")
+ identifier("Win32_BaseBoard", "SerialNumber");
}
//Primary video controller ID
private static string videoId()
{
return identifier("Win32_VideoController", "DriverVersion")
+ identifier("Win32_VideoController", "Name");
}
//First enabled network card ID
private static string macId()
{
return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled");
}
#endregion
}
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan
{
class ArvStatus
{
public string PatientId { get; set; }
public int month { get; set; }
public int remonth { get; set; }
public string ExamDes { get; set; }
public string ArvDes { get; set; }
public string OtherStatus { get; set; }
public string CD4 { get; set; }
public string Regimenid { get; set; }
public string EndReason { get; set; }
private int _col;
public string getArvDes()
{
if (ArvDes == string.Empty)
return "KK";
else return ArvDes;
}
public int getCol()
{
if (month==0) return 13;
if (month % 6 == 0 && month!=0)
{
_col = 13+ month + month / 6 - 1;
}
else
{
_col = 13 + month + month / 6;
}
return _col;
}
}
class prevArvStatus
{
public int quarter { get; set; }
public int year { get; set; }
public string PreArvDes { get; set; }
public string OtherStatus { get;set; }
public int col { get; set; }
public string CD4 { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan.Classes{
class clsChildInfo
{
public string ChildName { get; set; }
public string ChildId { get; set; }
public DateTime? ChildBod { get; set; }
public string MotherName { get; set; }
public string MotherId { get; set; }
public string Regimen { get; set; }
public int PregnantAge { get; set; }
public string Sex { get; set; }
public string ChildRegimen { get; set; }
public double EmbrioAge { get; set; }
public string FeedingType { get; set; }
public DateTime CTXDate {get;set;}
public DateTime PCRDate1 { get; set; }
public string PCRResult1 { get; set; }
public DateTime PCRDate2 { get; set; }
public string PCRResult2 { get; set; }
public DateTime HIV18Date { get; set; }
public string HIV18Result { get; set; }
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace PatientMan
{
internal static class common
{
public static DateTime testdate { get; set; }
public static DateTime visitdate { get; set; }
public static DateTime MaxDate(DateTime a, DateTime b)
{
return a > b ? a : b;
}
public static DateTime MinDate(DateTime a, DateTime b)
{
return a > b ? b : a;
}
public static string MD5Hash(string text)
{
MD5 md5 = new MD5CryptoServiceProvider();
//compute hash from the bytes of text
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text));
//get hash result after compute it
byte[] result = md5.Hash;
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
//change it into 2 hexadecimal digits
//for each byte
strBuilder.Append(result[i].ToString("x2"));
}
return strBuilder.ToString();
}
public static int MonthDiff( DateTime EndDate,DateTime startDate)
{
int retVal = 0;
if (startDate.Month < EndDate.Month)
{
retVal = (startDate.Month + 12) - EndDate.Month;
retVal += ((startDate.Year - 1) - EndDate.Year) * 12;
}
else
{
retVal = startDate.Month - EndDate.Month;
retVal += (startDate.Year - EndDate.Year) * 12;
}
//// Calculate the number of years represented and multiply by 12
//// Substract the month number from the total
//// Substract the difference of the second month and 12 from the total
//retVal = (d1.Year - d2.Year) * 12;
//retVal = retVal - d1.Month;
//retVal = retVal - (12 - d2.Month);
return retVal;
}
public static int GetQuarter(DateTime date)
{
if (date.Month >= 4 && date.Month <= 6)
return 2;
else if (date.Month >= 7 && date.Month <= 9)
return 3;
else if (date.Month >= 10 && date.Month <= 12)
return 4;
else
return 1;
}
}
}

View File

@@ -0,0 +1,18 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan.Classes.Templates
{
class clsEndDuplicates
{
public string UniqueID { get; set; }
public string PatientId { get; set; }
public DateTime EndDate { get; set; }
public string TypeId {get;set;}
public Boolean Deleted { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan.Classes.Templates
{
class clsHivqualRec
{
public string MaOPC { get; set; }
public string MaBA { get; set; }
public DateTime TuNgay {get;set;}
public DateTime DenNgay{ get; set; }
public DateTime NgayThuThap { get; set; }
public string NguoiThuThap { get; set; }
public DateTime NgayDangKy { get; set; }
public Boolean ChuaARVCT { get; set; }
public Boolean ARVCT { get; set; }
public DateTime NgayXNMG1 { get; set; }
public int ALT1 { get; set; }
public int AST1 { get; set; }
public DateTime NgayXNMG2 { get; set; }
public int ALT2 { get; set; }
public int AST2 { get; set; }
public DateTime NgayDieuTriARV { get; set; }
public DateTime NgayGDLS3 { get; set; }
public DateTime NgayGDLS4 { get; set; }
public DateTime NgayDuTCDieuTriARV { get; set; }
public DateTime NgaySanSangDieuTriARV { get; set; }
public DateTime NgayHen { get; set; }
public DateTime NgayKham { get; set; }
public int DuPhongCTX { get; set; }
public int INH { get; set; }
public int NguoiNhaLanhThuoc { get; set; }
public int GiaiDoanLS { get; set; }
public int SangLocLao { get; set; }
public int RLThanKinh { get; set; }
public int VangDa { get; set; }
public int DGiaTThuDT { get; set; }
public DateTime NgayKT { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan
{
public class LogInfo
{
public string PatientID { get; set; }
public string RecordID { get; set; }
public string TableName { get; set; }
public string EventType { get; set; }
public string EventDate { get; set; }
}
public class EndTreatmentLog
{
public string log { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan.Classes
{
class clsPatientInfo
{
public int No { get; set; }
public string PatientID { get; set; }
public string PatientName { get; set; }
public int BirthYear { get; set; }
public string Sex { get; set; }
public string Address { get; set; }
public Nullable<DateTime> DateofArv { get; set; }
public string IsArv { get; set; }
public string ProvinceId { get; set; }
public string DistrictId { get; set; }
public string CommuneId { get; set; }
public Nullable<DateTime> EndExamDate { get; set; }
public string Referral { get; set; }
public string ReasonEnd { get; set; }
public Nullable<DateTime> HIVConfirmDate { get; set; }
public Nullable<DateTime> DateofRegistration { get; set; }
public Nullable<DateTime> LastExamDate { get; set; }
public Nullable<DateTime> ReExamDate { get; set; }
public string TelephoneNo { get; set; }
public string SupporterInfo { get; set; }
public string sms { get; set;}
public string OutPatientTreatment { get; set; }
public string CD4 { get; set; }
public string CD4Delays { get; set; }
public string Delays { get; set; }
public Nullable<DateTime> CTXsDate { get; set; }
public Nullable<DateTime> CTXeDate { get; set; }
public Nullable<DateTime> INHsDate { get; set; }
public Nullable<DateTime> INHeDate { get; set; }
public Nullable<DateTime> ARVsDate { get; set; }
public Nullable<DateTime> ARVeDate { get; set; }
public string Regimenid { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientMan
{
class cslReferralInfo
{
public string PatientID { get; set; }
public string PatientName { get; set; }
public int BirthYear { get; set; }
public string Sex { get; set; }
public string Adress { get; set; }
public string ClinicStage { get; set; }
public string FromProvince { get; set; }
public string SiteName { get; set; }
public string ToProvince {get;set;}
public double LastCD4 { get; set; }
public string FirstRegimen {get;set;}
public string LatRegimen { get; set; }
public string HIVConfirmDate { get; set; }
public string RegisterDate { get; set; }
public string ReferralAgency { get; set;}
public string ArvDate { get; set; }
}
}

View File

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;
using System.Configuration;
using System.Collections;
namespace PatientMan
{
public class SettingInfo
{
private static XmlDocument doc = new XmlDocument();
public static string ProvinceId { get; set; }
public static string DistrictId { get; set; }
public static string CommuneId { get; set; }
public static string SiteCode { get; set; }
public static string SiteName { get; set; }
public static string Address { get; set; }
public static string Description { get; set; }
public static string InstallId { get; set; }
public static string RegisterNo { get; set; }
public static int Language { get; set; }
public static string Password { get; set; }
public static string DatabaseFile { get; set; }
public static string BackupFolder { get; set; }
public static string Constr { get; set; }
public static string dbPassword { get; set; }
public static Boolean Registered { get; set; }
enum EndExam
{
LostFollowup=1,
Referral = 2,
Death = 3
};
enum EndRegimen
{
ClinicalFailure,
TB,
Pregnance,
ImmuneFailure,
Drugsarenolonger,
Sideeffects,
FailureVirus,
NewDrugsAreAvailable,
LostFollowup,
Referral ,
Death
}
public static void InitInfo()
{
try
{
var doc = new XmlDocument();
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
string SettingsPath = Application.StartupPath + @"\Settings.fhi";
doc.Load(SettingsPath);
ProvinceId = doc.GetElementsByTagName("ProvinceId")[0].InnerText;
DistrictId = doc.GetElementsByTagName("DistictId")[0].InnerText;
CommuneId = doc.GetElementsByTagName("CommuneId")[0].InnerText;
SiteCode = doc.GetElementsByTagName("SiteCode")[0].InnerText;
SiteName = doc.GetElementsByTagName("SiteName")[0].InnerText;
Address = doc.GetElementsByTagName("Address")[0].InnerText;
Description = doc.GetElementsByTagName("Description")[0].InnerText;
Password = doc.GetElementsByTagName("Password")[0].InnerText;
Language = Convert.ToInt16(doc.GetElementsByTagName("Language")[0].InnerText);
InstallId = PatientMan.FingerPrint.Value().Trim();
dbPassword = doc.GetElementsByTagName("dbPassword")[0].InnerText; getDataBaseFile();
getDataBaseFile();
RegisterNo = config.AppSettings.Settings["RegisterNo"]==null?"xxxxxxxxxx":config.AppSettings.Settings["RegisterNo"].Value;
Registered = (common.MD5Hash(InstallId.Trim().ToString()).ToUpper() == RegisterNo);
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
}
public static void getDataBaseFile()
{
string tmp="";
try
{
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
string value = config.AppSettings.Settings["ConnectionString.MS Access (OleDb)"].Value;
string[] values = value.Split(new char[] { ';' });
string DataSource = values[1];
DatabaseFile = DataSource.Split(new char[] { '=' })[1];
tmp = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={file};User Id=admin;Password=;Jet OLEDB:System Database=;Jet OLEDB:Database password={dbPassword}";
Constr = tmp.Replace("{file}", DatabaseFile);
if (dbPassword != "")
{
Constr = Constr.Replace("{dbPassword}", Utility.Decrypt(dbPassword));
}
else
{
Constr = Constr.Replace("{dbPassword}", "");
}
BackupFolder = config.AppSettings.Settings["BackupFolder"]!=null?config.AppSettings.Settings["BackupFolder"].Value:"";
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}
}
}
}

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraGrid;
namespace PatientMan
{
public class hsphgrid : GridControl
{
private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
private System.ComponentModel.IContainer components;
public List<string> Patients { get; set; }
private void InitializeComponent()
{
this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// gridView1
//
this.gridView1.GridControl = this;
this.gridView1.Name = "gridView1";
//
// hsphgrid
//
this.MainView = this.gridView1;
this.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView1});
((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>