示例#1
0
 /// <summary>
 /// 浙大接收接口处理 LY 2015-10-31
 /// </summary>
 /// <param name="VitalSigns"></param>
 /// <param name="revUserId"></param>
 /// <param name="TerminalName"></param>
 /// <param name="TerminalIP"></param>
 /// <param name="DeviceType"></param>
 /// <returns></returns>
 public int VitalSignFromZKY(DataConnection pclsCache, VitalSignFromDevice VitalSigns)
 {
     string UserId = new UsersMethod().GetIDByInput(pclsCache, "PhoneNo", VitalSigns.mobilephone);
     string revUserId = UserId;
     string TerminalName = "DeviceFromZKY";
     string TerminalIP = new CommonFunction().getRemoteIPAddress();
     int DeviceType = 4;
     int RecordDate = Convert.ToInt32(VitalSigns.dailyinfos.date.Replace("-",""));
     int ret = 0;
     foreach (BloodPressureInfos Line in VitalSigns.dailyinfos.bloodpressureinfos)
     {
         if (Line.high != "" && Line.low != "" && Line.time != "")
         {
             int RecordTime = Convert.ToInt32(Line.time.Substring(0, 5).Replace(":", ""));
             ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Bloodpressure", "Bloodpressure_1", Line.high, "mmHg", revUserId, TerminalName, TerminalIP, DeviceType);
             if (ret == 0)
                 return ret;
             ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Bloodpressure", "Bloodpressure_2", Line.low, "mmHg", revUserId, TerminalName, TerminalIP, DeviceType);
             if (ret == 0)
                 return ret;
         }
     }
     foreach (BloodSugarInfos Line in VitalSigns.dailyinfos.bloodsugarinfos)
     {
         if (Line.glu != "" && Line.time != "")
         {
             int RecordTime = Convert.ToInt32(Line.time.Substring(0, 5).Replace(":", ""));
             if (Line.type == 0)
                 ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "BloodSugar", "BloodSugar_10", Line.glu, "mmol/l", revUserId, TerminalName, TerminalIP, DeviceType);
             if (Line.type == 1)
                 ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "BloodSugar", "BloodSugar_11", Line.glu, "mmol/l", revUserId, TerminalName, TerminalIP, DeviceType);
             if (ret == 0)
                 return ret;
         }
     }
     foreach (ECGInfos Line in VitalSigns.dailyinfos.ecginfos)
     {
         if (Line.bpm != "" && Line.time != "")
         {
             int RecordTime = Convert.ToInt32(Line.time.Substring(0, 5).Replace(":", ""));
             ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "HeartRate", "HeartRate_1", Line.bpm, "次/分", revUserId, TerminalName, TerminalIP, DeviceType);
             if (ret == 0)
                 return ret;
         }
     }
     foreach (BreatheInfos Line in VitalSigns.dailyinfos.breatheinfos)
     if (Line.time != "")
     {
         int RecordTime = Convert.ToInt32(Line.time.Substring(0, 5).Replace(":", ""));
         ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "BreathStatus", "Oximetry", Line.oximetry.ToString(), "", revUserId, TerminalName, TerminalIP, DeviceType);
         if (ret == 0)
             return ret;
     }
     return ret;
 }
        //获取健康专员负责的所有患者(最新结束但未达标的)计划列表 GL 2015-10-13
        public List<OverDuePlanDetail> GetOverDuePlanList(DataConnection pclsCache, string DoctorId, string ModuleType)
        {
            List<OverDuePlanDetail> PlanList = new List<OverDuePlanDetail>();
            try
            {
                int nowDate = new CommonFunction().GetServerDate();

                List<PatientPlan> DT_Patients = new PlanInfoMethod().GetOverDuePlanByDoctorId(pclsCache, DoctorId, ModuleType);
                if (DT_Patients == null)
                {
                    return null;
                }
                foreach (PatientPlan item in DT_Patients)
                {
                    string patientId = item.PatientId;
                    string planNo = item.PlanNo;
                    string startDate = item.StartDate;
                    string endDate = item.EndDate;
                    string totalDays = item.TotalDays;
                    string remainingDays = item.RemainingDays;

                    double process = 0.0;
                    //VitalSign
                    List<string> vitalsigns = new List<string>();

                    if (planNo != "")
                    {
                        //double complianceRate = PsCompliance.GetComplianceByDay(pclsCache, patientId, nowDate, planNo);

                        string itemType = "Bloodpressure";
                        string itemCode = "Bloodpressure_1";
                        int recordDate = Convert.ToInt32(endDate);
                        VitalInfo list = new VitalInfoMethod().GetLatestVitalSignsByDate(pclsCache, patientId, itemType, itemCode, recordDate);
                        if (list != null)
                        {
                            vitalsigns.Add(list.Value);
                        }

                        TargetByCode targetlist = new PlanInfoMethod().GetTarget(pclsCache, planNo, itemType, itemCode);
                        if (targetlist != null)
                        {
                            vitalsigns.Add(targetlist.Value);  //value
                        }
                        //非法数据判断 zam 2015-5-18
                        //OverDue Check
                        if (list != null && targetlist != null)
                        {
                            double m, n;
                            bool misNumeric = double.TryParse(list.Value, out m);
                            bool nisNumeric = double.TryParse(targetlist.Value, out n);
                            if (misNumeric && nisNumeric)
                            {
                                //if (Convert.ToInt32(list[2]) <= Convert.ToInt32(targetlist[3])) //已达标
                                if (m <= n)
                                {
                                    continue;
                                }
                            }
                        }
                    }
                    //PhotoAddress
                    string photoAddress = "";
                    PatDetailInfo patientInfolist = new ModuleInfoMethod().PsBasicInfoDetailGetPatientDetailInfo(pclsCache, patientId);
                    if (patientInfolist != null)
                    {
                        photoAddress = patientInfolist.PhotoAddress;
                    }

                    string patientName = "";
                    patientName = new UsersMethod().GetNameByUserId(pclsCache, patientId);

                    OverDuePlanDetail PlanItem = new OverDuePlanDetail();
                    PlanItem.PatientId = patientId;
                    PlanItem.PatientName = patientName;
                    PlanItem.PhotoAddress = photoAddress;
                    PlanItem.PlanNo = planNo;
                    PlanItem.StartDate = startDate;
                    PlanItem.Process = process;
                    PlanItem.RemainingDays = remainingDays;
                    PlanItem.VitalSign = vitalsigns;

                    PlanList.Add(PlanItem);
                }
                return PlanList;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetOverDuePlanList", "PlanInfoRepository error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
                throw (ex);
            }
        }