public void ImportXml(VM.HraXmlFile xmlFIle, string mrn, int apptId) { _hraSessionManager.SetActivePatient(mrn, apptId); DataContractSerializer ds = new DataContractSerializer(typeof(FamilyHistory)); string filePath = xmlFIle.FilePath; FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); FamilyHistory fhx; try { fhx = (FamilyHistory)ds.ReadObject(fs); } catch (Exception e) //catch exception where cdsBreastOvary data is older version { fs.Flush(); fs.Position = 0; XDocument doc; using (XmlReader reader = XmlReader.Create(fs)) { doc = XDocument.Load(reader); } doc.XPathSelectElement("//*[local-name() = 'cdsBreastOvary']").Remove(); var xmlDocument = new XmlDocument(); using (var xmlReader = doc.CreateReader()) { xmlDocument.Load(xmlReader); } MemoryStream ms = new MemoryStream(); xmlDocument.Save(ms); ms.Flush(); ms.Position = 0; fhx = (FamilyHistory)ds.ReadObject(ms); } foreach (Person p in fhx) { if (p is Patient) { fhx.proband = (Patient)p; } } fhx.proband.apptid = apptId; Appointment.DeleteApptData(apptId, true); if (fhx.proband.unitnum == null) //no unitnum happens when importing from de-identified XML { fhx.proband.unitnum = mrn; //just continue to use the existing unitnum for the appt we're overwriting } //The below line is commented out as the new library doesn't have any such method. // Appointment.UpdateAppointmentUnitnum(apptId, fhx.proband.unitnum); fhx.proband.PersistFullObject(new HraModelChangedEventArgs(null)); fs.Close(); }
// GET: Reports public ActionResult AuditReports(VM.AuditReports models) { return View(models); }
/// <summary> /// To Mark appointment as complete and incomplete /// </summary> /// <param name="Appt">Appointment Id</param> /// <param name="InstitutionId">Institution Id</param> private void UpdateMarkAsComplete(VM.Appointment Appt, int InstitutionId) { NameValueCollection searchfilter = new NameValueCollection(); searchfilter.Add("name", Appt.MRN); searchfilter.Add("appdt", null); searchfilter.Add("clinicId", Appt.clinicID.ToString()); List<VM.Appointment> filteredlist = GetAppointments(InstitutionId, searchfilter); //List<VM.Appointment> filteredlist = SearchOnAppointment(apptlist, Constants.MRN, Appt.MRN); foreach (var item in filteredlist) { Appointment appt = ((Appointment)(item.ToRAppointment())); //Commented below line as the new library is giving error. if (Appt.SetMarkAsComplete) { // appt.MarkComplete(); Appointment.MarkComplete(appt.apptID); } else { //appt.MarkIncomplete(); Appointment.MarkIncomplete(appt.apptID); } } }
private ProviderList SaveProvider(VM.Appointment Appt) { ProviderList pl = new ProviderList(); //SessionManager.Instance.MetaData.AllProviders.BackgroundListLoad(); //AllProviders allproviders= SessionManager.Instance.MetaData.AllProviders; //Provider providerRef = allproviders.Where(p => p.providerID == Appt.RefPhysician).FirstOrDefault(); //providerRef.refPhys = true; //providerRef.PCP = false; //providerRef.apptid = Appt.Id; //Provider providerPCP = allproviders.Where(p => p.providerID == Appt.PCP).FirstOrDefault(); //providerPCP.refPhys = false; //providerPCP.PCP = true; //providerPCP.apptid = Appt.Id; //ProviderList pl = new ProviderList(); //pl.Add(providerPCP); //pl.Add(providerRef); return pl; }
private void SavePatient(VM.Appointment Appt) { var raPatient = Appt.ToRAPatient(); // raPatient.AddStockRelatives(); raPatient.Providers.AddRange(SaveProvider(Appt)); raPatient.BackgroundPersistWork(new HraModelChangedEventArgs(null)); raPatient.Providers.PersistFullList(new HraModelChangedEventArgs(null)); }
private void SaveAppointments(VM.Appointment Appt) { var raAppt = Appt.ToRAppointment(); // raAppt.CreateAppointmentRecordsIfNeeded(); raAppt.BackgroundPersistWork(new HraModelChangedEventArgs(null)); SavePatient(Appt); }
public void ImportHL7(VM.HraXmlFile xmlFile, string mrn, int apptId) { Appointment.DeleteApptData(apptId, true); string rootPath = HttpContext.Current.Server.MapPath(Constants.RAFilePath); string riskMeanings = File.ReadAllText(Path.Combine(rootPath, "riskMeanings.xml")); string HL7Relationships = File.ReadAllText(Path.Combine(rootPath, "HL7Relationships.xml")); string hl7 = File.ReadAllText(xmlFile.FilePath); bool is_SG_XML = testSGDoc(xmlFile.FilePath); if (is_SG_XML) { //transform it XmlDocument inDOM = new XmlDocument(); inDOM.LoadXml(hl7); XmlDocument result_SG_XmlDoc = TransformUtils.performTransform(inDOM, rootPath, @"sg_to_hl7.xsl"); hl7 = result_SG_XmlDoc.InnerXml; } Patient p = Patient.processHL7Import(apptId, hl7, riskMeanings, HL7Relationships); if (string.IsNullOrEmpty(p.name)) { SessionManager.Instance.SetActivePatient(mrn, apptId); Patient patient = SessionManager.Instance.GetActivePatient(); if (string.IsNullOrEmpty(patient.name) == false) { p.name = patient.name; } } p.PersistFullObject(new HraModelChangedEventArgs(null)); }