Exemplo n.º 1
0
 public InpatientStayTO(InpatientStay mdo)
 {
     if (mdo.Patient != null)
     {
         this.patient = new PatientTO(mdo.Patient);
     }
     if (mdo.Location != null)
     {
         this.location = new HospitalLocationTO(mdo.Location);
     }
     this.admitTimestamp     = mdo.AdmitTimestamp;
     this.dischargeTimestamp = mdo.DischargeTimestamp;
     if (mdo.DischargeDiagnoses != null)
     {
         this.dischargeDiagnoses = new DischargeDiagnosesTO(mdo.DischargeDiagnoses);
     }
     this.type = mdo.Type;
     if (mdo.Adts != null && mdo.Adts.Length > 0)
     {
         this.adts = new AdtTO[mdo.Adts.Length];
         for (int i = 0; i < mdo.Adts.Length; i++)
         {
             this.adts[i] = new AdtTO(mdo.Adts[i]);
         }
     }
     this.movementCheckinId = mdo.MovementCheckinId;
 }
 public TaggedInpatientStayArray(string tag, InpatientStay mdo)
 {
     this.tag = tag;
     if (mdo == null)
     {
         this.count = 0;
         return;
     }
     this.stays    = new InpatientStayTO[1];
     this.stays[0] = new InpatientStayTO(mdo);
     this.count    = 1;
 }
Exemplo n.º 3
0
        public InpatientStayTO getStayMovements(string sitecode, string checkinId)
        {
            InpatientStayTO result = new InpatientStayTO();
            string          msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (checkinId == "")
            {
                result.fault = new FaultTO("Missing checkinId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn  = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api  = new EncounterApi();
                InpatientStay      stay = api.getStayMovements(cxn, checkinId);
                result = new InpatientStayTO(stay);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Exemplo n.º 4
0
 public InpatientStay[] getStayMovementsByDateRange(string fromTS, string toTS)
 {
     IndexedHashtable checkinIds = getUniqueInpatientMovementIds(fromTS, toTS);
     if (checkinIds == null || checkinIds.Count == 0)
     {
         return new InpatientStay[] { };
     }
     ArrayList lst = new ArrayList(checkinIds.Count);
     VistaPatientDao patientDao = new VistaPatientDao(cxn);
     for (int i = 0; i < checkinIds.Count; i++)
     {
         Adt[] adts = getInpatientMovesByCheckinId((string)checkinIds.GetKey(i));
         Patient p = patientDao.select(adts[0].Patient.LocalPid);
         InpatientStay s = new InpatientStay();
         s.Adts = adts;
         s.Patient = p;
         s.MovementCheckinId = (string)checkinIds.GetKey(i);
         lst.Add(s);
     }
     return (InpatientStay[])lst.ToArray(typeof(InpatientStay));
 }
Exemplo n.º 5
0
 public InpatientStay getStayMovements(string checkinId)
 {
     DdrLister query = buildGetInpatientMovesByCheckinIdQuery(checkinId);
     string[] response = query.execute();
     if (response == null || response.Length == 0)
     {
         return null;
     }
     Adt[] adts = toAdt(response);
     VistaPatientDao patientDao = new VistaPatientDao(cxn);
     Patient p = patientDao.select(adts[0].Patient.LocalPid);
     InpatientStay result = new InpatientStay();
     result.MovementCheckinId = checkinId;
     result.Adts = adts;
     result.Patient = p;
     return result;
 }
Exemplo n.º 6
0
 internal InpatientStay[] toInpatientStays(string response, string dfn)
 {
     if (response == "")
     {
         return null;
     }
     string[] rex = StringUtils.split(response, StringUtils.CRLF);
     rex = StringUtils.trimArray(rex);
     InpatientStay[] stays = new InpatientStay[rex.Length];
     for (int i = 0; i < rex.Length; i++)
     {
         String[] flds = StringUtils.split(rex[i], StringUtils.CARET);
         stays[i] = new InpatientStay();
         stays[i].Patient = new Patient();
         stays[i].Patient.LocalPid = dfn;
         stays[i].AdmitTimestamp = VistaTimestamp.toUtcString(flds[0]);
         stays[i].Location = new HospitalLocation(flds[1], flds[2]);
         stays[i].Type = flds[3];
     }
     return stays;
 }
Exemplo n.º 7
0
 internal InpatientStay[] toInpatientStays(string response)
 {
     if (response == "")
     {
         throw new Exception("Bad return getting patient by ward");
     }
     if (response.StartsWith("^No patients found."))
     {
         return null;
     }
     string[] rex = StringUtils.split(response, StringUtils.CRLF);
     InpatientStay[] stays = new InpatientStay[rex.Length];
     for (int i = 0; i < rex.Length; i++)
     {
         if (rex[i] == "")
         {
             continue;
         }
         string[] flds = StringUtils.split(rex[i], StringUtils.CARET);
         stays[i] = new InpatientStay();
         stays[i].Patient = new Patient();
         stays[i].Patient.LocalPid = flds[0];
         stays[i].Patient.Name = new PersonName(flds[1]);
         if (flds.Length == 3)
         {
             stays[i].Location = new HospitalLocation();
             if (flds[2].IndexOf('-') == -1)
             {
                 stays[i].Location.Room = flds[2];
             }
             else
             {
                 string[] parts = StringUtils.split(flds[2], "-");
                 stays[i].Location.Room = parts[0];
                 stays[i].Location.Bed = parts[1];
             }
         }
     }
     return stays;
 }
Exemplo n.º 8
0
        public InpatientStay[] getStayMovementsByPatient(string dfn)
        {
            VistaPatientDao pDao = new VistaPatientDao(cxn);

            // first get all ADT's for pid
            Adt[] adts = getInpatientMoves(dfn);
            if (adts.Length == 0)
            {
                return new InpatientStay[] { };
            }

            List<string> checkinIds = new List<string>();
            // build list of unique checkinId's
            foreach (Adt adt in adts)
            {
                if (!checkinIds.Contains(adt.CheckInId))
                {
                    checkinIds.Add(adt.CheckInId);
                }
            }

            VistaPatientDao patientDao = new VistaPatientDao(cxn);
            ArrayList lst = new ArrayList();
            for (int i = 0; i < checkinIds.Count; i++)
            {
                Adt[] adtAry = getInpatientMovesByCheckinId((string)checkinIds[i]);
                Patient p = patientDao.select(adtAry[0].Patient.LocalPid);
                InpatientStay s = new InpatientStay();
                s.Adts = adtAry;
                s.Patient = p;
                s.MovementCheckinId = (string)checkinIds[i];
                lst.Add(s);
            }
            return (InpatientStay[])lst.ToArray(typeof(InpatientStay));
        }