예제 #1
0
 private EnumerableRowCollection <DataRow> retrieveVitalSign(string hn)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             List <string> checkupCode = cdc.mst_hpc_sites.Where(x => x.mhs_status == 'A' && x.mhs_other_clinic == false).Select(x => x.mhs_code).ToList();
             using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
             {
                 var result = ws.GetVitalSignByHN(hn).AsEnumerable();
                 var a      = result.Where(x => checkupCode.Contains(x.Field <string>("CTLOC_Code"))).ToList();
                 return(result);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #2
0
        public List <trn_basic_measure_dtl> getVitalSignByHN(string hn)
        {
            using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
            {
                DateTime  dateNow = Program.GetServerDateTime();
                DataTable dt      = ws.GetVitalSignByHN(hn);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        List <trn_basic_measure_dtl> bmDtl = new List <trn_basic_measure_dtl>();
                        var result = dt.AsEnumerable()
                                     .GroupBy(x => x.Field <DateTime>("OBS_Date").Add(x.Field <TimeSpan>("OBS_Time")))
                                     .OrderByDescending(x => x.Key)
                                     .Take(5);
                        foreach (var re in result)
                        {
                            trn_basic_measure_dtl dtl = new trn_basic_measure_dtl();
                            foreach (var item in re)
                            {
                                int itemNo = item.Field <int>("OBS_Item_DR");
                                switch (itemNo)
                                {
                                case 230:
                                    dtl.tbd_weight = item.Field <string>("OBS_Value");
                                    break;

                                case 231:
                                    dtl.tbd_height = item.Field <string>("OBS_Value");
                                    break;

                                case 11:
                                    dtl.tbd_temp = item.Field <string>("OBS_Value");
                                    break;

                                case 129:
                                    dtl.tbd_systolic = item.Field <string>("OBS_Value");
                                    break;

                                case 128:
                                    dtl.tbd_diastolic = item.Field <string>("OBS_Value");
                                    break;

                                case 9:
                                    dtl.tbd_pulse = item.Field <string>("OBS_Value");
                                    break;

                                case 10:
                                    dtl.tbd_rr = item.Field <string>("OBS_Value");
                                    break;

                                case 134:
                                    dtl.tbd_bmi = item.Field <string>("OBS_Value");
                                    break;

                                case 176:
                                    dtl.tbd_waist = item.Field <string>("OBS_Value");
                                    break;

                                case 173:
                                    dtl.tbd_vision_lt = item.Field <string>("OBS_Value");
                                    break;

                                case 174:
                                    dtl.tbd_vision_rt = item.Field <string>("OBS_Value");
                                    break;

                                case 281:
                                    dtl.tbd_vision_with_lens = (item.Field <string>("OBS_Value") == "Y" || item.Field <string>("OBS_Value") == "y") ? true : false;
                                    break;
                                }
                            }
                            dtl.tbd_date        = re.Key;
                            dtl.tbd_create_by   = Program.CurrentUser.mut_username;
                            dtl.tbd_create_date = dateNow;
                            dtl.tbd_update_by   = Program.CurrentUser.mut_username;
                            dtl.tbd_update_date = dateNow;
                            bmDtl.Add(dtl);
                        }
                        return(bmDtl);
                    }
                }
            }
            return(null);
        }
예제 #3
0
        public List <VitalSignResult> ByGetVitalSignByHN(string hn)
        {
            try
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    var RawMateWS    = ws.GetVitalSignByHN(hn).AsEnumerable();
                    var RawMateGroup = RawMateWS.GroupBy(x => new
                    {
                        en      = x.Field <string>("PAADM_ADMNo"),
                        enrowid = x.Field <int>("PAADM_RowID"),
                        rowid   = x.Field <int>("OBS_ParRef"),
                        vsDate  = x.Field <DateTime?>("OBS_Date") == null
                                                    ? null
                                                    : x.Field <TimeSpan?>("OBS_Time") == null
                                                    ? x.Field <DateTime?>("OBS_Date")
                                                    : x.Field <DateTime?>("OBS_Date").Value.Date.Add(x.Field <TimeSpan?>("OBS_Time").Value.Duration()),
                        location = x.Field <string>("CTLOC_Code")
                    }).ToList();
                    List <VitalSignResult> results = new List <VitalSignResult>();
                    foreach (var grp in RawMateGroup)
                    {
                        VitalSignResult rs = new VitalSignResult
                        {
                            en       = grp.Key.en,
                            enrowid  = grp.Key.enrowid,
                            rowid    = grp.Key.rowid,
                            location = grp.Key.location,
                            vsDate   = grp.Key.vsDate
                        };
                        foreach (var vs in grp)
                        {
                            switch (vs.Field <int>("OBS_Item_DR"))
                            {
                            case 230:
                                rs.weight = vs.Field <string>("OBS_Value");
                                break;

                            case 231:
                                rs.height = vs.Field <string>("OBS_Value");
                                break;

                            case 11:
                                rs.temperature = vs.Field <string>("OBS_Value");
                                break;

                            case 129:
                                rs.systolic = vs.Field <string>("OBS_Value");
                                break;

                            case 128:
                                rs.diastolic = vs.Field <string>("OBS_Value");
                                break;

                            case 9:
                                rs.pulse = vs.Field <string>("OBS_Value");
                                break;

                            case 10:
                                rs.respirationrate = vs.Field <string>("OBS_Value");
                                break;

                            case 134:
                                rs.bmi = vs.Field <string>("OBS_Value");
                                break;

                            case 176:
                                rs.Waist = vs.Field <string>("OBS_Value");
                                break;

                            case 173:
                                rs.visionLeft = vs.Field <string>("OBS_Value");
                                break;

                            case 174:
                                rs.visionRight = vs.Field <string>("OBS_Value");
                                break;

                            case 281:
                                rs.withlen = vs.Field <string>("OBS_Value") == null ? false : vs.Field <string>("OBS_Value").ToUpper() == "Y";
                                break;

                            case 179:
                                rs.colorblind = vs.Field <string>("OBS_Value");
                                break;
                            }
                        }
                        results.Add(rs);
                    }
                    return(results);
                }
            }
            catch (Exception ex)
            {
                Class.globalCls.MessageError("GetVitalSignCls", "ByGetVitalSignByHN", ex.Message);
                throw ex;
            }
        }
예제 #4
0
        public List <VitalSignResult> GetVitalSign(string hn)
        {
            List <VitalSignResult> results = new List <VitalSignResult>();

            try
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    var grpVS = ws.GetVitalSignByHN(hn).AsEnumerable()
                                .GroupBy(x => new { PAADM_ADMNo = x.Field <string>("PAADM_ADMNo"), OBS_ParRef = x.Field <int>("OBS_ParRef"), OBS_Date = x.Field <DateTime?>("OBS_Date"), OBS_Time = x.Field <TimeSpan?>("OBS_Time"), CTLOC_Code = x.Field <string>("CTLOC_Code") })
                                .ToList();

                    foreach (var vs in grpVS)
                    {
                        VitalSignResult rs = new VitalSignResult
                        {
                            en            = vs.Key.PAADM_ADMNo,
                            rowid         = vs.Key.OBS_ParRef,
                            Location      = vs.Key.CTLOC_Code,
                            VitalSignDate = vs.Key.OBS_Date == null ? (DateTime?)null : vs.Key.OBS_Time == null ? vs.Key.OBS_Date.Value : vs.Key.OBS_Date.Value.Add(vs.Key.OBS_Time.Value)
                        };
                        foreach (var row in vs)
                        {
                            switch (row.Field <int>("OBS_Item_DR"))
                            {
                            case 230:
                                rs.Weight = row.Field <string>("OBS_Value");
                                break;

                            case 231:
                                rs.Height = row.Field <string>("OBS_Value");
                                break;

                            case 11:
                                rs.Temperature = row.Field <string>("OBS_Value");
                                break;

                            case 129:
                                rs.Systolic = row.Field <string>("OBS_Value");
                                break;

                            case 128:
                                rs.Diastolic = row.Field <string>("OBS_Value");
                                break;

                            case 9:
                                rs.Pulse = row.Field <string>("OBS_Value");
                                break;

                            case 10:
                                rs.RespirationRate = row.Field <string>("OBS_Value");
                                break;

                            case 134:
                                rs.BMI = row.Field <string>("OBS_Value");
                                break;

                            case 176:
                                rs.Waist = row.Field <string>("OBS_Value");
                                break;

                            case 173:
                                rs.VisionLeft = row.Field <string>("OBS_Value");
                                break;

                            case 174:
                                rs.VisionRight = row.Field <string>("OBS_Value");
                                break;

                            case 281:
                                rs.WithLen = row.Field <string>("OBS_Value") == null ? false : row.Field <string>("OBS_Value").ToUpper() == "Y";
                                break;

                            case 179:
                                rs.ColorBlind = row.Field <string>("OBS_Value");
                                break;
                            }
                        }
                        results.Add(rs);
                    }
                }
            }
            catch (Exception ex)
            {
                globalCls.MessageError("WS", "GetVitalSign(string hn, int maxtime)", ex.Message);
            }
            return(results.OrderByDescending(x => x.VitalSignDate).ToList());
        }