Exemplo n.º 1
0
		private void butExport_Click(object sender,EventArgs e) {
			string strCcdValidationErrors=EhrCCD.ValidateSettings();
			if(strCcdValidationErrors!="") {//Do not even try to export if global settings are invalid.
				MessageBox.Show(strCcdValidationErrors);//We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
				return;
			}
			FolderBrowserDialog dlg=new FolderBrowserDialog();
			DialogResult result=dlg.ShowDialog();
			if(result!=DialogResult.OK) {
				return;
			}
			DateTime dateNow=DateTime.Now;
			string folderPath=ODFileUtils.CombinePaths(dlg.SelectedPath,(dateNow.Year+"_"+dateNow.Month+"_"+dateNow.Day));
			if(Directory.Exists(folderPath)) {
				int loopCount=1;
				while(Directory.Exists(folderPath+"_"+loopCount)) {
					loopCount++;
				}
				folderPath=folderPath+"_"+loopCount;
			}
			try {
				Directory.CreateDirectory(folderPath);
			}
			catch {
				MessageBox.Show("Error, Could not create folder");
				return;
			}
			this.Cursor=Cursors.WaitCursor;
			Patient patCur;
			string fileName;
			int numSkipped=0;  //Number of patients skipped. Set to -1 if only one patient was selected and had CcdValidationErrors.
			string patientsSkipped="";  //Names of the patients that were skipped, so we can tell the user which ones didn't export correctly.
			for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
				patCur=Patients.GetPat((long)gridMain.Rows[gridMain.SelectedIndices[i]].Tag);//Cannot use GetLim because more information is needed in the CCD message generation below.
				strCcdValidationErrors=EhrCCD.ValidatePatient(patCur);
				if(strCcdValidationErrors!="") {
					if(gridMain.SelectedIndices.Length==1) {
						numSkipped=-1; //Set to -1 so we know below to not show the "exported" message.
						MessageBox.Show(Lan.g(this,"Patient not exported due to the following errors")+":\r\n"+strCcdValidationErrors);
						continue;
					}
					//If one patient is missing the required information for export, then simply skip the patient. We do not want to popup a message,
					//because it would be hard to get through the export if many patients were missing required information.
					numSkipped++;
					patientsSkipped+="\r\n"+patCur.LName+", "+patCur.FName;
					continue;
				}
				fileName="";
				string lName=patCur.LName;
				for(int j=0;j<lName.Length;j++) {  //Strip all non-letters from FName
					if(Char.IsLetter(lName,j)) {
						fileName+=lName.Substring(j,1);
					}
				}
				fileName+="_";
				string fName=patCur.FName;
				for(int k=0;k<fName.Length;k++) {  //Strip all non-letters from LName
					if(Char.IsLetter(fName,k)) {
						fileName+=fName.Substring(k,1);
					}
				}
				fileName+="_"+patCur.PatNum;  //LName_FName_PatNum
				string ccd=EhrCCD.GeneratePatientExport(patCur);
				try {
					File.WriteAllText(ODFileUtils.CombinePaths(folderPath,fileName+".xml"),ccd);
				}
				catch {
					MessageBox.Show("Error, Could not create xml file");
					this.Cursor=Cursors.Default;
					return;
				}
			}
			if(numSkipped==-1) {	//Will be -1 if only one patient was selected, and it did not export correctly.
				this.Cursor=Cursors.Default;
				return;//Don't display "Exported" to the user because the CCD was not exported.
			}
			try {
				File.WriteAllText(ODFileUtils.CombinePaths(folderPath,"CCD.xsl"),FormEHR.GetEhrResource("CCD"));
			}
			catch {
				MessageBox.Show("Error, Could not create stylesheet file");
			}
			string strMsg=Lan.g(this,"Exported");
			if(numSkipped>0) {
				strMsg+=". "+Lan.g(this,"Patients skipped due to missing information")+": "+numSkipped+patientsSkipped;
				MsgBoxCopyPaste msgCP=new MsgBoxCopyPaste(strMsg);
				msgCP.Show();
			}
			else {
				MessageBox.Show(strMsg);
			}
			this.Cursor=Cursors.Default;
		}
Exemplo n.º 2
0
		private void gridSupplementalInfo_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Hx835_Info info=(Hx835_Info)gridSupplementalInfo.Rows[e.Row].Tag;
			MsgBoxCopyPaste msgbox=new MsgBoxCopyPaste(info.FieldName+"\r\n"+info.FieldValue);
			msgbox.Show(this);
		}
Exemplo n.º 3
0
		private void gridRemarks_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			string remark=(string)gridRemarks.Rows[e.Row].Tag;
			MsgBoxCopyPaste msgbox=new MsgBoxCopyPaste(remark);
			msgbox.Show(this);
		}
Exemplo n.º 4
0
		private void gridClaimAdjustments_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Hx835_Adj adj=(Hx835_Adj)gridClaimAdjustments.Rows[e.Row].Tag;
			MsgBoxCopyPaste msgbox=new MsgBoxCopyPaste(adj.AdjCode+" "+adj.AdjustDescript+"\r\r"+adj.ReasonDescript+"\r\n"+adj.AdjAmt.ToString("f2"));
			msgbox.Show(this);
		}
Exemplo n.º 5
0
		private void gridProviderAdjustments_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Hx835_ProvAdj provAdj=(Hx835_ProvAdj)gridProviderAdjustments.Rows[e.Row].Tag;
			MsgBoxCopyPaste msgbox=new MsgBoxCopyPaste(
				provAdj.Npi+"\r\n"
				+provAdj.DateFiscalPeriod.ToShortDateString()+"\r\n"
				+provAdj.ReasonCode+" "+provAdj.ReasonCodeDescript+"\r\n"
				+provAdj.RefIdentification+"\r\n"
				+provAdj.AdjAmt.ToString("f2"));
			msgbox.Show(this);
		}