using ServiceShared.Crypto; using static ServiceShared.Models.Database.Results; namespace ServiceShared.Models.HL7 { public class MDM { /// /// TimeStamp of MDM EVN[2] /// public DateTime TimeStamp { get; set; } /// /// Patient intern id(UNIQUE) /// public string PatId { get; set; } /// /// Results status of EVN[3] /// public ResultsStatus ResultsStatus { get; set; } /// /// Patient birthday (yyyyMMdd) /// public string Birthday { get; set; } /// /// Patient zip /// public string Zip { get; set; } /// /// UDID (Unique Device ID) /// public string UDID { get; set; } /// /// PGS Initial already calculated PGS() /// public string PGSInitial { get; set; } /// /// Sample Id /// public string SampleId { get; set; } /// /// Base64 encoded file /// public string Base64Content { get; set; } /// /// AES encrypted value that can be decrypted by service inside (Postleizahl Geburtsdatum SampleId) /// public string PGS_HASH(string udid) { string result = null; if(!string.IsNullOrEmpty(this.Zip) && !string.IsNullOrEmpty(this.Birthday) && !string.IsNullOrEmpty(this.SampleId)) { result = AES.Encrypt(this.Zip + '|' + this.Birthday + '|' + this.SampleId, AES.GetKey(udid + AES.PGS_ENCRYPT_PARTIAL_KEY)); } return result; } /// /// AES encrypted value that can be decrypted by service inside (PatId) /// public string PAT_HASH() { string result = null; if (!string.IsNullOrEmpty(this.PatId)) { result = AES.Encrypt(this.PatId); } return result; } /// /// PGS SHA512(Postleizahl Geburtsdatum SampleId) /// public string PGS() { string result = null; if (!string.IsNullOrEmpty(this.Zip) && !string.IsNullOrEmpty(this.Birthday) && !string.IsNullOrEmpty(this.SampleId)) { result = SHA512.Encrypt(this.Zip + this.Birthday + this.SampleId); } return result; } } }