public List<GPlanInfo> GetPlanListByMS(DataConnection pclsCache, string PatientId, string Module, int Status)
        {
            List<GPlanInfo> list = new List<GPlanInfo>();
            CacheCommand cmd = null;
            CacheDataReader cdr = null;
            try
            {
                if (!pclsCache.Connect())
                {
                    return null;
                }
                cmd = new CacheCommand();
                cmd = Ps.Plan.GetPlanListByMS(pclsCache.CacheConnectionObject);
                cmd.Parameters.Add("PatientId", CacheDbType.NVarChar).Value = PatientId;
                cmd.Parameters.Add("Module", CacheDbType.NVarChar).Value = Module;
                cmd.Parameters.Add("Status", CacheDbType.Int).Value = Status;

                cdr = cmd.ExecuteReader();
                while (cdr.Read())
                {
                    GPlanInfo NewLine = new GPlanInfo();
                    NewLine.PlanNo = cdr["PlanNo"].ToString();
                    NewLine.PlanName = cdr["PlanName"].ToString();
                    NewLine.PatientId = cdr["PatientId"].ToString();
                    NewLine.StartDate = cdr["StartDate"].ToString(); 
                    NewLine.EndDate = cdr["EndDate"].ToString();
                    NewLine.Module = cdr["Module"].ToString();
                    NewLine.Status = cdr["Status"].ToString();
                    NewLine.PlanCompliance = cdr["PlanCompliance"].ToString();
                    NewLine.RemainingDays = cdr["RemainingDays"].ToString();
                    NewLine.ProgressRate = cdr["ProgressRate"].ToString();
                    NewLine.DoctorId = cdr["DoctorId"].ToString();
                    NewLine.DoctorName = cdr["DoctorName"].ToString();
                  
                    list.Add(NewLine);
                }
                return list;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PlanInfoMethod.GetPlanListByMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {
                if ((cdr != null))
                {
                    cdr.Close();
                    cdr.Dispose(true);
                    cdr = null;
                }
                if ((cmd != null))
                {
                    cmd.Parameters.Clear();
                    cmd.Dispose();
                    cmd = null;
                }
                pclsCache.DisConnect();
            }
        }
 /// <summary>
 /// 获取正在执行的计划 SYF 2015-10-10
 /// </summary>
 /// <param name="pclsCache"></param>
 /// <param name="PatientId"></param>
 /// <returns></returns>
 public GPlanInfo GetExecutingPlan(DataConnection pclsCache, string PatientId)
 {
     try
     {
         GPlanInfo ret = new GPlanInfo();
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Ps.Plan.GetExecutingPlan(pclsCache.CacheConnectionObject, PatientId);
         if (list != null)
         {
             ret.PlanNo = list[0];
             ret.PatientId = list[1];
             ret.StartDate = list[2];
             ret.EndDate = list[3];
             ret.Module = list[4];
             ret.Status = list[5];
             ret.DoctorId = list[6];
         }
         return ret;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PlanInfoMethod.GetExecutingPlan", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
Exemple #3
0
 public int GetOnPlanPatientNumByDoctorId(DataConnection pclsCache, string DoctorId)
 {
     int ret = 0;
     string[] Category = { "M1", "M2", "M3", "HM1", "HM2", "HM3" };
     for (int i = 0; i < Category.Length; i++)
     {
         List<PatientNum> items = new List<PatientNum>();
         items = GetPatientsByDoctorId(pclsCache, DoctorId, Category[i]);
         if (items != null)
         {
             for(int MouN=1; i<items.Count; i++)
             {
                 string PatId = items[i].PatientId;
                 GPlanInfo GPlanInfo = new GPlanInfo();
                 //string DocId = "";
                 GPlanInfo  = new PlanInfoMethod().GetExecutingPlan(pclsCache, PatId);
                 if((GPlanInfo != null) &&(DoctorId == GPlanInfo.DoctorId))
                 {
                     ret++;
                 }
                 
             }
         }
     }
     return ret;
 }
 public HttpResponseMessage PostPlanStart(GPlanInfo item)
 {
     int ret = repository.SetPlanStart(pclsCache, item.PlanNo, Convert.ToInt32(item.Status), item.piUserId, item.piTerminalName, new CommonFunction().getRemoteIPAddress(), item.piDeviceType);
     return new ExceptionHandler().SetData(Request, ret);
 }
        //GetPlanList34ByM 获取某模块患者的正在执行的和结束的计划列表 GL 2015-10-12
        public List<GPlanInfo> GetPlanList34ByM(DataConnection pclsCache, string PatientId, string Module)
        {
            List<GPlanInfo> result = new List<GPlanInfo>();
            try
            {
                GPlanInfo list = GetExecutingPlanByM(pclsCache, PatientId, Module);
                if (list != null)
                {
                    //GPlanInfo PlanDeatil = new GPlanInfo();
                    //PlanDeatil.PlanNo = list.PlanNo;
                    //PlanDeatil.StartDate = Convert.ToInt32(list.StartDate);
                    //PlanDeatil.EndDate = Convert.ToInt32(list.EndDate);
                    string temp = list.StartDate.ToString().Substring(0, 4) + "/" + list.StartDate.ToString().Substring(4, 2) + "/" + list.StartDate.ToString().Substring(6, 2);
                    string temp1 = list.EndDate.ToString().Substring(0, 4) + "/" + list.EndDate.ToString().Substring(4, 2) + "/" + list.EndDate.ToString().Substring(6, 2);
                    list.PlanName = "当前计划:" + temp + "-" + temp1;
                    list.PlanCompliance = GetComplianceByPlanNo(pclsCache, list.PlanNo).ToString();
                    Progressrate temp2 = new PlanInfoMethod().GetProgressRate(pclsCache, list.PlanNo);
                    list.RemainingDays = "";
                    if(temp2 != null)
                    {
                        list.RemainingDays = temp2.RemainingDays;
                    }
                }
                else
                {
                    //PlanDeatil PlanDeatil = new PlanDeatil();
                    //PlanDeatil.PlanNo = "";
                    list.PlanName = "当前计划";
                }
                result.Add(list);

                List<PlanDeatil> endingPlanList = new List<PlanDeatil>();
                endingPlanList = GetEndingPlan(pclsCache, PatientId, Module);
                if (endingPlanList!= null)
                {
                    foreach (PlanDeatil item in endingPlanList)
                    {
                        GPlanInfo PlanDeatil = new GPlanInfo();
                        PlanDeatil.PlanNo = item.PlanNo;
                        PlanDeatil.StartDate = item.StartDate.ToString();
                        PlanDeatil.EndDate = item.EndDate.ToString();
                        string temp = PlanDeatil.StartDate.ToString().Substring(0, 4) + "/" + PlanDeatil.StartDate.ToString().Substring(4, 2) + "/" + PlanDeatil.StartDate.ToString().Substring(6, 2);
                        string temp1 = PlanDeatil.EndDate.ToString().Substring(0, 4) + "/" + PlanDeatil.EndDate.ToString().Substring(4, 2) + "/" + PlanDeatil.EndDate.ToString().Substring(6, 2);
                        PlanDeatil.PlanName = "往期:" + temp + "-" + temp1;
                        PlanDeatil.PlanCompliance = GetComplianceByPlanNo(pclsCache, list.PlanNo).ToString();
                        PlanDeatil.RemainingDays = "";
                        Progressrate temp2 = new PlanInfoMethod().GetProgressRate(pclsCache, list.PlanNo);
                        if (temp2 != null)
                        {
                            PlanDeatil.RemainingDays = temp2.RemainingDays;
                        }
                        result.Add(PlanDeatil);
                    }
                }
                return result;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PlanInfoMethod.GetPlanList34ByM", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
        /// <summary>
        /// 解除专员 syf 20151026
        /// </summary>
        /// <param name="pclsCache"></param>
        /// <param name="PatientId"></param>
        /// <param name="DoctorId"></param>
        /// <param name="Category"></param>
        /// <returns></returns>
        public int RemoveHealthCoach(DataConnection pclsCache, string PatientId, string DoctorId, string CategoryCode)
        {
            int ret = 0;
            int Status = -1;
            GPlanInfo ret1 = new GPlanInfo();
            try
            {
                if (!pclsCache.Connect())
                {
                    return ret;
                }
                InterSystems.Data.CacheTypes.CacheSysList list = null;
                list = Ps.Plan.GetExecutingPlan(pclsCache.CacheConnectionObject, PatientId);
                if (list != null)//病人有正在执行的计划,但是没有对应该医生的正在执行的计划
                {
                    if ((ret1.Status != "3") && (ret1.DoctorId == DoctorId))//该病人对于当前医生来说,无正在执行的计划
                    {
                        Status = (int)Ps.Appointment.GetStatusById(pclsCache.CacheConnectionObject, DoctorId, PatientId);//当Ps.Appointment预约表的Status为0时才删除
                        if (Status == 0)
                        {
                            ret = (int)Ps.Appointment.Delete(pclsCache.CacheConnectionObject, DoctorId, PatientId);
                            ret = (int)Ps.BasicInfoDetail.DeleteDataByItemCode(pclsCache.CacheConnectionObject, PatientId, CategoryCode, "Doctor", DoctorId);
                            ret = (int)Ps.DoctorInfoDetail.DeleteDataByItemCode(pclsCache.CacheConnectionObject, DoctorId, CategoryCode, "Patient", PatientId);
                        }
                    }
                }
                else
                {
                    //该病人无正在执行的计划
                    Status = (int)Ps.Appointment.GetStatusById(pclsCache.CacheConnectionObject, DoctorId, PatientId);//当Ps.Appointment预约表的Status为0时才删除
                    if (Status == 0)
                    {
                        ret = (int)Ps.Appointment.Delete(pclsCache.CacheConnectionObject, DoctorId, PatientId);
                        string Doctor_Id = " " + DoctorId.ToUpper();//数据库的数据Value这一项加了个空格,而且小写变大写
                        string Patient_Id = " " + PatientId.ToUpper();
                        ret = (int)Ps.BasicInfoDetail.DeleteDataByItemCode(pclsCache.CacheConnectionObject, PatientId, CategoryCode, "Doctor", Doctor_Id);
                        ret = (int)Ps.DoctorInfoDetail.DeleteDataByItemCode(pclsCache.CacheConnectionObject, DoctorId, CategoryCode, "Patient", Patient_Id);
                    }
                }

                return ret;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UserMethod.RemoveHealthCoach", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return ret;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }