private static void UpdateReport(string Username, HL7.Reportable.Common.Business.HL7.LabReport labReport, ChangeSetData change) { var obr = labReport.TestRequests.Where(tRequest => tRequest.OBR_ID == change.OBR_ID).FirstOrDefault(); CodedElement ceHCC = new CodedElement() { Code = change.HealthCondition.ParentKey, Description = change.HealthCondition.ParentName, CodingSystem = change.HealthCondition.ParentCodingSystem }; CodedElement ceHC = new CodedElement() { Code = change.HealthCondition.ChildKey, Description = change.HealthCondition.ChildName, CodingSystem = change.HealthCondition.ChildCodingSystem }; if (change.OBX_ID == "NONE") { // update the OBR obr.PHRED_AssignedHCManually = true; obr.PHRED_AssignerUserKey = Username; //obx.PHRED_AssignmentNote = "Another Note"; obr.PHRED_AssignedDtTm = DateTime.Now.ToString(); obr.PHRED_AssignedHCC = ceHCC; obr.PHRED_AssignedHC = ceHC; } else { var obx = obr.TestResults.Where(tResult => tResult.OBX_ID == change.OBX_ID).FirstOrDefault(); obx.PHRED_AssignedHCManually = true; obx.PHRED_AssignerUserKey = Username; //obx.PHRED_AssignmentNote = "Another Note"; obx.PHRED_AssignedDtTm = DateTime.Now.ToString(); obx.PHRED_AssignedHCC = ceHCC; obx.PHRED_AssignedHC = ceHC; } }
private static void AddOBRAndOBXs(ref MSH msh, HL7.Reportable.Common.Business.HL7.LabReport report) { int sequenceID = 1; List <OBR> OBRs = new List <OBR>(); foreach (var item in report.TestRequests) { OBRs.Add(GetObr(item, sequenceID++)); } msh.ObrList = OBRs; }
private static MSH ProcessLabReportItem(HL7.Reportable.Common.Business.HL7.LabReport report, int sequenceID) { MSH msh = new MSH(); msh.SequenceID = sequenceID.ToString(); msh.Sender = report.Submission.SubmitterName; msh.MessageControlID = report.Submission.MessageControlID; msh.MSH_ID = report.MSH_ID; msh.PID_ID = report.Patient.PID_ID; msh.MessageDateTime = report.Submission.MessageDateTime; msh.FileName = report.Submission.Filename; msh.FirstName = report.Patient.PatientNames.Count > 0 ? (report.Patient.PatientNames[0].FirstName != null ? report.Patient.PatientNames[0].FirstName : "") : ""; msh.LastName = report.Patient.PatientNames.Count > 0 ? (report.Patient.PatientNames[0].LastName != null ? report.Patient.PatientNames[0].LastName : "") : ""; msh.MiddleNameOrInitial = report.Patient.PatientNames.Count > 0 ? (report.Patient.PatientNames[0].MiddleNameOrInitial != null ? report.Patient.PatientNames[0].MiddleNameOrInitial : "") : ""; msh.DateOfBirth = report.Patient.DateOfBirth; AddOBRAndOBXs(ref msh, report); return(msh); }