Exemple #1
0
 /// <summary>
 /// </summary>
 private Patient CreatePatient(String LastName,String FirstName,DateTime birthDate,WebSheets.SheetAndSheetField sAnds)
 {
     Patient newPat=new Patient();
     newPat.LName=LastName;
     newPat.FName=FirstName;
     newPat.Birthdate=birthDate;
     newPat.ClinicNum=Security.CurUser.ClinicNum;
     Type t=newPat.GetType();
     FieldInfo[] fi=t.GetFields();
     foreach(FieldInfo field in fi) {
         // find match for fields in Patients in the web_sheetfieldlist
         var WebSheetFieldList=sAnds.web_sheetfieldlist.Where(sf=>sf.FieldName.ToLower()==field.Name.ToLower());
         if(WebSheetFieldList.Count()>0) {
             // this loop is used to fill a field that may generate mutiple values for a single field in the patient.
             //for example the field gender has 2 eqivalent sheet fields in the web_sheetfieldlist
             for(int i=0;i<WebSheetFieldList.Count();i++) {
                 WebSheets.webforms_sheetfield sf=WebSheetFieldList.ElementAt(i);
                 String SheetWebFieldValue=sf.FieldValue;
                 String RadioButtonValue=sf.RadioButtonValue;
                 FillPatientFields(newPat,field,SheetWebFieldValue,RadioButtonValue);
             }
         }
     }
     try{
         Patients.Insert(newPat,false);
         //set Guarantor field the same as PatNum
         Patient patOld=newPat.Copy();
         newPat.Guarantor=newPat.PatNum;
         Patients.Update(newPat,patOld);
     }
     catch(Exception e) {
         gridMain.EndUpdate();
         MessageBox.Show(e.Message);
     }
     return newPat;
 }
Exemple #2
0
 /// <summary>
 /// </summary>
 private Sheet CreateSheet(long PatNum,WebSheets.SheetAndSheetField sAnds)
 {
     Sheet newSheet=null;
     try{
         SheetDef sheetDef=new SheetDef((SheetTypeEnum)sAnds.web_sheet.SheetType);
             newSheet=SheetUtil.CreateSheet(sheetDef,PatNum);
             SheetParameter.SetParameter(newSheet,"PatNum",PatNum);
             newSheet.DateTimeSheet=sAnds.web_sheet.DateTimeSheet;
             newSheet.Description=sAnds.web_sheet.Description;
             newSheet.Height=sAnds.web_sheet.Height;
             newSheet.Width=sAnds.web_sheet.Width;
             newSheet.FontName=sAnds.web_sheet.FontName;
             newSheet.FontSize=sAnds.web_sheet.FontSize;
             newSheet.SheetType=(SheetTypeEnum)sAnds.web_sheet.SheetType;
             newSheet.IsLandscape=sAnds.web_sheet.IsLandscape==(sbyte)1?true:false;
             newSheet.InternalNote="";
             newSheet.IsWebForm=true;
             //loop through each variable in a single sheetfield
             for(int i=0;i<sAnds.web_sheetfieldlist.Count();i++) {
                 SheetField sheetfield=new SheetField();
                 sheetfield.FieldName=sAnds.web_sheetfieldlist[i].FieldName;
                 sheetfield.FieldType=(SheetFieldType)sAnds.web_sheetfieldlist[i].FieldType;
                 //sheetfield.FontIsBold=sAnds.web_sheetfieldlist[i].FontIsBold==(sbyte)1?true:false;
                 if(sAnds.web_sheetfieldlist[i].FontIsBold==(sbyte)1) {
                     sheetfield.FontIsBold=true;
                 }else{
                     sheetfield.FontIsBold=false;
                 }
                 sheetfield.FontIsBold=sAnds.web_sheetfieldlist[i].FontIsBold==(sbyte)1?true:false;
                 sheetfield.FontName=sAnds.web_sheetfieldlist[i].FontName;
                 sheetfield.FontSize=sAnds.web_sheetfieldlist[i].FontSize;
                 sheetfield.Height=sAnds.web_sheetfieldlist[i].Height;
                 sheetfield.Width=sAnds.web_sheetfieldlist[i].Width;
                 sheetfield.XPos=sAnds.web_sheetfieldlist[i].XPos;
                 sheetfield.YPos=sAnds.web_sheetfieldlist[i].YPos;
                 //sheetfield.IsRequired=sAnds.web_sheetfieldlist[i].IsRequired==(sbyte)1?true:false;
                 if(sAnds.web_sheetfieldlist[i].IsRequired==(sbyte)1) {
                     sheetfield.IsRequired=true;
                 }
                 else {
                     sheetfield.IsRequired=false;
                 }
                 sheetfield.TabOrder=sAnds.web_sheetfieldlist[i].TabOrder;
                 sheetfield.RadioButtonGroup=sAnds.web_sheetfieldlist[i].RadioButtonGroup;
                 sheetfield.RadioButtonValue=sAnds.web_sheetfieldlist[i].RadioButtonValue;
                 sheetfield.GrowthBehavior=(GrowthBehaviorEnum)sAnds.web_sheetfieldlist[i].GrowthBehavior;
                 sheetfield.FieldValue=sAnds.web_sheetfieldlist[i].FieldValue;
                 newSheet.SheetFields.Add(sheetfield);
             }// end of j loop
             Sheets.SaveNewSheet(newSheet);
             return newSheet;
     }
     catch(Exception e) {
         gridMain.EndUpdate();
         MessageBox.Show(e.Message);
     }
     return newSheet;
 }
Exemple #3
0
		/// <summary>
		/// </summary>
		private Patient CreatePatient(String LastName,String FirstName,DateTime birthDate,WebSheets.SheetAndSheetField sAnds) {
			Patient newPat=new Patient();
			newPat.LName=LastName;
			newPat.FName=FirstName;
			newPat.Birthdate=birthDate;
			newPat.ClinicNum=Security.CurUser.ClinicNum;
			Type t=newPat.GetType();
			FieldInfo[] fi=t.GetFields();
			foreach(FieldInfo field in fi) {
				// find match for fields in Patients in the web_sheetfieldlist
				var WebSheetFieldList=sAnds.web_sheetfieldlist.Where(sf=>sf.FieldName.ToLower()==field.Name.ToLower());
				if(WebSheetFieldList.Count()>0) {
					// this loop is used to fill a field that may generate mutiple values for a single field in the patient.
					//for example the field gender has 2 eqivalent sheet fields in the web_sheetfieldlist
					for(int i=0;i<WebSheetFieldList.Count();i++) {
						WebSheets.webforms_sheetfield sf=WebSheetFieldList.ElementAt(i);
						String SheetWebFieldValue=sf.FieldValue;
						String RadioButtonValue=sf.RadioButtonValue;
						FillPatientFields(newPat,field,SheetWebFieldValue,RadioButtonValue);
					}
				}
			}
			try{
				Patients.Insert(newPat,false);
				//set Guarantor field the same as PatNum
				Patient patOld=newPat.Copy();
				newPat.Guarantor=newPat.PatNum;
				Patients.Update(newPat,patOld);
				//If there is an existing HL7 def enabled, send an ADT message if there is an outbound ADT message defined
				if(HL7Defs.IsExistingHL7Enabled()) {
					MessageHL7 messageHL7=MessageConstructor.GenerateADT(newPat,newPat,EventTypeHL7.A04);//patient is guarantor
					//Will be null if there is no outbound ADT message defined, so do nothing
					if(messageHL7!=null) {
						HL7Msg hl7Msg=new HL7Msg();
						hl7Msg.AptNum=0;
						hl7Msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
						hl7Msg.MsgText=messageHL7.ToString();
						hl7Msg.PatNum=newPat.PatNum;
						HL7Msgs.Insert(hl7Msg);
#if DEBUG
						MessageBox.Show(this,messageHL7.ToString());
#endif
					}
				}
			}
			catch(Exception e) {
				gridMain.EndUpdate();
				MessageBox.Show(e.Message);
			}
			return newPat;
		}