Exemplo n.º 1
0
        //某天所有任务的依从情况 整理加工 GL 2015-10-12
        public TaskComDetailByD GetImplementationByDate(DataConnection pclsCache, string PatientId, string PlanNo, int Date)
        {
            TaskComDetailByD TaskComDetailByD = new TaskComDetailByD();
            try
            {
                TaskComDetailByD.Date = Date.ToString().Substring(0, 4) + "-" + Date.ToString().Substring(4, 2) + "-" + Date.ToString().Substring(6, 2);
                TaskComDetailByD.WeekDay = new CommonFunction().CaculateWeekDay(TaskComDetailByD.Date);

                List<TasksComList> ComplianceList = new List<TasksComList>();
                ComplianceList = GetTasksComListByDate(pclsCache, PatientId, PlanNo, Date);

                #region 后期可能用于优化
                //先读任务表,读取体征,拿出新数据;再读药物表,超过三个则省略号
                //DataTable TaskList = new DataTable();
                //TaskList = PsTask.GetTaskList(pclsCache, PlanNo);

                ////读取体征,拿出当天最新数据
                //string condition = " Type = 'VitalSign'";
                //DataRow[] VitalSignRows = TaskList.Select(condition);

                //CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                //for (int j=0; j < VitalSignRows.Length; j++)
                //{
                //    string code = VitalSignRows[j]["Type"].ToString();
                //    string[] sArray = code.Split(new char[] { '|' });;//拆分
                //    string type = sArray[0].ToString();
                //    VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                //    VitalSignList = PsVitalSigns.GetSignByDay(pclsCache, PatientId, code, type, Date);
                //    if (VitalSignList != null)
                //    {

                //    }
                //}





                //体征
                /*
                string condition = " Type = 'VitalSign'";
                DataRow[] VitalSignRows = ComplianceList.Select(condition);

                List<TaskCom> TaskComList = new List<TaskCom>();
                TaskCom TaskCom = new TaskCom();
                for (int j = 0; j < VitalSignRows.Length; j++)
                {
                    VitalTaskCom = new VitalTaskCom();
                    VitalTaskCom.SignName = VitalSignRows[j]["TaskName"].ToString();
                    VitalTaskCom.Status = VitalSignRows[j]["Status"].ToString();
                    if (TaskCom.TaskStatus == "1")
                    {
                        string code = VitalSignRows[j]["TaskCode"].ToString();
                        string[] sArray = code.Split(new char[] { '|' }); ;//拆分
                        string type = sArray[0].ToString();
                        //CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                        CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                        VitalSignList = PsVitalSigns.GetSignByDay(pclsCache, PatientId, code, type, Date);
                        if (VitalSignList != null)
                        {
                            
                            VitalTaskCom.Time = PulList[1].ToString();
                            VitalTaskCom.Value = PulList[2].ToString();
                            VitalTaskCom.Unit = PulList[3].ToString();
                            
                        } 
                    }
                    VitalTaskComList.Add(VitalTaskCom);
                }
                TaskComDetailByD.VitalTaskComList = VitalTaskComList;

                
                 string vitalCondition = " Type = 'VitalSign'";
                    DataRow[] VitalSignRows = ComplianceList.Select(vitalCondition);

                    if ((VitalSignRows != null) && (VitalSignRows.Length >= 2))
                    {



                        if (VitalSignRows.Length == 2)  //只有血压
                        {

                        }
                        else //血压和脉率
                        {

                        }
                    }
                
                */
                #endregion

                //取出当天的体征测量 若有与测试任务拼接好了
                //先写死取的生理参数
                List<VitalTaskCom> VitalTaskComList = new List<VitalTaskCom>();
                VitalTaskCom VitalTaskCom = new VitalTaskCom();

                string Module = "";
                GPlanInfo planInfo = GetPlanInfo(pclsCache, PlanNo);
                if (planInfo != null)
                {
                    Module = planInfo.Module;
                }

                if (Module == "M1")
                {
                    #region  高血压模块  需要考虑没有脉率任务的情况

                    //血压任务肯定有
                    int BPTime = 0;
                    int mark = 0;
                    string SysValue = "";
                    string DiaValue = "";
                    string Unit = "";

                    //string conditionBP1 = " TaskCode = 'Bloodpressure|Bloodpressure_1'";
                    List<TasksComList> BP1Rows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Bloodpressure|Bloodpressure_1")
                            {
                                BP1Rows.Add(item);
                            }
                        }
                    }
                    if ((BP1Rows != null) && (BP1Rows.Count == 1))
                    {
                        if (BP1Rows[0].Status == "1")
                        {
                            VitalInfo SysList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_1", Date);
                            if (SysList != null)
                            {
                                mark = 1;
                                BPTime = Convert.ToInt32(SysList.RecordTime);  //时刻数据库是"1043"形式,需要转换  取两者最新的那个时间好了 即谁大取谁
                                SysValue = SysList.Value;
                                Unit = SysList.Unit;
                            }
                        }
                    }

                    // string conditionBP2 = " TaskCode = 'Bloodpressure|Bloodpressure_2'";
                    List<TasksComList> BP2Rows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Bloodpressure|Bloodpressure_2")
                            {
                                BP2Rows.Add(item);
                            }
                        }
                    }
                    if ((BP2Rows != null) && (BP2Rows.Count == 1))
                    {
                        if (BP2Rows[0].Status == "1")
                        {
                            VitalInfo DiaList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_2", Date);
                            if (DiaList != null)
                            {
                                mark = 1;
                                int BPTime1 = Convert.ToInt32(DiaList.RecordTime);
                                if (BPTime <= BPTime1)
                                {
                                    BPTime = BPTime1;
                                }
                                DiaValue = DiaList.Value;
                            }
                        }
                    }

                    VitalTaskCom = new VitalTaskCom();
                    VitalTaskCom.SignName = "血压";
                    if (mark == 1)
                    {
                        VitalTaskCom.Status = "1";
                        VitalTaskCom.Time = new CommonFunction().TransTime(BPTime.ToString());
                        VitalTaskCom.Value = SysValue + "/" + DiaValue;
                        VitalTaskCom.Unit = Unit;
                    }
                    else
                    {
                        VitalTaskCom.Status = "0";
                    }
                    VitalTaskComList.Add(VitalTaskCom);



                    //脉率任务可能没没有,需要确认
                    //string conditionPR = " TaskCode = 'Pulserate|Pulserate_1'";
                    List<TasksComList> PulserateRows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Pulserate|Pulserate_1")
                            {
                                BP2Rows.Add(item);
                            }
                        }
                    }
                    if ((PulserateRows != null) && (PulserateRows.Count == 1))
                    {
                        VitalTaskCom = new VitalTaskCom();
                        VitalTaskCom.SignName = "脉率";

                        if (PulserateRows[0].Status == "1")
                        {
                            VitalInfo PulList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Pulserate", "Pulserate_1", Date);
                            if (PulList != null)
                            {

                                VitalTaskCom.Status = "1";
                                VitalTaskCom.Time = new CommonFunction().TransTime(PulList.RecordTime);
                                VitalTaskCom.Value = PulList.Value;
                                VitalTaskCom.Unit = PulList.Unit;
                            }
                            else
                            {
                                VitalTaskCom.Status = "0";

                            }
                        }
                        else
                        {
                            VitalTaskCom.Status = "0";

                        }
                        VitalTaskComList.Add(VitalTaskCom);
                    }
                    #endregion
                }

                TaskComDetailByD.VitalTaskComList = VitalTaskComList;

                TaskComByType TaskComByType = new TaskComByType();
                List<TaskCom> TaskComList = new List<TaskCom>();
                TaskCom TaskCom = new TaskCom();

                //生活方式 
                //string condition = " Type = 'LifeStyle'";
                List<TasksComList> LifeStyleRows = new List<TasksComList>();
                if (ComplianceList != null)
                {
                    foreach (TasksComList item in ComplianceList)
                    {
                        if (item.Type == "LifeStyle")
                        {
                            LifeStyleRows.Add(item);
                        }
                    }
                }
                if ((LifeStyleRows != null) && (LifeStyleRows.Count > 0))
                {
                    TaskComByType = new TaskComByType();
                    TaskComByType.TaskType = "生活方式";
                    TaskComList = new List<TaskCom>();
                    TaskCom = new TaskCom();

                    foreach (TasksComList item in LifeStyleRows)
                    {
                        TaskCom = new TaskCom();
                        TaskCom.TaskName = item.TaskName;
                        TaskCom.TaskStatus = item.Status;
                        TaskComList.Add(TaskCom);
                    }
                    TaskComByType.TaskComList = TaskComList;
                    TaskComDetailByD.TaskComByTypeList.Add(TaskComByType);
                }

                //用药情况
                //condition = " Type = 'Drug'";
                List<TasksComList> DrugRows = new List<TasksComList>();
                if (ComplianceList != null)
                {
                    foreach (TasksComList item in ComplianceList)
                    {
                        if (item.Type == "Drug")
                        {
                            DrugRows.Add(item);
                        }
                    }
                }
                if ((DrugRows != null) && (DrugRows.Count > 0))
                {
                    TaskComByType = new TaskComByType();
                    TaskComByType.TaskType = "用药情况";
                    TaskComList = new List<TaskCom>();
                    TaskCom = new TaskCom();
                    foreach (TasksComList item in DrugRows)
                    {
                        TaskCom = new TaskCom();
                        TaskCom.TaskName = item.TaskName;
                        TaskCom.TaskStatus = item.Status;
                        TaskComList.Add(TaskCom);
                    }
                    TaskComByType.TaskComList = TaskComList;
                    TaskComDetailByD.TaskComByTypeList.Add(TaskComByType);
                }
                return TaskComDetailByD;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsCompliance.GetImplementationByDate", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
        }
Exemplo n.º 2
0
        //通过某计划的日期,获取该天的任务完成详情 用于图上点点击时弹框内容 GL 2015-10-13
        public TaskComDetailByD GetImplementationByDate(DataConnection pclsCache, string PatientId, string PlanNo, string DateSelected)
        {
            TaskComDetailByD TaskComDetailByD = new TaskComDetailByD(); //voidDateTime
            //string str_result = "";  //最终的输出-ImplementationInfo转化成json格式
            try
            {
                //DateSelected形式"20150618" 或"15/06/18"  目前使用前者
                int Date = Convert.ToInt32(DateSelected);
                TaskComDetailByD = new PlanInfoMethod().GetImplementationByDate(pclsCache, PatientId, PlanNo, Convert.ToInt32(Date));

                //str_result = JSONHelper.ObjectToJson(TaskComDetailByD);
                //Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
                //Context.Response.Write(str_result);
                //HttpContext.Current.ApplicationInstance.CompleteRequest();
                //Context.Response.End();
                return TaskComDetailByD;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetImplementationByDate", "PlanInfoRepository error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                //return null;
                throw (ex);
            }
        }