Ejemplo n.º 1
0
		///<summary></summary>
		public static void Update(VaccinePat vaccinePat){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),vaccinePat);
				return;
			}
			Crud.VaccinePatCrud.Update(vaccinePat);
		}
Ejemplo n.º 2
0
		///<summary></summary>
		public static long Insert(VaccinePat vaccinePat){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				vaccinePat.VaccinePatNum=Meth.GetLong(MethodBase.GetCurrentMethod(),vaccinePat);
				return vaccinePat.VaccinePatNum;
			}
			return Crud.VaccinePatCrud.Insert(vaccinePat);
		}
Ejemplo n.º 3
0
 ///<summary></summary>
 public static void Update(VaccinePat vaccinePat)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), vaccinePat);
         return;
     }
     Crud.VaccinePatCrud.Update(vaccinePat);
 }
Ejemplo n.º 4
0
 ///<summary></summary>
 public static long Insert(VaccinePat vaccinePat)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         vaccinePat.VaccinePatNum = Meth.GetLong(MethodBase.GetCurrentMethod(), vaccinePat);
         return(vaccinePat.VaccinePatNum);
     }
     return(Crud.VaccinePatCrud.Insert(vaccinePat));
 }
Ejemplo n.º 5
0
		///<summary>Pharmacy/Treatment Route segment.  Required if known.  Guide page 158.</summary>
		private void RXR(VaccinePat vaccine) {
			if(vaccine.AdministrationRoute==VaccineAdministrationRoute.None) {
				return;//Unspecified.  Therefore unknown and the entire segment is not required.
			}
			_seg=new SegmentHL7(SegmentNameHL7.RXR);
			_seg.SetField(0,"RXR");
			//RXR-1 Route.  Required.  Cardinality [1..1].  Value set HL70162 (guide page 200). Type CE (guide page 53).
			if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Intradermal) {
				WriteCE(1,"ID","Intradermal","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Intramuscular) {
				WriteCE(1,"IM","Intramuscular","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Nasal) {
				WriteCE(1,"NS","Nasal","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Intravenous) {
				WriteCE(1,"IV","Intravenous","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Oral) {
				WriteCE(1,"PO","Oral","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Subcutaneous) {
				WriteCE(1,"SC","Subcutaneous","HL70162");
			}
			else if(vaccine.AdministrationRoute==VaccineAdministrationRoute.Transdermal) {
				WriteCE(1,"TD","Transdermal","HL70162");
			}
			else {//Other
				WriteCE(1,"OTH","Other","HL70162");
			}
			//RXR-2 Administration Site.  Required if known.  Cardinality [0..1].  Value set HL70163 (guide page 201, details where the vaccine was physically administered on the patient's body).
			if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftThigh) {
				WriteCE(2,"LT","LeftThigh","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftVastusLateralis) {
				WriteCE(2,"LVL","LeftVastusLateralis","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftGluteousMedius) {
				WriteCE(2,"LG","LeftGluteousMedius","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftArm) {
				WriteCE(2,"LA","LeftArm","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftDeltoid) {
				WriteCE(2,"LD","LeftDeltoid","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.LeftLowerForearm) {
				WriteCE(2,"LLFA","LeftLowerForearm","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightThigh) {
				WriteCE(2,"RT","RightThigh","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightVastusLateralis) {
				WriteCE(2,"RVL","RightVastusLateralis","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightGluteousMedius) {
				WriteCE(2,"RG","RightGluteousMedius","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightArm) {
				WriteCE(2,"RA","RightArm","HL70163");
			}			
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightDeltoid) {
				WriteCE(2,"RD","RightArm","HL70163");
			}
			else if(vaccine.AdministrationSite==VaccineAdministrationSite.RightLowerForearm) {
				WriteCE(2,"RLFA","RightLowerForearm","HL70163");
			}			
			//RXR-3 Administration Device.  Optional.
			//RXR-4 Administration Method.  Optional.
			//RXR-5 Routing Instruction.  Optional.
			//RXR-6 Administration Site Modifier.  Optional.
			_msg.Segments.Add(_seg);
		}
Ejemplo n.º 6
0
		///<summary>Pharmacy/Treatment Administration segment.  Required.  Guide page 149.</summary>
		private void RXA(VaccinePat vaccine) {
			_seg=new SegmentHL7(SegmentNameHL7.RXA);
			_seg.SetField(0,"RXA");
			_seg.SetField(1,"0");//RXA-1 Give Sub-ID Counter.  Required.  Must be "0".
			_seg.SetField(2,"1");//RXA-2 Administration Sub-ID Counter.  Required.  Must be "1".
			_seg.SetField(3,vaccine.DateTimeStart.ToString("yyyyMMddHHmm"));//RXA-3 Date/Time Start of Administration.  Required.  This segment can also be used to planned vaccinations.
			if(vaccine.DateTimeEnd.Year>1880) {
				_seg.SetField(4,vaccine.DateTimeEnd.ToString("yyyyMMddHHmm"));//RXA-4 Date/Time End of Administration.  Required if known.  Must be same as RXA-3 or blank.  UI forces RXA-4 and RXA-3 to be equal.  This would be blank if for a planned vaccine.
			}
			//RXA-5 Administered Code.  Required.  Cardinality [1..1].  Type CE (guide page 53).  Must be a CVX code.
			VaccineDef vaccineDef=null;
			if(vaccine.CompletionStatus==VaccineCompletionStatus.NotAdministered) {
				WriteCE(5,"998","no vaccine administered","CVX");
			}
			else {
				vaccineDef=VaccineDefs.GetOne(vaccine.VaccineDefNum);
				Cvx cvx=Cvxs.GetByCode(vaccineDef.CVXCode);
				WriteCE(5,cvx.CvxCode,cvx.Description,"CVX");
			}
			//RXA-6 Administered Amount.  Required (length 1..20).  If amount is not known or not meaningful, then use "999".
			if(vaccine.AdministeredAmt>0) {
				_seg.SetField(6,vaccine.AdministeredAmt.ToString());
			}
			else {
				_seg.SetField(6,"999");//Registries that do not collect administered amount should record the value as "999".
			}
			//RXA-7 Administered Units.  Required if RXA-6 is not "999".  Cadinality [0..1].  Type CE (guide page 53).  Value set HL70396 (guide page 231).  Must be UCUM coding.
			if(vaccine.AdministeredAmt>0 && vaccine.DrugUnitNum!=0) {
				DrugUnit drugUnit=DrugUnits.GetOne(vaccine.DrugUnitNum);
				Ucum ucum=Ucums.GetByCode(drugUnit.UnitIdentifier);
				WriteCE(7,ucum.UcumCode,ucum.Description,"UCUM");//UCUM is not in table HL70396, but it there was a note stating that it was required in the guide and UCUM was required in the test cases.
			}
			//RXA-8 Administered Dosage Form.  Optional.
			//RXA-9 Administration Notes.  Required if RXA-20 is "CP" or "PA".  Value set NIP 0001.  Type CE.
			if(vaccine.CompletionStatus==VaccineCompletionStatus.Complete || vaccine.CompletionStatus==VaccineCompletionStatus.PartiallyAdministered) {
				if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.NewRecord) {
					WriteCE(9,"00","New immunization record","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalSourceUnknown) {
					WriteCE(9,"01","Historical information - source unspecified","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalOtherProvider) {
					WriteCE(9,"02","Historical information - from other provider","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalParentsWrittenRecord) {
					WriteCE(9,"03","Historical information - from parent's written record","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalParentsRecall) {
					WriteCE(9,"04","Historical information - from parent's recall","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalOtherRegistry) {
					WriteCE(9,"05","Historical information - from other registry","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalBirthCertificate) {
					WriteCE(9,"06","Historical information - from birth certificate","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalSchoolRecord) {
					WriteCE(9,"07","Historical information - from school record","NIP001");
				}
				else if(vaccine.AdministrationNoteCode==VaccineAdministrationNote.HistoricalPublicAgency) {
					WriteCE(9,"08","Historical information - from public agency","NIP001");
				}
			}
			//RXA-10 Administering Provider.  Required if known.  Type XCN.  This is the person who gave the administration or the vaccinaton.  It is not the ordering clinician.
			Provider provAdministering=Providers.GetProv(vaccine.ProvNumAdminister);//Can be null when vaccine.ProvNumAdminister is zero.
			if(provAdministering!=null) {
				WriteXCN(10,provAdministering.FName,provAdministering.LName,provAdministering.MI,provAdministering.ProvNum.ToString(),cityWhereEntered,stateWhereEntered,"L");
			}
			//RXA-11 Administered-at Location.  Required if known.  Type LA2 (guide page 68).  This is the clinic/site where the vaccine was administered.
			WriteLA2(11,_sendingFacilityName);
			//RXA-12 Administered Per (Time Unit).  Optional.
			//RXA-13 Administered Strength.  Optional.
			//RXA-14 Administered Strength Units.  Optional.
			//RXA-15 Substance Lot Number.  Required if the value in RXA-9.1 is "00".  We decided not to send this field if NotAdministered because we observed such behavior in the testing tool.
			if(vaccine.CompletionStatus!=VaccineCompletionStatus.NotAdministered && vaccine.LotNumber.Trim()!="") {
				_seg.SetField(15,vaccine.LotNumber.Trim());
			}
			//RXA-16 Substance Expiration Date.  Required if RXA-15 is not blank.  Must include at least year and month, but day is not required.  We decided not to send this field if NotAdministered because we observed such behavior in the testing tool.
			if(vaccine.CompletionStatus!=VaccineCompletionStatus.NotAdministered && vaccine.DateExpire.Year>1880) {
				_seg.SetField(16,vaccine.DateExpire.ToString("yyyyMMdd"));
			}
			//RXA-17 Substance Manufacturer Name.  Requred if RXA-9.1 is "00".  Cardinality [0..*].  Value set MVX.  Type CE.
			if(vaccine.CompletionStatus!=VaccineCompletionStatus.NotAdministered && vaccineDef.DrugManufacturerNum!=0) {
				DrugManufacturer manufacturer=DrugManufacturers.GetOne(vaccineDef.DrugManufacturerNum);
				WriteCE(17,manufacturer.ManufacturerCode,manufacturer.ManufacturerName,"MVX");
			}
			//RXA-18 Substance/Treatment Refusal Reason.  Required if RXA-20 is "RE".  Cardinality [0..*].  Required when RXA-20 is "RE", otherwise do not send.  Value set NIP002.
			if(vaccine.RefusalReason==VaccineRefusalReason.ParentalDecision) {
				WriteCE(18,"00","Parental decision","NIP002");
			}
			else if(vaccine.RefusalReason==VaccineRefusalReason.ReligiousExemption) {
				WriteCE(18,"01","Religious exemption","NIP002");
			}
			else if(vaccine.RefusalReason==VaccineRefusalReason.Other) {
				WriteCE(18,"02",vaccine.Note,"NIP002");//The reason is required instead of a generic description for this particular situation.
			}
			else if(vaccine.RefusalReason==VaccineRefusalReason.PatientDecision) {
				WriteCE(18,"03","Patient decision","NIP002");
			}
			//RXA-19 Indication.  Optional.
			//RXA-20 Completion Status.  Required if known (length 2..2).  Value set HL70322 (guide page 225).  CP=Complete, RE=Refused, NA=Not Administered, PA=Partially Administered.
			if(vaccine.CompletionStatus==VaccineCompletionStatus.Refused) {
				_seg.SetField(20,"RE");
			}
			else if(vaccine.CompletionStatus==VaccineCompletionStatus.NotAdministered) {
				_seg.SetField(20,"NA");
			}
			else if(vaccine.CompletionStatus==VaccineCompletionStatus.PartiallyAdministered) {
				_seg.SetField(20,"PA");
			}
			else {//Complete (default)
				_seg.SetField(20,"CP");
			}
			//RXA-21 Action code.  Required if known (length 2..2).  Value set HL70323 (guide page 225).  A=Add, D=Delete, U=Update.
			if(vaccine.ActionCode==VaccineAction.Add) {
				_seg.SetField(21,"A");
			}
			else if(vaccine.ActionCode==VaccineAction.Delete) {
				_seg.SetField(21,"D");
			}
			else if(vaccine.ActionCode==VaccineAction.Update) {
				_seg.SetField(21,"U");
			}
			//RXA-22 System Entry Date/Time.  Optional.
			//RXA-23 Administered Drug Strength.  Optional.
			//RXA-24 Administered Drug Strength Volume Units.  Optional.
			//RXA-25 Administered Barcode Identifier.  Optional.
			//RXA-26 Pharmacy Order Type.  Optional.
			_msg.Segments.Add(_seg);
		}
Ejemplo n.º 7
0
		///<summary>Order Request segment.  Required.  Guide page 126.</summary>
		private void ORC(VaccinePat vaccine) {
			_seg=new SegmentHL7(SegmentNameHL7.ORC);
			_seg.SetField(0,"ORC");
			_seg.SetField(1,"RE");//ORC-1 Order Control.  Required (length 2).  Cardinality [1..1].  Value set HL70119.  The only allowed value is "RE".
			//ORC-2 Placer Order Number.  Required if known.  Cardinality [0..1].  Type EI (guid page 62).
			//ORC-3 Filler Order Number.  Required.  Cardinality [0..1].  Type EI (guid page 62).  "Shall be the unique ID of the sending system."  The city and state are used to record the region where the vaccine record was filled.
			WriteEI(3,vaccine.VaccinePatNum.ToString(),vaccine.FilledCity.Trim(),vaccine.FilledST.Trim());
			//ORC-4 Placer Group Number.  Optional.
			//ORC-5 Order Status.  Optional.
			//ORD-6 Response Flag.  Optional.
			//ORD-7 Quantity/Timing.  No longer used.
			//ORD-8 Parent.  Optional.
			//ORD-9 Date/Time of Transaction.  Optional.
			//ORD-10 Entered By.  Required if known.  Cardinality [0..1].  Type XCN.  This is the person that entered the immunization record into the system.
			Userod userod=Userods.GetUser(vaccine.UserNum);//Can be null if vaccine.UserNum=0 for older records before the vaccine.UserNum column existed.
			if(userod!=null) {
				if(userod.ProvNum!=0) {
					Provider provEnteredBy=Providers.GetProv(userod.ProvNum);
					WriteXCN(10,provEnteredBy.FName,provEnteredBy.LName,provEnteredBy.MI,vaccine.UserNum.ToString(),cityWhereEntered,stateWhereEntered,"D");
				}
				else if(userod.EmployeeNum!=0) {
					Employee employee=Employees.GetEmp(userod.EmployeeNum);
					WriteXCN(10,employee.FName,employee.LName,employee.MiddleI,vaccine.UserNum.ToString(),cityWhereEntered,stateWhereEntered,"D");
				}
			}
			//ORD-11 Verified By.  Optional.
			//ORD-12 Ordering Provider.  Required if known. Cardinality [0..1].  Type XCN.  This shall be the provider ordering the immunization.  It is expected to be empty if the immunization record is transcribed from a historical record.
			Provider provOrdering=Providers.GetProv(vaccine.ProvNumOrdering);//Can be null if vaccine.ProvNumOrdering is zero.
			if(provOrdering!=null) {
				WriteXCN(12,provOrdering.FName,provOrdering.LName,provOrdering.MI,provOrdering.ProvNum.ToString(),cityWhereEntered,stateWhereEntered,"L");
			}
			//ORD-13 Enterer's Location.  Optional.
			//ORD-14 Call Back Phone Number.  Optional.
			//ORD-15 Order Effective Date/Time.  Optional.
			//ORD-16 Order Control Code Reason.  Optional.
			//ORD-17 Entering Organization.  Optional.
			//ORD-18 Entering Device.  Optional.
			//ORD-19 Action By.  Optional.
			//ORD-20 Advanced Beneficiary Notice Code.  Optional.
			//ORD-21 Ordering Facility Name.  Optional.
			//ORD-22 Ordering Facility Address.  Optional.
			//ORD-23 Ordering Facility.  Optional.
			//ORD-24 Order Provider Address.  Optional.
			//ORD-25 Order Status Modifier.  Optional.
			//ORD-26 Advanced Beneficiary Notice Override Reason.  Optional.
			//ORD-27 Filler's Expected Availability Date/Time.  Optional.
			//ORD-28 Confidentiality Code.  Optional.
			//ORD-29 Order Type.  Optional.
			//ORD-30 Enterer Authorization Mode.  Optional.
			//ORD-31 Parent Universal Service Modifier.  Optional.
			_msg.Segments.Add(_seg);
		}
Ejemplo n.º 8
0
		///<summary>Observation Result segment.  Required if known.  The basic format is question and answer.  Guide page 116.</summary>
		private void OBX(VaccinePat vaccine) {
			List<VaccineObs> listVaccineObservations=VaccineObses.GetForVaccine(vaccine.VaccinePatNum);
			for(int i=0;i<listVaccineObservations.Count;i++) {
				VaccineObs vaccineObs=listVaccineObservations[i];
				_seg=new SegmentHL7(SegmentNameHL7.OBX);
				_seg.SetField(0,"OBX");
				_seg.SetField(1,(i+1).ToString());//OBX-1 Set ID - OBX.  Required (length 1..4).  Cardinality [1..1].
				//OBX-2 Value Type.  Required (length 2..3).  Cardinality [1..1].  Value Set HL70125 (constrained, not in guide).  CE=Coded Entry,DT=Date,NM=Numeric,ST=String,TS=Time Stamp (Date & Time).
				if(vaccineObs.ValType==VaccineObsType.Dated) {
					_seg.SetField(2,"DT");
				}
				else if(vaccineObs.ValType==VaccineObsType.Numeric) {
					_seg.SetField(2,"NM");
				}
				else if(vaccineObs.ValType==VaccineObsType.Text) {
					_seg.SetField(2,"ST");
				}
				else if(vaccineObs.ValType==VaccineObsType.DateAndTime) {
					_seg.SetField(2,"TS");
				}
				else { //vaccineObs.ValType==VaccineObsType.Coded
					_seg.SetField(2,"CE");
				}
				//OBX-3 Observation Identifier.  Required.  Cardinality [1..1].  Value set NIP003 (25 items).  Type CE.  Purpose is to pose the question that is answered by OBX-5.
				if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DatePublished) {
					WriteCE(3,"29768-9","Date vaccine information statement published","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DatePresented) {
					WriteCE(3,"29769-7","Date vaccine information statement presented","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DatePrecautionExpiration) {
					WriteCE(3,"30944-3","Date of vaccination temporary contraindication and or precaution expiration","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.Precaution) {
					WriteCE(3,"30945-0","Vaccination contraindication and or precaution","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DatePrecautionEffective) {
					WriteCE(3,"30946-8","Date vaccination contraindication and or precaution effective","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.TypeOf) {
					WriteCE(3,"30956-7","Vaccine Type","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.FundsPurchasedWith) {
					WriteCE(3,"30963-3","Funds vaccine purchased with","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DoseNumber) {
					WriteCE(3,"30973-2","Dose number","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.NextDue) {
					WriteCE(3,"30979-9","Vaccines due next","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DateDue) {
					WriteCE(3,"30980-7","Date vaccine due","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DateEarliestAdminister) {
					WriteCE(3,"30981-5","Earliest date to give","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.ReasonForcast) {
					WriteCE(3,"30982-3","Reason applied by forcast logic to project this vaccine","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.Reaction) {
					WriteCE(3,"31044-1","Reaction","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.ComponentType) {
					WriteCE(3,"38890-0","Vaccine component type","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.TakeResponseType) {
					WriteCE(3,"46249-9","Vaccination take-response type","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DateTakeResponse) {
					WriteCE(3,"46250-7","Vaccination take-response date","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.ScheduleUsed) {
					WriteCE(3,"59779-9","Immunization schedule used","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.Series) {
					WriteCE(3,"59780-7","Immunization series","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DoseValidity) {
					WriteCE(3,"59781-5","Dose validity","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.NumDosesPrimary) {
					WriteCE(3,"59782-3","Number of doses in primary immunization series","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.StatusInSeries) {
					WriteCE(3,"59783-1","Status in immunization series","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.DiseaseWithImmunity) {
					WriteCE(3,"59784-9","Disease with presumed immunity","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.Indication) {
					WriteCE(3,"59785-6","Indication for Immunization","LN");
				}
				else if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.FundPgmEligCat) {
					WriteCE(3,"64994-7","Vaccine funding program eligibility category","LN");
				}
				else { //vaccineObs.IdentifyingCode==VaccineObsIdentifier.DocumentType
					WriteCE(3,"69764-9","Document type","LN");
				}
				//OBX-4 Observation Sub-ID.  Required (length 1..20).  Cardinality [1..1].  Type ST.
				if(vaccineObs.VaccineObsNumGroup==0) {
					_seg.SetField(4,vaccineObs.VaccineObsNum.ToString());
				}
				else {//vaccineObs.VaccineObsNumGroup!=0
					_seg.SetField(4,vaccineObs.VaccineObsNumGroup.ToString());
				}
				//OBX-5 Observation Value.  Required. Cardinality [1..1].  Value set varies, depending on the value of OBX-2 (Use type CE if OBX-2 is "CE", otherwise treat as a string).  Purpose is to answer the quesiton posed by OBX-3.
				if(vaccineObs.ValType==VaccineObsType.Coded) {
					string codeDescript=vaccineObs.ValReported.Trim();//If we do not know the description, then the code will also be placed into the description. The testing tool required non-empty entries.
					if(vaccineObs.ValCodeSystem==VaccineObsValCodeSystem.CVX) {
						Cvx cvx=Cvxs.GetByCode(vaccineObs.ValReported);
						codeDescript=cvx.Description;
					}
					else if(vaccineObs.ValCodeSystem==VaccineObsValCodeSystem.HL70064) {
						if(vaccineObs.ValReported.ToUpper()=="V01") {
							codeDescript="Not VFC eligible";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V02") {
							codeDescript="VFC eligible-Medicaid/Medicaid Managed Care";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V03") {
							codeDescript="VFC eligible- Uninsured";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V04") {
							codeDescript="VFC eligible- American Indian/Alaskan Native";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V05") {
							codeDescript="VFC eligible-Federally Qualified Health Center Patient (under-insured)";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V06") {
							codeDescript="Deprecated [VFC eligible- State specific eligibility (e.g. S-CHIP plan)]";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V07") {
							codeDescript="Local-specific eligibility";
						}
						else if(vaccineObs.ValReported.ToUpper()=="V08") {
							codeDescript="Deprecated [Not VFC eligible-underinsured]";
						}
					}
					WriteCE(5,vaccineObs.ValReported.Trim(),codeDescript,vaccineObs.ValCodeSystem.ToString());
				}
				else if(vaccineObs.ValType==VaccineObsType.Dated) {
					DateTime dateVal=DateTime.Parse(vaccineObs.ValReported.Trim());
					_seg.SetField(5,dateVal.ToString("yyyyMMdd"));
				}
				else if(vaccineObs.ValType==VaccineObsType.Numeric) {
					_seg.SetField(5,vaccineObs.ValReported.Trim());
				}
				else if(vaccineObs.ValType==VaccineObsType.DateAndTime) {
					DateTime dateVal=DateTime.Parse(vaccineObs.ValReported.Trim());
					string strDateOut=dateVal.ToString("yyyyMMdd");
					//The testing tool threw errors when there were trailing zeros, even though technically valid.
					if(dateVal.Second>0) {
						strDateOut+=dateVal.ToString("HHmmss");
					}
					else if(dateVal.Minute>0) {
						strDateOut+=dateVal.ToString("HHmm");
					}
					else if(dateVal.Hour>0) {
						strDateOut+=dateVal.ToString("HH");
					}
					_seg.SetField(5,strDateOut);
				}
				else { //vaccineObs.ValType==VaccineObsType.Text
					_seg.SetField(5,vaccineObs.ValReported);
				}
				//OBX-6 Units.  Required if OBX-2 is "NM" or "SN" (SN appears to be missing from definition).
				if(vaccineObs.ValType==VaccineObsType.Numeric) {
					Ucum ucum=Ucums.GetByCode(vaccineObs.UcumCode);
					WriteCE(6,ucum.UcumCode,ucum.Description,"UCUM");
				}
				//OBX-7 References Range.  Optional.
				//OBX-8 Abnormal Flags.  Optional.
				//OBX-9 Probability.  Optional.
				//OBX-10 Nature of Abnormal Test.  Optional.
				_seg.SetField(11,"F");//OBX-11 Observation Result Status.  Required (length 1..1).  Cardinality [1..1].  Value set HL70085 (constrained, guide page 198).  We are expected to use value F=Final.
				//OBX-12 Effective Date of Reference Range Values.  Optional.
				//OBX-13 User Defined Access Checks.  Optional.
				//OBX-14 Date/Time of the Observation.  Required if known.  Cardinality [0..1].
				if(vaccineObs.DateObs.Year>1880) {
					_seg.SetField(14,vaccineObs.DateObs.ToString("yyyyMMdd"));
				}
				//OBX-15 Producer's Reference.  Optional.
				//OBX-16 Responsible Observer.  Optional.
				//OBX-17 Observation Method.  Required if OBX-3.1 is “64994-7”.  Value set CDCPHINVS. Type CE.
				if(vaccineObs.IdentifyingCode==VaccineObsIdentifier.FundPgmEligCat) {
					_seg.SetField(17,vaccineObs.MethodCode.Trim(),"","CDCPHINVS");
				}
				//OBX-18 Equipment Instance Identifier.  Optional.
				//OBX-19 Date/Time of the Analysis.  Optional.
				//OBX-20 Reserved for harmonization with V2.6.  Optional.
				//OBX-21 Reserved for harmonization with V2.6.  Optional.
				//OBX-22 Reserved for harmonization with V2.6.  Optional.
				//OBX-23 Performing Organization Name.  Optional.
				//OBX-24 Performing Organization Address.  Optional.
				//OBX-25 Performing Organization Medical Director.  Optional.
				_msg.Segments.Add(_seg);
			}
		}
Ejemplo n.º 9
0
Archivo: EhrCCD.cs Proyecto: mnisl/OD
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionImmunizations(bool hasImmunization) {
			_w.WriteComment(@"
=====================================================================================================
Immunizations
=====================================================================================================");
			List<VaccinePat> listVaccinePatsFiltered;
			if(!hasImmunization) {
				listVaccinePatsFiltered=new List<VaccinePat>();
			}
			else {
				listVaccinePatsFiltered=_listVaccinePatsFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.2.1");//Immunizations section with coded entries required.
			_w.WriteComment("Immunizations section template");
			StartAndEnd("code","code","11369-6","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","History of immunizations");
			_w.WriteElementString("title","Immunizations");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listVaccinePatsFiltered.Count>0 && hasImmunization) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Vaccine");
				_w.WriteElementString("th","Date");
				_w.WriteElementString("th","Status");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listVaccinePatsFiltered.Count;i++) {
					VaccineDef vaccineDef;
					if(listVaccinePatsFiltered[i].VaccineDefNum==0) {
						vaccineDef=new VaccineDef();
					}
					else {
						vaccineDef=VaccineDefs.GetOne(listVaccinePatsFiltered[i].VaccineDefNum);
					}
					Start("tr");
					Cvx cvx;
					if(String.IsNullOrEmpty(vaccineDef.CVXCode)) {
						cvx=new Cvx();
					}
					else {
						cvx=Cvxs.GetOneFromDb(vaccineDef.CVXCode);
					}
					if(String.IsNullOrEmpty(cvx.CvxCode)) {
						_w.WriteElementString("td","");
					}
					else {
						_w.WriteElementString("td",cvx.CvxCode+" - "+cvx.Description);
					}
					if(listVaccinePatsFiltered[i].DateTimeStart.Year<1880) {
						_w.WriteElementString("td","");
					}
					else {
						DateText("td",listVaccinePatsFiltered[i].DateTimeStart);
					}
					_w.WriteElementString("td","Completed");
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listVaccinePatsFiltered.Count==0) {//If there are no entries in the filtered list, then we want to add a dummy entry since at least one is required.
				VaccinePat vacPat=new VaccinePat();
				listVaccinePatsFiltered.Add(vacPat);
			}
			for(int i=0;i<listVaccinePatsFiltered.Count;i++) {
				VaccineDef vaccineDef;
				if(listVaccinePatsFiltered[i].VaccinePatNum==0) {
					vaccineDef=new VaccineDef();
				}
				else {
					vaccineDef=VaccineDefs.GetOne(listVaccinePatsFiltered[i].VaccineDefNum);
				}
				Start("entry","typeCode","DRIV");
				Start("substanceAdministration","classCode","SBADM","moodCode","EVN","negationInd",(listVaccinePatsFiltered[i].CompletionStatus==VaccineCompletionStatus.NotAdministered)?"true":"false");
				TemplateId("2.16.840.1.113883.10.20.22.4.52");
				_w.WriteComment("Immunization Activity Template");
				Guid();
				StartAndEnd("statusCode","code","completed");
				Start("effectiveTime");
				_w.WriteAttributeString("xsi","type",null,"IVL_TS");
				if(listVaccinePatsFiltered[i].DateTimeStart.Year<1880) {
					Attribs("nullFlavor","UNK");
				}
				else {
					Attribs("value",listVaccinePatsFiltered[i].DateTimeStart.ToString("yyyyMMdd"));
				}
				End("effectiveTime");
				Start("consumable");
				Start("manufacturedProduct","classCode","MANU");
				TemplateId("2.16.840.1.113883.10.20.22.4.54");
				_w.WriteComment("Immunization Medication Information");
				Start("manufacturedMaterial");
				if(String.IsNullOrEmpty(vaccineDef.CVXCode)) {
					StartAndEnd("code","nullFlavor","UNK");
				}
				else {
					Cvx cvx=Cvxs.GetOneFromDb(vaccineDef.CVXCode);
					StartAndEnd("code","code",cvx.CvxCode,"codeSystem",strCodeSystemCvx,"displayName",cvx.Description,"codeSystemName",strCodeSystemNameCvx);
				}
				End("manufacturedMaterial");
				End("manufacturedProduct");
				End("consumable");
				//Possibly add an Instructions Template
				End("substanceAdministration");
				End("entry");
			}
			End("section");
			End("component");
		}
Ejemplo n.º 10
0
Archivo: VXU.cs Proyecto: nampn/ODental
 private void RXA(VaccinePat vaccine)
 {
     VaccineDef vaccineDef=VaccineDefs.GetOne(vaccine.VaccineDefNum);
     seg=new SegmentHL7(SegmentName.RXA);
     seg.SetField(0,"RXA");
     seg.SetField(1,"0");//fixed
     seg.SetField(2,"1");//fixed
     seg.SetField(3,vaccine.DateTimeStart.ToString("yyyyMMddHHmm"));
     seg.SetField(4,vaccine.DateTimeEnd.ToString("yyyyMMddHHmm"));
     seg.SetField(5,vaccineDef.CVXCode,vaccineDef.VaccineName,"HL70292");
     if(vaccine.AdministeredAmt==0){
         seg.SetField(6,"999");
     }
     else{
         seg.SetField(6,vaccine.AdministeredAmt.ToString());
     }
     if(vaccine.DrugUnitNum!=0){
         DrugUnit drugUnit=DrugUnits.GetOne(vaccine.DrugUnitNum);
         seg.SetField(7,drugUnit.UnitIdentifier,drugUnit.UnitText,"ISO+");
     }
     seg.SetField(15,vaccine.LotNumber);//optional.
     //17-Manufacturer.  Is this really optional?
     if(vaccineDef.DrugManufacturerNum!=0) {//always?
         DrugManufacturer manufacturer=DrugManufacturers.GetOne(vaccineDef.DrugManufacturerNum);
         seg.SetField(17,manufacturer.ManufacturerCode,manufacturer.ManufacturerName,"HL70227");
     }
     seg.SetField(21,"A");//21-Action code, A=Add
     msg.Segments.Add(seg);
 }