public IList <MedicationTO> getAllMeds() { TaggedMedicationArrays allMeds = _emrSvc.getAllMeds(); IList <MedicationTO> result = new List <MedicationTO>(); if (allMeds.fault != null) { throw new ApplicationException(allMeds.fault.message); } foreach (TaggedMedicationArray tma in allMeds.arrays) { if (tma != null && tma.fault != null) { throw new ApplicationException(tma.fault.message); } if (tma == null || tma.count == 0 || tma.meds == null) { continue; } foreach (MedicationTO med in tma.meds) { result.Add(med); } } return(result); }
public TaggedMedicationArrays getPrescriptionsHL7(string pwd, string sitecode, string mpiPid) { TaggedMedicationArrays result = new TaggedMedicationArrays(); if (String.IsNullOrEmpty(pwd)) { result.fault = new FaultTO("Missing pwd"); } else if (String.IsNullOrEmpty(sitecode)) { result.fault = new FaultTO("Missing site ID"); } else if (String.IsNullOrEmpty(mpiPid)) { result.fault = new FaultTO("Missing patient ID"); } if (result.fault != null) { return(result); } try { Site hl7Site = mySession.SiteTable.getSite(sitecode); DataSource hl7Src = null; foreach (DataSource src in hl7Site.Sources) { if (String.Equals(src.Protocol, "HL7", StringComparison.CurrentCultureIgnoreCase)) { hl7Src = src; break; } } if (hl7Src == null) { throw new gov.va.medora.mdo.exceptions.MdoException("No HL7 data source in site table for that site ID"); } HL7Connection cxn = new HL7Connection(hl7Src); cxn.connect(); cxn.Pid = mpiPid; result = new TaggedMedicationArrays(new MedsApi().getAllMeds(new ConnectionSet(cxn))); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
public TaggedMedicationArrays getImoMeds() { TaggedMedicationArrays result = new TaggedMedicationArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } if (result.fault != null) { return(result); } try { IndexedHashtable t = Medication.getImoMeds(mySession.ConnectionSet); result = new TaggedMedicationArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }