private void loadFromXMLToolStripMenuItem_Click(object sender, EventArgs e) { string fileName = ""; //importOpenFileDialog.InitialDirectory = "c:\\"; importOpenFileDialog.Filter = "Patient Data XML Import File (*.xml)|*.xml"; importOpenFileDialog.FilterIndex = 2; importOpenFileDialog.RestoreDirectory = true; if (importOpenFileDialog.ShowDialog() == DialogResult.OK) { try { fileName = importOpenFileDialog.FileName; if (fileName.Length != 0) { //importXmlApptID = xmlImport(fileName); ImportExportArgs args = new ImportExportArgs(); args.is_SG_XML = testSGDoc(fileName); args.mode = (args.is_SG_XML) ? ImportExportMode.ImportHL7 : ImportExportMode.ImportXML; args.fileName = fileName; args.patient = (args.is_SG_XML) ? SessionManager.Instance.GetActivePatient() : null; args.apptID = SessionManager.Instance.GetActivePatient().apptid; args.existingUnitnum = SessionManager.Instance.GetActivePatient().unitnum; disableButtons(); importExportBackgroundWorker.RunWorkerAsync(args); } } catch (Exception eeee) { // get call stack StackTrace stackTrace = new StackTrace(); // get calling method name String callingRoutine = stackTrace.GetFrame(1).GetMethod().Name; Logger.Instance.WriteToLog("[MyPatientsView] from [" + callingRoutine + "]\n\t" + eeee); return; } } }
private void addToDoNotCallListToolStripMenuItem_Click(object sender, EventArgs e) { string assignedBy = ""; if (SessionManager.Instance.ActiveUser != null) { if (string.IsNullOrEmpty(SessionManager.Instance.ActiveUser.ToString()) == false) { assignedBy = SessionManager.Instance.ActiveUser.ToString(); } } Patient p = SessionManager.Instance.GetActivePatient(); // TODO: Check this!! Task t = new Task(p, "Task", null, assignedBy, DateTime.Now); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; p.Tasks.AddToList(t, args); PtFollowup newFollowup = new PtFollowup(t); newFollowup.Disposition = "Omit From List"; newFollowup.TypeOfFollowup = "Phone Call"; newFollowup.Comment = "Do Not Call"; newFollowup.Who = assignedBy; newFollowup.Date = DateTime.Now; args = new HraModelChangedEventArgs(null); args.Persist = true; t.FollowUps.AddToList(newFollowup, args); }
private void importExportBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { args = (ImportExportArgs)e.Argument; try { if (args.mode == ImportExportMode.ExportHL7) { //PRB 2014.08.20 New and Improved way: //Serialize the FH args.patient.LoadFullObject(); //needed to ensure patient object is complete, including ObGynHx, etc. FamilyHistory theFH = args.patient.owningFHx; string fhAsString = TransformUtils.DataContractSerializeObject<FamilyHistory>(theFH); //transform it XmlDocument inDOM = new XmlDocument(); inDOM.LoadXml(fhAsString); string toolsPath = Configurator.getNodeValue("Globals", "ToolsPath"); // @"C:\Program Files\riskappsv2\tools\"; XmlDocument resultXmlDoc = TransformUtils.performTransform(inDOM, toolsPath, @"hra_to_ccd_remove_namespaces.xsl"); XmlDocument hl7FHData = TransformUtils.performTransformWithParam(resultXmlDoc, toolsPath, @"hra_serialized_to_hl7.xsl", "deIdentify", (args.deIdentify) ? "1" : "0"); //following actually removes all indentation and extra whitespace; prefer to save the file with indentations, so leave this commented //hl7FHData.PreserveWhitespace = true; hl7FHData.Save(args.fileName); } else if (args.mode == ImportExportMode.ImportHL7) { if (File.Exists(args.fileName)) { Appointment.DeleteApptData(args.apptID, true); //string local_dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); string local_dir = Configurator.getNodeValue("Globals", "ToolsPath"); string riskMeanings = File.ReadAllText(Path.Combine(local_dir, "riskMeanings.xml")); string HL7Relationships = File.ReadAllText(Path.Combine(local_dir, "HL7Relationships.xml")); string hl7 = File.ReadAllText(args.fileName); //if this is a Surgeon General XML file, transform it to HL7 first if (args.is_SG_XML) { //transform it XmlDocument inDOM = new XmlDocument(); inDOM.LoadXml(hl7); string toolsPath = Configurator.getNodeValue("Globals", "ToolsPath"); // @"C:\Program Files\riskappsv2\tools\"; XmlDocument result_SG_XmlDoc = TransformUtils.performTransform(inDOM, toolsPath, @"sg_to_hl7.xsl"); hl7 = result_SG_XmlDoc.InnerXml; } Patient p = Patient.processHL7Import(args.apptID, hl7, riskMeanings, HL7Relationships); if (string.IsNullOrEmpty(p.name)) { if (string.IsNullOrEmpty(args.patient.name)==false) { p.name = args.patient.name; } } p.PersistFullObject(new HraModelChangedEventArgs(null)); } } else if (args.mode == ImportExportMode.ExportXML) { xmlExport(args.fileName, args.patient, args.deIdentify); } else if (args.mode == ImportExportMode.ImportXML) { args.apptID = xmlImport(args.fileName, args.apptID, args.existingUnitnum); //pass in the unitnum for the existing apptID } else { // get call stack StackTrace stackTrace = new StackTrace(); // get calling method name String callingRoutine = stackTrace.GetFrame(1).GetMethod().Name; Logger.Instance.WriteToLog("[MyPatientsView] from [" + callingRoutine + "]\n\tUnknown mode: [" + args.mode.ToString() + "]"); } } catch (Exception ex) { Logger.Instance.WriteToLog(ex.ToString()); //// get call stack //StackTrace stackTrace = new StackTrace(); //// get calling method name //String callingRoutine = stackTrace.GetFrame(1).GetMethod().Name; //Utilities.Logger.Instance.WriteToLog("[MyPatientsView] from [" + callingRoutine + "]\n\tmode=" + // args.mode.ToString() + "\n\tfileName=" + args.fileName + "\n\tunitnum=" + // args.patient == null ? "" : args.patient.unitnum); } importExportBackgroundWorker.ReportProgress(100); }
private void saveAsXMLToolStripMenuItem_Click(object sender, EventArgs e, bool deIdentify) { Appointment appt = ((Appointment)(fastDataListView1.SelectedObject)); int apptid = appt.apptID; if (appt.GoldenAppt != appt.apptID) { if (appt.apptdatetime <= appt.GoldenApptTime) { //MessageBox.Show("You have selected an older appointment. The most recent record for this patient is from " + appt.GoldenApptTime,"); LegacyApptForm laf = new LegacyApptForm(); laf.selected = appt.apptdatetime; laf.golden = appt.GoldenApptTime; laf.ShowDialog(); if (laf.result == "Continue") { SessionManager.Instance.ClearActivePatient(); SessionManager.Instance.SetActivePatient(appt.Unitnum, apptid); } else { SessionManager.Instance.ClearActivePatient(); SessionManager.Instance.SetActivePatient(appt.Unitnum, appt.GoldenAppt); } } else { SessionManager.Instance.ClearActivePatient(); SessionManager.Instance.SetActivePatient(appt.Unitnum, apptid); } } Patient patient = SessionManager.Instance.GetActivePatient(); string fileName = ""; string initDir = Configurator.GetDocumentStorage(); if (string.IsNullOrEmpty(initDir)) exportSaveFileDialog.InitialDirectory = Configurator.getNodeValue("Globals", "DocumentStorage"); //"c:\\Program Files\\riskappsv2\\documents"; else exportSaveFileDialog.InitialDirectory = initDir; exportSaveFileDialog.Filter = "Patient Serialization File (*.xml)|*.xml"; exportSaveFileDialog.FilterIndex = 2; exportSaveFileDialog.RestoreDirectory = true; exportSaveFileDialog.OverwritePrompt = true; exportSaveFileDialog.FileName = SessionManager.Instance.GetActivePatient().name + " " + SessionManager.Instance.GetActivePatient().unitnum + " Serialization " + DateTime.Now.ToString("yyyy-MM-dd-HHmm"); if (exportSaveFileDialog.ShowDialog() == DialogResult.OK) { try { fileName = exportSaveFileDialog.FileName; if (fileName.Length != 0) { //xmlExport(fileName, patient); ImportExportArgs args = new ImportExportArgs(); args.mode = ImportExportMode.ExportXML; args.fileName = fileName; args.patient = patient; args.apptID = SessionManager.Instance.GetActivePatient().apptid; args.deIdentify = deIdentify; disableButtons(); importExportBackgroundWorker.RunWorkerAsync(args); } } catch (Exception eee) { // get call stack StackTrace stackTrace = new StackTrace(); // get calling method name String callingRoutine = stackTrace.GetFrame(1).GetMethod().Name; Logger.Instance.WriteToLog("[MyPatientsView] from [" + callingRoutine + "]\n\t" + eee); return; } } }