Example #1
0
		///<summary>Test 12: EcwOldTight,EcwOldFull,EcwTight,HL7DefEcwFull: Create message with multiple providers.  Change the provider for the D2332 procedure on the appointment with AptNum=500 to DOC2 from Test 10.  Create DFT message again for this patient, provider, appointment, and procedures and verify that the FT1 segment for that procedure lists the correct provider.  EcwOldStandalone,HL7DefEcwStandalone: DFT messages are not created in Standalone mode.</summary>
		public static string Test12(HL7TestInterfaceEnum hl7TestInterfaceEnum) {
			if(hl7TestInterfaceEnum==HL7TestInterfaceEnum.EcwOldStandalone 
				|| hl7TestInterfaceEnum==HL7TestInterfaceEnum.HL7DefEcwStandalone) 
			{
				return "Test 12: Passed.\r\n";
			}
			long aptNum=500;
			Procedure proc=new Procedure();
			List<Procedure> procList=Procedures.GetProcsForSingle(aptNum,false);
			if(procList==null) {
				return "Test 12: Couldn't locate procedures for appointment.\r\n";
			}
			for(int i=0;i<procList.Count;i++) {
				if(procList[i].CodeNum==ProcedureCodes.GetCodeNum("D2332")) {
					proc=procList[i];
					break;
				}
			}
			if(proc==null) {
				return "Test 12: Couldn't locate procedure D2332.\r\n";
			}
			Procedure oldProc=proc.Copy();
			Provider prov2=Providers.GetProvByEcwID("DOC2");
			if(prov2==null) {
				return "Test 12: Couldn't locate DOC2 provider.\r\n";
			}
			proc.ProvNum=prov2.ProvNum;
			Procedures.Update(proc,oldProc);
			Patient pat=Patients.GetPat(10);
			Patient guar=Patients.GetPat(11);
			if(pat==null) {
				return "Test 12: Couldn't locate patient.\r\n";
			}
			if(guar==null) {
				return "Test 12: Couldn't locate guarantor.\r\n";
			}
			Provider prov=Providers.GetProvByEcwID("DOC1");
			if(prov==null) {
				return "Test 12: Couldn't locate DOC1 provider.\r\n";
			}
			long provNum=prov.ProvNum;
			MessageHL7 msg=null;
			try {
				switch(hl7TestInterfaceEnum) {
					//EcwOldStandalone and HL7DefEcwStandalone were handled higher up
					case HL7TestInterfaceEnum.EcwOldFull:
					case HL7TestInterfaceEnum.EcwOldTight:
						OpenDentBusiness.HL7.EcwDFT dft=new OpenDentBusiness.HL7.EcwDFT();
						dft.InitializeEcw(aptNum,provNum,pat,"Test Message","treatment",false);
						msg=new MessageHL7(dft.GenerateMessage());
						break;
					case HL7TestInterfaceEnum.HL7DefEcwFull:
					case HL7TestInterfaceEnum.HL7DefEcwTight:
						msg=new MessageHL7(OpenDentBusiness.HL7.MessageConstructor.GenerateDFT(procList,EventTypeHL7.P03,pat,guar,aptNum,"treatment","Test Message").ToString());
						//msg will be null if there's not DFT defined for the def.  Should handle results for those defs higher up
						break;
					default:
						return "Test 12: interface not found.";
				}
			}
			catch(Exception ex) {
				return "Test 12: Message creation error. "+ex+".\r\n";
			}
			string provField="";
			string provField2="";
			switch(hl7TestInterfaceEnum) {
				case HL7TestInterfaceEnum.EcwOldFull:
				case HL7TestInterfaceEnum.EcwOldTight:
					provField="DOC1^Albert, Brian S^^";
					provField2="DOC2^Lexington^Sarah^J";
					break;
				default:
					provField="DOC1^Albert^Brian^S";
					provField2="DOC2^Lexington^Sarah^J";
					break;
			}
			string msgtext=@"MSH|^~\&|OD||ECW||"+msg.Segments[0].GetFieldFullText(6)+"||DFT^P03||P|2.3\r\n"
			  +"EVN|P03|"+msg.Segments[1].GetFieldFullText(2)+"|\r\n"
			  +"PID|1|A11|10||Smith^Jane^N||19760205|F||White|421 Main St^Apt 17^Dallas^OR^97338||5035554045|5035554234||Married|||111224444|||\r\n"
			  +"PV1|||||||"+provField+"||||||||||||500|||||||||||||||||||||||||||||||\r\n"
			  +"FT1|1|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|75.00|||D0150|^\r\n"
			  +"FT1|2|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|20.00|||D0230|^\r\n"
			  +"FT1|3|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|20.00|||D0230|^\r\n"
			  +"FT1|4|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField2+"|"+provField2+"|150.00|||D2332|26^MID\r\n"
			  +"ZX1|6|PDF|PATHOLOGY^Pathology Report^L|treatment|Test Message";
			MessageHL7 correctMsg=new MessageHL7(msgtext);
			string retval=CompareMsgs(msg,correctMsg);
			if(retval.Length>0) {
				return "Test 12: "+retval;
			}
			return "Test 12: Passed.\r\n";
		}
Example #2
0
		///<summary>Test 11: EcwOldTight,EcwOldFull,EcwTight,HL7DefEcwFull: Add 2 D0230 procedures, a D0150 procedure, and a D2332 procedure all with complete status and ProcDate='2012-09-06' to patient with PatNum=10.  Set the D2332 procedurelog.ToothNum=26 and procedurelog.Surf=MID.  Make sure the procedurelog.ProcFee for D0230 is 20.00, the D0150 is 75.00, and the D2332 is 150.00.  Using DOC1 provider from TEST 9, schedule appointment for patient 10 with appointment.AptNum=500 and appointment.ProvNum=provider.ProvNum and attach the four procedures.  Create a DFT message for this patient, provider, appointment, and procedures.  EcwOldStandalone,HL7DefEcwStandalone: DFT messages are not created in Standalone mode.</summary>
		public static string Test11(HL7TestInterfaceEnum hl7TestInterfaceEnum) {
			if(hl7TestInterfaceEnum==HL7TestInterfaceEnum.EcwOldStandalone 
				|| hl7TestInterfaceEnum==HL7TestInterfaceEnum.HL7DefEcwStandalone) {
					return "Test 11: Passed.\r\n";
			}
			List<Procedure> procList=new List<Procedure>();
			//Add the 4 procs to the procedurelog table on the correct date, for the correct appointment and patient and provider.
			Procedure proc=new Procedure();
			proc.AptNum=500;
			proc.PatNum=10;
			proc.ProcDate=new DateTime(2012,09,06);
			proc.CodeNum=ProcedureCodes.GetCodeNum("D0150");
			proc.ProcStatus=ProcStat.C;
			if(Providers.GetProvByEcwID("DOC1")==null) {
				return "Test 11: Couldn't locate provider.\r\n";
			}
			proc.ProvNum=Providers.GetProvByEcwID("DOC1").ProvNum;
			proc.ProcFee=75.00;
			Procedures.Insert(proc);
			procList.Add(proc);
			proc=new Procedure();
			proc.AptNum=500;
			proc.PatNum=10;
			proc.ProcDate=new DateTime(2012,09,06);
			proc.CodeNum=ProcedureCodes.GetCodeNum("D0230");
			proc.ProcStatus=ProcStat.C;
			proc.ProvNum=Providers.GetProvByEcwID("DOC1").ProvNum;
			proc.ProcFee=20.00;
			Procedures.Insert(proc);
			procList.Add(proc);
			Procedures.Insert(proc);
			procList.Add(proc);
			proc=new Procedure();
			proc.AptNum=500;
			proc.PatNum=10;
			proc.ProcDate=new DateTime(2012,09,06);
			proc.CodeNum=ProcedureCodes.GetCodeNum("D2332");
			proc.ProcStatus=ProcStat.C;
			proc.ProvNum=Providers.GetProvByEcwID("DOC1").ProvNum;
			proc.ToothNum="26";
			proc.Surf="MID";
			proc.ProcFee=150.00;
			Procedures.Insert(proc);
			procList.Add(proc);
			Appointment apt=new Appointment();
			apt.AptNum=500;
			apt.AptDateTime=new DateTime(2012,09,06,10,0,0);
			apt.PatNum=10;
			apt.ProvNum=Providers.GetProvByEcwID("DOC1").ProvNum;
			long aptNum=Appointments.InsertIncludeAptNum(apt,true);
			long provNum=apt.ProvNum;
			Patient pat=Patients.GetPat(10); if(pat==null) {
				return "Test 11: Couldn't locate patient.\r\n";
			}
			Patient oldPat=pat.Copy();
			pat.PriProv=Providers.GetProvByEcwID("DOC1").ProvNum;
			Patients.Update(pat,oldPat);
			Patient guar=Patients.GetPat(11);
			if(guar==null) {
				return "Test 11: Couldn't locate guarantor.\r\n";
			}
			MessageHL7 msg=null;
			try {
				switch(hl7TestInterfaceEnum) {
					//EcwOldStandalone and HL7DefEcwStandalone were handled higher up
					case HL7TestInterfaceEnum.EcwOldFull:
					case HL7TestInterfaceEnum.EcwOldTight:
						OpenDentBusiness.HL7.EcwDFT dft=new OpenDentBusiness.HL7.EcwDFT();
						dft.InitializeEcw(aptNum,provNum,pat,"Test Message","treatment",false);
						msg=new MessageHL7(dft.GenerateMessage());
						break;
					case HL7TestInterfaceEnum.HL7DefEcwFull:
					case HL7TestInterfaceEnum.HL7DefEcwTight:
						msg=new MessageHL7(OpenDentBusiness.HL7.MessageConstructor.GenerateDFT(procList,EventTypeHL7.P03,pat,guar,aptNum,"treatment","Test Message").ToString());
						//msg will be null if there's not DFT defined for the def.  Should handle results for those defs higher up
						break;
					default:
						return "Test 11: interface not found.";
				}
			}
			catch(Exception ex) {
				return "Test 11: Message creation error. "+ex+".\r\n";
			}
			string provField="";
			switch(hl7TestInterfaceEnum) {
				case HL7TestInterfaceEnum.EcwOldFull:
				case HL7TestInterfaceEnum.EcwOldTight:
					provField="DOC1^Albert, Brian S^^";
					break;
				default:
					provField="DOC1^Albert^Brian^S";
					break;
			}
			string msgtext=@"MSH|^~\&|OD||ECW||"+msg.Segments[0].GetFieldFullText(6)+"||DFT^P03||P|2.3\r\n"
				+"EVN|P03|"+msg.Segments[1].GetFieldFullText(2)+"|\r\n"
				+"PID|1|A11|10||Smith^Jane^N||19760205|F||White|421 Main St^Apt 17^Dallas^OR^97338||5035554045|5035554234||Married|||111224444|||\r\n"
				+"PV1|||||||"+provField+"||||||||||||500|||||||||||||||||||||||||||||||\r\n"
				+"FT1|1|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|75.00|||D0150|^\r\n"
				+"FT1|2|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|20.00|||D0230|^\r\n"
				+"FT1|3|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|20.00|||D0230|^\r\n"
				+"FT1|4|||20120906000000|20120906000000|CG||||1.0||||||||||"+provField+"|"+provField+"|150.00|||D2332|26^MID\r\n"
				+"ZX1|6|PDF|PATHOLOGY^Pathology Report^L|treatment|Test Message";
			MessageHL7 correctMsg=new MessageHL7(msgtext);
			string retval=CompareMsgs(msg,correctMsg);
			if(retval.Length>0) {
				return "Test 11: "+retval;
			}
			return "Test 11: Passed.\r\n";
		}