///<summary>Update existing lab results.</summary> public static void Update(LabResult labResult){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ Meth.GetVoid(MethodBase.GetCurrentMethod(),labResult); return; } Crud.LabResultCrud.Update(labResult); }
private void CreateLabPanel() { MedicalOrder order=listLabOrders[gridMain.GetSelectedIndex()]; MessageHL7 msg=new MessageHL7(textHL7Raw.Text); //SegmentHL7 segOBR=null; //SegmentHL7 segOBX=null; //int idxPanel=0; //int idxResult=0; LabPanel panel=null; LabResult result=null; //loop through all message segments. for(int i=0;i<msg.Segments.Count;i++){ if(msg.Segments[i].Name==SegmentNameHL7.OBR){//if this is the start of a new panel panel=new LabPanel(); panel.PatNum=order.PatNum; panel.MedicalOrderNum=order.MedicalOrderNum; panel.RawMessage=textHL7Raw.Text; panel.LabNameAddress=msg.Segments[i].GetFieldFullText(20); panel.SpecimenSource=msg.Segments[i].GetFieldFullText(15); panel.SpecimenCondition=msg.Segments[i].GetFieldFullText(13); panel.ServiceId=msg.Segments[i].GetFieldComponent(4,0); panel.ServiceName=msg.Segments[i].GetFieldComponent(4,1); LabPanels.Insert(panel); } if(msg.Segments[i].Name==SegmentNameHL7.OBX){//if this is a result within a panel result=new LabResult(); result.LabPanelNum=panel.LabPanelNum; result.DateTimeTest=msg.Segments[i].GetDateTime(14); result.TestID=msg.Segments[i].GetFieldComponent(3,0); result.TestName=msg.Segments[i].GetFieldComponent(3,1); result.ObsValue=msg.Segments[i].GetFieldFullText(5); result.ObsUnits=msg.Segments[i].GetFieldFullText(6); result.ObsRange=msg.Segments[i].GetFieldFullText(7); LabResults.Insert(result); } //any other kind of segment, continue. } //order.IsLabPending=false; //MedicalOrders.Update(order); //return true;//I guess it's always true? }
///<summary>Insert new lab results.</summary> public static long Insert(LabResult labResult) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { labResult.LabResultNum=Meth.GetLong(MethodBase.GetCurrentMethod(),labResult); return labResult.LabResultNum; } return Crud.LabResultCrud.Insert(labResult); }
//OBR|1|||30955-9^Vaccine Given^LN| //OBX|1|CE30955-9&30956-7^Vaccine type^LN|1|08^HepB-Adolescent/pediatric^CVX| /// <summary>idx passed in will be zero-based. Will be converted to 1-based.</summary> private void OBX(LabResult labresult,int idx) { seg=new SegmentHL7(SegmentName.OBX); seg.SetField(0,"OBX"); seg.SetField(1,(idx+1).ToString()); seg.SetField(2,"NM");//ValueType. NM=numeric, referring to the value that will follow in OBX-5 seg.SetField(3,labresult.TestID,labresult.TestName,"LN");//TestPerformed ID^text^codingSystem. eg. 10676-5^Hepatitis C Virus RNA^LN seg.SetField(4,"1");//? seg.SetField(5,labresult.ObsValue);//Value. Type based on OBX-2. eg. 850000. seg.SetField(6,labresult.ObsUnits);//Units. Example iU/mL^international units per mililiter seg.SetField(7,labresult.ObsRange);//Range. Example High Viral Load >= 850000iU/mL seg.SetField(8,"N");//? seg.SetField(11,"F");//OBX-11 is required. F means final. seg.SetField(14,labresult.DateTimeTest.ToString("yyyyMMddhhmmss"));//OBX-14 datetime msg.Segments.Add(seg); }