99 lines
2.6 KiB
C#
99 lines
2.6 KiB
C#
using ServiceShared.Crypto;
|
|
using static ServiceShared.Models.Database.Results;
|
|
|
|
namespace ServiceShared.Models.HL7
|
|
{
|
|
public class MDM
|
|
{
|
|
/// <summary>
|
|
/// TimeStamp of MDM EVN[2]
|
|
/// </summary>
|
|
public DateTime TimeStamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// Patient intern id(UNIQUE)
|
|
/// </summary>
|
|
public string PatId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Results status of EVN[3]
|
|
/// </summary>
|
|
public ResultsStatus ResultsStatus { get; set; }
|
|
|
|
/// <summary>
|
|
/// Patient birthday (yyyyMMdd)
|
|
/// </summary>
|
|
public string Birthday { get; set; }
|
|
|
|
/// <summary>
|
|
/// Patient zip
|
|
/// </summary>
|
|
public string Zip { get; set; }
|
|
|
|
/// <summary>
|
|
/// UDID (Unique Device ID)
|
|
/// </summary>
|
|
public string UDID { get; set; }
|
|
|
|
/// <summary>
|
|
/// PGS Initial already calculated PGS()
|
|
/// </summary>
|
|
public string PGSInitial { get; set; }
|
|
|
|
/// <summary>
|
|
/// Sample Id
|
|
/// </summary>
|
|
public string SampleId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Base64 encoded file
|
|
/// </summary>
|
|
public string Base64Content { get; set; }
|
|
|
|
/// <summary>
|
|
/// AES encrypted value that can be decrypted by service inside (Postleizahl Geburtsdatum SampleId)
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// AES encrypted value that can be decrypted by service inside (PatId)
|
|
/// </summary>
|
|
public string PAT_HASH()
|
|
{
|
|
string result = null;
|
|
|
|
if (!string.IsNullOrEmpty(this.PatId))
|
|
{
|
|
result = AES.Encrypt(this.PatId);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// PGS SHA512(Postleizahl Geburtsdatum SampleId)
|
|
/// </summary>
|
|
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;
|
|
}
|
|
}
|
|
}
|