public M1RiskInput GetM1RiskInput(DataConnection pclsCache, string UserId) { M1RiskInput Input = new M1RiskInput(); Input = new UsersMethod().GetM1RiskInput(pclsCache, UserId); if(Input != null) { BasicInfo BaseList = new UsersMethod().GetBasicInfo(pclsCache, UserId); if (BaseList != null) { if (BaseList.Birthday != "" && BaseList.Birthday != "0" && BaseList.Birthday != null) { Input.Age = new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(BaseList.Birthday));//年龄 } if (BaseList.Gender != "" && BaseList.Gender != "0" && BaseList.Gender != null) { Input.Gender = Convert.ToInt32(BaseList.Gender);//性别 } } } return Input; }
public int SetM1RiskInput(DataConnection pclsCache, string PatientId, M1RiskInput M1RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType) { int ret = 0; int fret = 1; try { #region//插入PsVitalSigns表 ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M1RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M1RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0018", M1RiskInput.AbdominalGirth.ToString(), "mm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0007", M1RiskInput.Heartrate.ToString(), "次/分", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0013", M1RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0012", M1RiskInput.DBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion #region//插入PsBasicInfoDetail表 ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QC0001", 1, M1RiskInput.Parent.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QF0011", 1, M1RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0007", 1, M1RiskInput.Stroke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QJ0024", 1, M1RiskInput.Lvh.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QB0045", 1, M1RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QD0002", 1, M1RiskInput.Treat.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0004", 1, M1RiskInput.Heartattack.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0005", 1, M1RiskInput.Af.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0002", 1, M1RiskInput.Chd.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0006", 1, M1RiskInput.Valve.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0002", 1, M1RiskInput.Tcho.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0001", 1, M1RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0003", 1, M1RiskInput.Hdlc.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion return(fret); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM1RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(0); } finally { pclsCache.DisConnect(); } }
/// <summary> /// 输入患者Id和专员Id,取出对应模块编码和名称 SYF 20151119 /// </summary> /// <param name="pclsCache"></param> /// <param name="PatientId"></param> /// <param name="DoctorId"></param> /// <returns></returns> public List<ModulesByPID> GetHModulesByID(DataConnection pclsCache, string PatientId, string DoctorId) { List<ModulesByPID> list = new List<ModulesByPID>(); // List<ModulesByPID> ret = new List<ModulesByPID>(); list = new UsersMethod().GetHModulesByPID(pclsCache, PatientId); if (list != null) { int i = list.Count; //int j = list.Count; for (; i > 0; i--) { if (list[i - 1].DoctorId != DoctorId) { list.Remove(list[i - 1]); } } } return list; }
public List<AppoitmentPatient> GetAppoitmentPatientList(DataConnection pclsCache, string healthCoachID, string Status) { List<AppoitmentPatient> list = new List<AppoitmentPatient>(); List<PatientsByStatus> list1 = new List<PatientsByStatus>(); if (Status == "{Status}") { Status = "-1"; } list1 = GetPatientsByStatus(pclsCache, healthCoachID, Status); if (list1 != null) { for (int i = 0; i < list1.Count; i++) { AppoitmentPatient app = new AppoitmentPatient(); app.PatientID = list1[i].PatientId; app.module = list1[i].Module; app.AppointmentStatus = list1[i].Status; app.Description = list1[i].Description; //app.ApplicationTime = list1[i].ApplicationTime; string[] DateAndTime = list1[i].ApplicationTime.Split(' ');//日期和时间分开 string Date = DateAndTime[0]; string[] YMD = Date.Split('/');//年月日分开 string month = YMD[1]; string day = YMD[2]; if (month.Length < 2) { month = "0" + month; } if (day.Length < 2) { day = "0" + day; } app.ApplicationTime = YMD[0] + "-" + month + "-" + day + " " + DateAndTime[1]; string[] DateAndTime1 = list1[i].AppointmentTime.Split(' ');//日期和时间分开 string Date1 = DateAndTime1[0]; string[] YMD1 = Date1.Split('/');//年月日分开 string month1 = YMD1[1]; string day1 = YMD1[2]; if (month1.Length < 2) { month1 = "0" + month1; } if (day1.Length < 2) { day1 = "0" + day1; } app.AppointmentTime = YMD1[0] + "-" + month1 + "-" + day1 + " " + DateAndTime1[1]; app.AppointmentAdd = list1[i].AppointmentAdd; if (app.PatientID != "") { //list[i].imageURL = Ps.DoctorInfoDetail.GetValue(pclsCache.CacheConnectionObject, app.PatientID, "Contact", "Contact001_4", 1); app.imageURL = new UsersMethod().GetPatientValue(pclsCache, app.PatientID, "Contact", "Contact001_4", 1);//病人照片 UserBasicInfo ret = new UserBasicInfo(); ret = new UsersMethod().GetUserBasicInfo(pclsCache, app.PatientID); if (ret != null) { app.name = ret.UserName; app.age = ret.Age; //app.age = Convert.ToString(Ps.BasicInfo.GetAgeByBirthDay(pclsCache.CacheConnectionObject, Convert.ToInt32(ret.Birthday))); app.sex = ret.Gender; } } list.Add(app); } } return list; }
/// <summary> /// 获取某专员相关信息 SYF 20151022 /// </summary> /// <param name="pclsCache"></param> /// <param name="HealthCoachID"></param> /// <returns></returns> public HealthCoachInfo GetHealthCoachInfo(DataConnection pclsCache, string HealthCoachID) { HealthCoachInfo ret = new HealthCoachInfo(); try { DoctorInfo ret1 = GetDoctorInfo(pclsCache, HealthCoachID);//获取基本信息 ret.name = ""; ret.sex = ""; ret.age = ""; if (ret1 != null) { ret.name = ret1.DoctorName; ret.sex = ret1.Gender; ret.age = Convert.ToString(new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(ret1.Birthday))); } string moudlecodes = ""; string[] moudlecode = null; moudlecodes = new UsersMethod().GetModuleByDoctorId(pclsCache, HealthCoachID); if (moudlecodes != null) { moudlecode = moudlecodes.Split(new char[] { '_' }); for (int k = 0; k < moudlecode.Length; k++) { if (k == 0) { ret.module = new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } else { ret.module = ret.module + "/" + new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } } } GetDoctorInfoDetail ret2 = new GetDoctorInfoDetail(); ret2 = new UsersMethod().GetDoctorInfoDetail(pclsCache, HealthCoachID); if (ret2 != null) { ret.imageURL = ret2.PhotoAddress; ret.generalscore = Math.Round(Convert.ToDouble(ret2.GeneralScore), 1).ToString(); //ret.generalscore = Double.Parse(ret2.GeneralScore).ToString("F1"); ret.activityDegree = ret2.ActivityDegree; ret.generalComment = ret2.GeneralComment; ret.commentNum = ret2.commentNum; ret.Description = ret2.Description; ret.UnitName = ret2.UnitName; ret.UnitCode = ret2.UnitCode; ret.Dept = ret2.DeptName; ret.DeptCode = ret2.DeptCode; ret.JobTitle = ret2.JobTitle; ret.Level = ret2.Level; ret.AssessmentNum = ret2.AssessmentNum; ret.MSGNum = ret2.MSGNum; ret.AppointmentNum = ret2.AppointmentNum; ret.Activedays = ret2.Activedays; } ret.PatientNum = GetPatientNumByDoctorId(pclsCache, HealthCoachID); //管理病人数量 ret.OnPlanPatientNum = GetOnPlanPatientNumByDoctorId(pclsCache, HealthCoachID); //管理病人中有正在计划的人数量 ret.DoneCalendarNum = 0; List<Calendar> ListCal = new List<Calendar>(); ListCal = GetCalendar(pclsCache, HealthCoachID); if(ListCal != null) { for (int Cali = 0; Cali < ListCal.Count; Cali++) { if(ListCal[Cali].Status == 2) { ret.DoneCalendarNum++; } } } return ret; } catch (Exception ex) { //MessageBox.Show(ex.ToString(), "获取名称失败!"); HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UsersMethod.GetDoctorInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return null; } finally { pclsCache.DisConnect(); } }
/// <summary> /// 获取某专员相关信息 SYF 20151022 /// </summary> /// <param name="pclsCache"></param> /// <param name="HealthCoachID"></param> /// <returns></returns> public HealthCoachInfo GetHealthCoachInfo(DataConnection pclsCache, string HealthCoachID) { HealthCoachInfo ret = new HealthCoachInfo(); try { DoctorInfo ret1 = GetDoctorInfo(pclsCache, HealthCoachID);//获取基本信息 ret.name = ""; ret.sex = ""; ret.age = ""; if (ret1 != null) { ret.name = ret1.DoctorName; ret.sex = ret1.Gender; ret.age = Convert.ToString(new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(ret1.Birthday))); } string moudlecodes = ""; string[] moudlecode = null; moudlecodes = new UsersMethod().GetModuleByDoctorId(pclsCache, HealthCoachID); if (moudlecodes != null) { moudlecode = moudlecodes.Split(new char[] { '_' }); for (int k = 0; k < moudlecode.Length; k++) { if (k == 0) { ret.module = new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } else { ret.module = ret.module + "/" + new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } } } List<CategoryByDoctorId> ret2 = new List<CategoryByDoctorId>(); ret2 = new UsersMethod().GetCategoryByDoctorId(pclsCache, HealthCoachID); if (ret2 != null) { #region for (int j = 0; j < ret2.Count; j++) { if ((ret2[j].CategoryCode == "Contact") && (ret2[j].ItemCode == "Contact001_4")) { ret.imageURL = ret2[j].Value; } //获取头像 else if ((ret2[j].CategoryCode == "Score") && (ret2[j].ItemCode == "Score_1")) { ret.generalscore = ret2[j].Value; } //获取该专员总体评分 else if ((ret2[j].CategoryCode == "Score") && (ret2[j].ItemCode == "activityDegree")) { ret.activityDegree = ret2[j].Value; } //获取该专员活跃度 else if ((ret2[j].CategoryCode == "Score") && (ret2[j].ItemCode == "generalComment")) { ret.generalComment = ret2[j].Value; } //获取该专员整体评价 else if ((ret2[j].CategoryCode == "Score") && (ret2[j].ItemCode == "patientNum")) { ret.patientNum = ret2[j].Value; } //获取该专员负责病人数量 else if ((ret2[j].CategoryCode == "Personal") && (ret2[j].ItemCode == "Description")) { ret.Description = ret2[j].Value; } //获取该专员的简介 } #endregion } return ret; } catch (Exception ex) { //MessageBox.Show(ex.ToString(), "获取名称失败!"); HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UsersMethod.GetDoctorInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return null; } finally { pclsCache.DisConnect(); } }
/// <summary> /// 浙大输出接口 LY 2015-10-29 /// </summary> /// <param name="PatientId"></param> /// <returns></returns> public List<TypeAndName> GetPatientInfo(DataConnection pclsCache, string PatientId) { List<TypeAndName> List = new List<TypeAndName>(); PatBasicInfo BasicInfo = new UsersRepository().GetPatBasicInfo(pclsCache, PatientId); TypeAndName NewLine1 = new TypeAndName { Type = "name", Name = BasicInfo.UserName }; List.Add(NewLine1); TypeAndName NewLine2 = new TypeAndName { Type = "age", Name = BasicInfo.Age }; List.Add(NewLine2); TypeAndName NewLine3 = new TypeAndName { Type = "sex", Name = BasicInfo.Gender }; List.Add(NewLine3); string Height = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Height", "Height_1"); TypeAndName NewLine4 = new TypeAndName { Type = "height", Name = Height }; List.Add(NewLine4); string Weight = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Weight", "Weight_1"); TypeAndName NewLine5 = new TypeAndName { Type = "weight", Name = Weight }; List.Add(NewLine5); string PhoneNumber = new UsersMethod().GetPhoneNoByUserId(pclsCache, PatientId); TypeAndName NewLine6 = new TypeAndName { Type = "mobilephone", Name = PhoneNumber }; List.Add(NewLine6); return List; }
/// <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; }
/// <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 HttpResponseMessage VitalSignFromZKY(VitalSignFromDevice VitalSigns) { int ret = 9; var HeaderList = Request.Headers.ToList(); string HeaderContent = ""; KeyValuePair<string, IEnumerable<string>> Header = HeaderList.Find(delegate(KeyValuePair<string, IEnumerable<string>> x) { return x.Key == "Token"; }); if (Header.Key != null) HeaderContent = Header.Value.First(); if (HeaderContent != "#zjuBME319*") return new ExceptionHandler().SetData(Request, ret); ret = repository.VitalSignFromZKY(pclsCache, VitalSigns); if (ret == 1) { string UserId = new UsersMethod().GetIDByInput(pclsCache, "PhoneNo", VitalSigns.mobilephone); string Note = repository.PushNotification("android", UserId, "新的体征信息已输入,请查看"); } return new ExceptionHandler().SetData(Request, 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); } }
/// <summary> /// Checks if a token is valid. /// </summary> /// <param name="token"></param> /// <returns></returns> public static bool IsTokenValid(string token) { bool result = false; try { // Base64 decode the string, obtaining the token:username:timeStamp. string key = Encoding.UTF8.GetString(Convert.FromBase64String(token)); // Split the parts. string[] parts = key.Split(new char[] { ':' }); if (parts.Length == 6) { // Get the hash message, username, and timestamp. string hash = parts[0]; string UserId = parts[1]; string role = parts[2]; string tokentime = parts[3] + ":" + parts[4] + ":" + parts[5]; //long ticks = long.Parse(tokentime); //DateTime timeStamp = new DateTime(ticks); DateTime timeStamp = Convert.ToDateTime(tokentime); // Ensure the timestamp is valid. bool expired = Math.Abs((DateTime.UtcNow - timeStamp).TotalMinutes) > _expirationMinutes; if (!expired) { DataConnection pclsCache = new DataConnection(); Regex dReg = new Regex(@"^1[3578][01379]\d{8}$"); Regex tReg = new Regex(@"^1[34578][01256]\d{8}$"); Regex yReg = new Regex(@"^(134[012345678]\d{7}|1[34578][012356789]\d{8})$"); Regex mail = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); string pwType = ""; if( dReg.IsMatch(UserId) || tReg.IsMatch(UserId) || yReg.IsMatch(UserId)) { pwType = "PhoneNo"; } else if(mail.IsMatch(UserId)) { pwType = "Email"; } string UserIdCheck = new UsersMethod().GetIDByInputPhone(pclsCache, pwType, UserId);//用手机号获取UserId bool exist = new UsersMethod().CheckUserExist(pclsCache, UserIdCheck); if (exist) { //string password = "******"; UserInfoByUserId list = new UserInfoByUserId(); list = new UsersMethod().GetUserInfoByUserId(pclsCache, UserIdCheck); string password = ""; if (list != null) { password = list.Password; } // Hash the message with the key to generate a token. string computedToken = GenerateToken(UserId, password, role, tokentime); // Compare the computed token with the one supplied and ensure they match. result = (token == computedToken); } } } } catch { } return result; }
/// <summary> /// 获取风险评估所需输入 LY 2015-10-13 /// </summary> /// <param name="UserId"></param> /// <returns></returns> public RiskInput GetRiskInput(DataConnection pclsCache, string UserId) { //当用户缺少某项参数时,设置一个默认值 int Age = 1;//年龄默认1岁(避免出现0岁) int Gender = 0;//性别男 int Height = 0;//身高176cm int Weight = 0;//体重69千克 int AbdominalGirth = 0; //腹围 int Heartrate = 0;//心率 int Parent = 0;//父母中至少有一方有高血压 int Smoke = 0;//不抽烟 int Stroke = 0;//没有中风 int Lvh = 0; ;//有左心室肥大 int Diabetes = 0;//有伴随糖尿病 int Treat = 0;//高血压是否在治疗(接受过)没有 int Heartattack = 0;//有过心脏事件(心血管疾病) int Af = 0;//没有过房颤 int Chd = 0;//有冠心病(心肌梗塞) int Valve = 0;//没有心脏瓣膜病 double Tcho = 0;//总胆固醇浓度5.2mmol/L double Creatinine = 0;//肌酐浓度140μmoI/L double Hdlc = 0;//高密度脂蛋白胆固醇1.21g/ml int SBP = 0;//当前收缩压 int DBP = 0;//当前舒张压 //用于取得真实值 int piParent = 0;//父母中至少有一方有高血压 int piSmoke = 0;//不抽烟 int piStroke = 0;//没有中风 int piLvh = 0; ;//有左心室肥大 int piDiabetes = 0;//有伴随糖尿病 int piTreat = 0;//高血压是否在治疗(接受过)没有 int piHeartattack = 0;//有过心脏事件(心血管疾病) int piAf = 0;//没有过房颤 int piChd = 0;//有冠心病(心肌梗塞) int piValve = 0;//没有心脏瓣膜病 BasicInfo BaseList = new UsersMethod().GetBasicInfo(pclsCache, UserId); if (BaseList != null) { if (BaseList.Birthday != "" && BaseList.Birthday != "0" && BaseList.Birthday != null) { Age = new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(BaseList.Birthday));//年龄 } if (BaseList.Gender != "" && BaseList.Gender != "0" && BaseList.Gender != null) { Gender = Convert.ToInt32(BaseList.Gender);//性别 } } if (Gender <= 2) { Gender = Gender - 1; } else { Gender = 0; } if (Gender == 1)//为计算方便,性别值对调 { Gender = 0; } else { Gender = 1; } //获取体重,身高和BMI string Weight1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_02", 1); if (Weight1 != "" && Weight1 != "0" && Weight1 != null) { Weight = Convert.ToInt32(Weight1); } string Height1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_01", 1); if (Height1 != "" && Height1 != "0" && Height1 != null) { Height = Convert.ToInt32(Height1); } string BMIStr = ((double)Weight / ((double)Height * (double)Height) * 10000).ToString("f2"); double BMI = double.Parse(BMIStr); //获取腹围 string AbdominalGirth1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_13", 1); if (AbdominalGirth1 != "" && AbdominalGirth1 != "0" && AbdominalGirth1 != null) { AbdominalGirth = Convert.ToInt32(AbdominalGirth1); } //获取心率 string Heart = new VitalInfoMethod().GetLatestPatientVitalSigns(pclsCache, UserId, "HeartRate", "HeartRate_1"); if (Heart != "" && Heart != "0" && Heart != null) { Heartrate = Convert.ToInt32(Heart); } //获取遗传信息,即父母有无高血压,1是2否3未知 string Parent1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1002_01", 1); if (Parent1 != "" && Parent1 != "0" && Parent1 != null) { Parent = Convert.ToInt32(Parent1); piParent = Parent; } if (Parent > 1) { Parent = 0; } //获取是否抽烟1是2否3未知 string Smoke1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1005_04", 1); if (Smoke1 != "" && Smoke1 != "0" && Smoke1 != null) { Smoke = Convert.ToInt32(Smoke1); piSmoke = Smoke; } if (Smoke > 1) { Smoke = 0; } //获取是否中风 string Stroke1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_07", 1); if (Stroke1 != "" && Stroke1 != "0" && Stroke1 != null) { Stroke = Convert.ToInt32(Stroke1); piStroke = Stroke; } if (Stroke > 1) { Stroke = 0; } //获取是否左心室肥大 string Lvh1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_09", 1); if (Lvh1 != "" && Lvh1 != "0" && Lvh1 != null) { Lvh = Convert.ToInt32(Lvh1); piLvh = Lvh; } if (Lvh > 1) { Lvh = 0; } //获取是否糖尿病 string Diabetes1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1002_02", 1); if (Diabetes1 != "" && Diabetes1 != "0" && Diabetes1 != null) { Diabetes = Convert.ToInt32(Diabetes1); piDiabetes = Diabetes; } if (Diabetes > 1) { Diabetes = 0; } //高血压是否在治疗(是否接受高血压治疗) string Treat1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1003_02", 1); if (Treat1 != "" && Treat1 != "0" && Treat1 != null) { Treat = Convert.ToInt32(Treat1); piTreat = Treat; } if (Treat > 1) { Treat = 0; } //是否有心脏事件(心血管疾病,心脏骤停) string Heartattack1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_04", 1); if (Heartattack1 != "" && Heartattack1 != "0" && Heartattack1 != null) { Heartattack = Convert.ToInt32(Heartattack1); piHeartattack = Heartattack; } if (Heartattack > 1) { Heartattack = 0; } //是否有房颤 string Af1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_05", 1); if (Af1 != "" && Af1 != "0" && Af1 != null) { Af = Convert.ToInt32(Af1); piAf = Af; } if (Af > 1) { Af = 0; } //是否有冠心病(心肌梗塞) string Chd1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_02", 1); if (Chd1 != "" && Chd1 != "0" && Chd1 != null) { Chd = Convert.ToInt32(Chd1); piChd = Chd; } if (Chd > 1) { Chd = 0; } //是否有心脏瓣膜病 string Valve1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_06", 1); if (Valve1 != "" && Valve1 != "0" && Valve1 != null) { Valve = Convert.ToInt32(Valve1); piValve = Valve; } if (Valve > 1) { Valve = 0; } //总胆固醇浓度 string Tcho1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_09", 1); if (Tcho1 != "" && Tcho1 != "0" && Tcho1 != null) { Tcho = Convert.ToDouble(Tcho1); } //肌酐浓度 string Creatinine1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_08", 1); if (Creatinine1 != "" && Creatinine1 != "0" && Creatinine1 != null) { Creatinine = Convert.ToDouble(Creatinine1); } //高密度脂蛋白胆固醇 string Hdlc1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_10", 1); if (Hdlc1 != "" && Hdlc1 != "0" && Hdlc1 != null) { Hdlc = Convert.ToDouble(Hdlc1); } //收缩压和舒张压 string SBP1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_05", 1); if (SBP1 != "" && SBP1 != "0" && SBP1 != null) { SBP = Convert.ToInt32(SBP1); } string DBP1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_06", 1); if (DBP1 != "" && DBP1 != "0" && DBP1 != null) { DBP = Convert.ToInt32(DBP1); } //高血压风险,除血压外的风险已经计算好放在Hyperother中,界面上取了血压之后,加上血压的风险即可。 double Hyperother = -0.15641 * Age - 0.20293 * Gender - 0.19073 * Smoke - 0.16612 * Parent - 0.03388 * BMI; //HarvardRiskInfactor这个变量存的是Harvard风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后代入公式计算。 int HarvardRiskInfactor = 0; if (Gender == 1) { if (Age <= 39) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 19; } else { HarvardRiskInfactor = HarvardRiskInfactor + 0; } } else if (Age <= 44 && Age >= 40) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 7; } else { HarvardRiskInfactor = HarvardRiskInfactor + 4; } } else if (Age <= 49 && Age >= 45) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 7; } else { HarvardRiskInfactor = HarvardRiskInfactor + 7; } } else if (Age <= 54 && Age >= 50) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 11; } else { HarvardRiskInfactor = HarvardRiskInfactor + 6; } } else if (Age <= 59 && Age >= 55) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 14; } else { HarvardRiskInfactor = HarvardRiskInfactor + 6; } } else if (Age <= 64 && Age >= 60) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 18; } else { HarvardRiskInfactor = HarvardRiskInfactor + 5; } } else if (Age <= 69 && Age >= 65) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 22; } else { HarvardRiskInfactor = HarvardRiskInfactor + 4; } } else { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 25; } else { HarvardRiskInfactor = HarvardRiskInfactor + 4; } } //年龄和抽烟的风险值加成 if (Tcho < 5) { HarvardRiskInfactor = HarvardRiskInfactor + 0; } else if (Tcho >= 5.0 && Tcho <= 5.9) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else if (Tcho >= 6.0 && Tcho <= 6.9) { HarvardRiskInfactor = HarvardRiskInfactor + 4; } else if (Tcho >= 7.0 && Tcho <= 7.9) { HarvardRiskInfactor = HarvardRiskInfactor + 5; } else if (Tcho >= 8.0 && Tcho <= 8.9) { HarvardRiskInfactor = HarvardRiskInfactor + 7; } else { HarvardRiskInfactor = HarvardRiskInfactor + 9; } //总胆固醇浓度风险值加成 if (Height < 145) { HarvardRiskInfactor = HarvardRiskInfactor + 6; } else if (Height >= 145 && Height <= 154) { HarvardRiskInfactor = HarvardRiskInfactor + 4; } else if (Height >= 155 && Height <= 164) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } else if (Height >= 165 && Height <= 174) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else { HarvardRiskInfactor = HarvardRiskInfactor + 0; } //身高风险值加成 if (Creatinine < 50) { HarvardRiskInfactor = HarvardRiskInfactor + 0; } else if (Creatinine >= 50 && Creatinine <= 69) { HarvardRiskInfactor = HarvardRiskInfactor + 1; } else if (Creatinine >= 70 && Creatinine <= 89) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else if (Creatinine >= 90 && Creatinine <= 109) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } else { HarvardRiskInfactor = HarvardRiskInfactor + 4; } //肌酐浓度风险值加成 if (Chd == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 8; } //心肌梗塞(冠心病)风险值加成 if (Stroke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 8; } //中风风险值加成 if (Lvh == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } //左室高血压(左心室肥大)风险值加成 if (Diabetes == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } //糖尿病风险值加成 } //以上是男性风险值 else { if (Age <= 39) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 13; } else { HarvardRiskInfactor = HarvardRiskInfactor + 0; } } else if (Age <= 44 && Age >= 40) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 12; } else { HarvardRiskInfactor = HarvardRiskInfactor + 5; } } else if (Age <= 49 && Age >= 45) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 11; } else { HarvardRiskInfactor = HarvardRiskInfactor + 9; } } else if (Age <= 54 && Age >= 50) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 10; } else { HarvardRiskInfactor = HarvardRiskInfactor + 14; } } else if (Age <= 59 && Age >= 55) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 10; } else { HarvardRiskInfactor = HarvardRiskInfactor + 18; } } else if (Age <= 64 && Age >= 60) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 9; } else { HarvardRiskInfactor = HarvardRiskInfactor + 23; } } else if (Age <= 69 && Age >= 65) { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 9; } else { HarvardRiskInfactor = HarvardRiskInfactor + 27; } } else { if (Smoke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 8; } else { HarvardRiskInfactor = HarvardRiskInfactor + 32; } } //年龄和抽烟的风险值加成 if (Tcho < 5) { HarvardRiskInfactor = HarvardRiskInfactor + 0; } else if (Tcho >= 5.0 && Tcho <= 5.9) { HarvardRiskInfactor = HarvardRiskInfactor + 0; } else if (Tcho >= 6.0 && Tcho <= 6.9) { HarvardRiskInfactor = HarvardRiskInfactor + 1; } else if (Tcho >= 7.0 && Tcho <= 7.9) { HarvardRiskInfactor = HarvardRiskInfactor + 1; } else if (Tcho >= 8.0 && Tcho <= 8.9) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else { HarvardRiskInfactor = HarvardRiskInfactor + 2; } //总胆固醇浓度风险值加成 if (Height < 145) { HarvardRiskInfactor = HarvardRiskInfactor + 6; } else if (Height >= 145 && Height <= 154) { HarvardRiskInfactor = HarvardRiskInfactor + 4; } else if (Height >= 155 && Height <= 164) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } else if (Height >= 165 && Height <= 174) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else { HarvardRiskInfactor = HarvardRiskInfactor + 0; } //身高风险值加成 if (Creatinine < 50) { HarvardRiskInfactor = HarvardRiskInfactor + 0; } else if (Creatinine >= 50 && Creatinine <= 69) { HarvardRiskInfactor = HarvardRiskInfactor + 1; } else if (Creatinine >= 70 && Creatinine <= 89) { HarvardRiskInfactor = HarvardRiskInfactor + 2; } else if (Creatinine >= 90 && Creatinine <= 109) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } else { HarvardRiskInfactor = HarvardRiskInfactor + 4; } //肌酐浓度风险值加成 if (Chd == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 8; } //心肌梗塞(冠心病)风险值加成 if (Stroke == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 8; } //中风风险值加成 if (Lvh == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 3; } //左室高血压(左心室肥大)风险值加成 if (Diabetes == 1) { HarvardRiskInfactor = HarvardRiskInfactor + 9; } //糖尿病风险值加成 } //以上是女性风险值 //FraminghamRiskInfactor这个变量存的是Framingham风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后代入公式计算。 //这个Framingham模型也是需要收缩压值的,分为接受过治疗的血压和未接受过治疗的血压,模型分为男女进行计算,因为不同性别公式不同 double FraminghamRiskInfactor = 0.0; if (Gender == 1) //男性 { FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Age) * 3.06117;//性别 FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Tcho) * 1.12370;//总胆固醇 FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Hdlc) * (-0.93263);//高密度脂蛋白胆固醇 if (Smoke == 1) { FraminghamRiskInfactor = FraminghamRiskInfactor + 0.65451;//抽烟 } if (Diabetes == 1) { FraminghamRiskInfactor = FraminghamRiskInfactor + 0.57367;//抽烟 } } else //女性 { FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Age) * 2.3288;//性别 FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Tcho) * 1.20904;//总胆固醇 FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Hdlc) * (-0.70833);//高密度脂蛋白胆固醇 if (Smoke == 1) { FraminghamRiskInfactor = FraminghamRiskInfactor + 0.52873;//抽烟 } if (Diabetes == 1) { FraminghamRiskInfactor = FraminghamRiskInfactor + 0.69154;//抽烟 } } //StrokeRiskInfactor这个变量存的是中风风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后计算。 int StrokeRiskInfactor = 0; if (Gender == 1) //男性 { if (Age <= 56) { StrokeRiskInfactor = StrokeRiskInfactor + 0; } else if (Age >= 57 && Age <= 59) { StrokeRiskInfactor = StrokeRiskInfactor + 1; } else if (Age >= 60 && Age <= 62) { StrokeRiskInfactor = StrokeRiskInfactor + 2; } else if (Age >= 63 && Age <= 65) { StrokeRiskInfactor = StrokeRiskInfactor + 3; } else if (Age >= 66 && Age <= 68) { StrokeRiskInfactor = StrokeRiskInfactor + 4; } else if (Age >= 69 && Age <= 72) { StrokeRiskInfactor = StrokeRiskInfactor + 5; } else if (Age >= 73 && Age <= 75) { StrokeRiskInfactor = StrokeRiskInfactor + 6; } else if (Age >= 76 && Age <= 78) { StrokeRiskInfactor = StrokeRiskInfactor + 7; } else if (Age >= 79 && Age <= 81) { StrokeRiskInfactor = StrokeRiskInfactor + 8; } else if (Age >= 82 && Age <= 84) { StrokeRiskInfactor = StrokeRiskInfactor + 9; } else { StrokeRiskInfactor = StrokeRiskInfactor + 10; } if (Diabetes == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 2; } //糖尿病风险值加成 if (Smoke == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 3; } //吸烟风险值加成 if (Heartattack == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 4; } //心血管疾病史(心脏事件)风险值加成 if (Af == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 4; } //房颤风险值加成 if (Lvh == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 5; } } else //女性 { if (Age <= 56) { StrokeRiskInfactor = StrokeRiskInfactor + 0; } else if (Age >= 57 && Age <= 59) { StrokeRiskInfactor = StrokeRiskInfactor + 1; } else if (Age >= 60 && Age <= 62) { StrokeRiskInfactor = StrokeRiskInfactor + 2; } else if (Age >= 63 && Age <= 64) { StrokeRiskInfactor = StrokeRiskInfactor + 3; } else if (Age >= 65 && Age <= 67) { StrokeRiskInfactor = StrokeRiskInfactor + 4; } else if (Age >= 68 && Age <= 70) { StrokeRiskInfactor = StrokeRiskInfactor + 5; } else if (Age >= 71 && Age <= 73) { StrokeRiskInfactor = StrokeRiskInfactor + 6; } else if (Age >= 74 && Age <= 76) { StrokeRiskInfactor = StrokeRiskInfactor + 7; } else if (Age >= 77 && Age <= 78) { StrokeRiskInfactor = StrokeRiskInfactor + 8; } else if (Age >= 79 && Age <= 81) { StrokeRiskInfactor = StrokeRiskInfactor + 9; } else { StrokeRiskInfactor = StrokeRiskInfactor + 10; } if (Diabetes == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 3; } //糖尿病风险值加成 if (Smoke == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 3; } //吸烟风险值加成 if (Heartattack == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 2; } //心血管疾病史(心脏事件)风险值加成 if (Af == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 6; } //房颤风险值加成 if (Lvh == 1) { StrokeRiskInfactor = StrokeRiskInfactor + 4; } } //HeartFailureRiskInfactor这个变量存的是心衰风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后计算。 int HeartFailureRiskInfactor = 0; if (Gender == 1) //男性 { if (Age <= 49) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0; } else if (Age >= 50 && Age <= 54) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } else if (Age >= 55 && Age <= 59) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } else if (Age >= 60 && Age <= 64) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3; } else if (Age >= 65 && Age <= 69) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4; } else if (Age >= 70 && Age <= 74) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5; } else if (Age >= 75 && Age <= 79) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6; } else if (Age >= 80 && Age <= 84) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 7; } else if (Age >= 85 && Age <= 89) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8; } else { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 9; } if (Heartrate <= 54) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0; } else if (Heartrate >= 55 && Heartrate <= 64) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } else if (Heartrate >= 65 && Heartrate <= 79) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } else if (Heartrate >= 80 && Heartrate <= 89) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3; } else if (Heartrate >= 90 && Heartrate <= 104) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4; } else { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5; } //心率风险值加成 if (Lvh == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4; } //左心室肥大(左室高血压)风险值加成 if (Chd == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8; } //冠心病风险值加成 if (Valve == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5; } //瓣膜疾病风险值加成 if (Smoke == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } //糖尿病风险值加成 } else //女性 { if (Age <= 49) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0; } else if (Age >= 50 && Age <= 54) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } else if (Age >= 55 && Age <= 59) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } else if (Age >= 60 && Age <= 64) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3; } else if (Age >= 65 && Age <= 69) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4; } else if (Age >= 70 && Age <= 74) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5; } else if (Age >= 75 && Age <= 79) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6; } else if (Age >= 80 && Age <= 84) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 7; } else if (Age >= 85 && Age <= 89) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8; } else { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 9; } //年龄的风险加权值 if (Heartrate < 60) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0; } else if (Heartrate >= 60 && Heartrate <= 79) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } else if (Heartrate >= 80 && Heartrate <= 104) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } else { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3; } //心率风险值加成 if (Lvh == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5; } //左心室肥大(左室高血压)风险值加成 if (Chd == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6; } //冠心病风险值加成 if (Valve == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6; if (Smoke == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } } else { if (Smoke == 1) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6; } } //瓣膜疾病和糖尿病风险值加成 if (BMI < 21) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0; } else if (BMI >= 21 && BMI <= 25) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1; } else if (BMI > 25 && BMI <= 29) { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2; } else { HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3; } } //BMI风险值加成 RiskInput Input = new RiskInput(); Input.Age = Age; Input.Gender = Gender; Input.Height = Height; Input.Weight = Weight; Input.AbdominalGirth = AbdominalGirth; Input.BMI = BMI; Input.Heartrate = Heartrate; Input.Parent = Parent; Input.Smoke = Smoke; Input.Stroke = Stroke; Input.Lvh = Lvh; Input.Diabetes = Diabetes; Input.Treat = Treat; Input.Heartattack = Heartattack; Input.Af = Af; Input.Chd = Chd; Input.Valve = Valve; Input.Tcho = Tcho; Input.Creatinine = Creatinine; Input.Hdlc = Hdlc; Input.Hyperother = Hyperother; Input.HarvardRiskInfactor = HarvardRiskInfactor; Input.FraminghamRiskInfactor = FraminghamRiskInfactor; Input.StrokeRiskInfactor = StrokeRiskInfactor; Input.HeartFailureRiskInfactor = HeartFailureRiskInfactor; Input.SBP = SBP; Input.DBP = DBP; Input.piParent = piParent; Input.piSmoke = piSmoke; Input.piStroke = piStroke; Input.piLvh = piLvh; Input.piDiabetes = piDiabetes; Input.piTreat = piTreat; Input.piHeartattack = piHeartattack; Input.piAf = piAf; Input.piChd = piChd; Input.piValve = piValve; return Input; }
/// <summary> /// 获取健康专员列表 SYF 20151022 /// </summary> /// <param name="pclsCache"></param> /// <returns></returns> public List<HealthCoachList> GetHealthCoachList(DataConnection pclsCache) { List<HealthCoachList> list = new List<HealthCoachList>(); List<ActiveUser> list1 = new List<ActiveUser>(); List<CategoryByDoctorId> list2 = new List<CategoryByDoctorId>(); string moudlecodes = ""; string[] moudlecode = null; //string DoctorId = ""; try { list1 = GetActiveUserByRole(pclsCache, "HealthCoach");//根据角色获取已激活的用户 if (list1 != null) { for (int i = 0; i < list1.Count; i++) { DoctorInfo dcf = new DoctorInfo(); HealthCoachList hcf = new HealthCoachList(); //一次循环取一个健康专员的信息 // DoctorId = list1[i].UserId; dcf = new UsersMethod().GetDoctorInfo(pclsCache, list1[i].UserId);//获取基本信息 hcf.healthCoachID = list1[i].UserId; hcf.name = ""; hcf.sex = ""; hcf.age = ""; if (dcf != null) { hcf.name = dcf.DoctorName; hcf.sex = dcf.Gender; hcf.age = Convert.ToString(new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(dcf.Birthday))); } moudlecodes = new UsersMethod().GetModuleByDoctorId(pclsCache, list1[i].UserId); if (moudlecodes != null) { moudlecode = moudlecodes.Split(new char[] { '_' }); for (int k = 0; k < moudlecode.Length; k++) { if (k == 0) { hcf.module = new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } else { hcf.module = hcf.module + "/" + new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } } } list2 = new UsersMethod().GetCategoryByDoctorId(pclsCache, list1[i].UserId); //获取某个健康专员的所有CategoryCode信息 if (list2 != null) { #region for (int j = 0; j < list2.Count; j++) { if ((list2[j].CategoryCode == "Contact") && (list2[j].ItemCode == "Contact001_4")) { hcf.imageURL = list2[j].Value; } //获取头像 else if ((list2[j].CategoryCode == "Score") && (list2[j].ItemCode == "Score_1")) { hcf.score = list2[j].Value; } //获取该专员总体评分 } #endregion } list.Add(hcf); } } return list; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UserMethod.GetHealthCoachList", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return null; } finally { pclsCache.DisConnect(); } }
public int SetM3RiskInput(DataConnection pclsCache, string PatientId, M3RiskInput M3RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType) { int ret = 0; int fret = 1; try { #region//插入PsVitalSigns表 ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M3RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M3RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M3", "QG0013", M3RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion #region//插入PsBasicInfoDetail表 ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0025", 1, M3RiskInput.EF.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QF0011", 1, M3RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0045", 1, M3RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QH0001", 1, M3RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0008", 1, M3RiskInput.NYHA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0046", 1, M3RiskInput.Lung.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0047", 1, M3RiskInput.HF18.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0008", 1, M3RiskInput.Beta.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0009", 1, M3RiskInput.AA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion return(fret); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM3RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(0); } finally { pclsCache.DisConnect(); } }
public int SetM1RiskInput(DataConnection pclsCache, string PatientId, M1RiskInput M1RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType) { int ret = 0; int fret = 1; try { #region//插入PsVitalSigns表 ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M1RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M1RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0018", M1RiskInput.AbdominalGirth.ToString(), "mm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0007", M1RiskInput.Heartrate.ToString(), "次/分", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0013", M1RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0012", M1RiskInput.DBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion #region//插入PsBasicInfoDetail表 ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QC0001", 1, M1RiskInput.Parent.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QF0011", 1, M1RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0007", 1, M1RiskInput.Stroke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QJ0024", 1, M1RiskInput.Lvh.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QB0045", 1, M1RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QD0002", 1, M1RiskInput.Treat.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0004", 1, M1RiskInput.Heartattack.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0005", 1, M1RiskInput.Af.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0002", 1, M1RiskInput.Chd.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0006", 1, M1RiskInput.Valve.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0002", 1, M1RiskInput.Tcho.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0001", 1, M1RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0003", 1, M1RiskInput.Hdlc.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion return fret; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM1RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return 0; } finally { pclsCache.DisConnect(); } }
/// <summary> /// 浙大输出接口 LY 2015-10-29 /// </summary> /// <param name="PatientId"></param> /// <returns></returns> public string GetPatientInfo(DataConnection pclsCache, string PatientId) { List<TypeAndName> List = new List<TypeAndName>(); List.Add(new TypeAndName { Type = "ubid", Name = "DW0101111447049158" }); PatBasicInfo BasicInfo = new UsersRepository().GetPatBasicInfo(pclsCache, PatientId); if (BasicInfo == null) return "病人不存在"; List.Add(new TypeAndName { Type = "name", Name = BasicInfo.UserName }); List.Add(new TypeAndName { Type = "age", Name = BasicInfo.Age }); List.Add(new TypeAndName { Type = "sex", Name = BasicInfo.Gender }); string PhoneNumber = new UsersMethod().GetPhoneNoByUserId(pclsCache, PatientId); List.Add(new TypeAndName { Type = "mobilephone", Name = PhoneNumber }); ValueTime H = new ValueTime(); H = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Height", "Height_1"); string Height = H.Value; ValueTime W = new ValueTime(); W = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Weight", "Weight_1"); string Weight = W.Value; ValueTime Wa = new ValueTime(); Wa = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Waistline", "Waistline_1"); string Waistline = Wa.Value; if (Height == null) Height = ""; if (Weight == null) Weight = ""; List.Add(new TypeAndName { Type = "height", Name = Height }); List.Add(new TypeAndName { Type = "weight", Name = Weight }); List.Add(new TypeAndName { Type = "birthday", Name = BasicInfo.Birthday.Insert(4,"-").Insert(7,"-") }); if (Waistline != null) List.Add(new TypeAndName { Type = "waistline", Name = Waistline }); try { string BasicJson = "{"; foreach (TypeAndName Line in List) { BasicJson = BasicJson + '"' + Line.Type + '"' + ':' + '"' + Line.Name + '"' + ','; } BasicJson = BasicJson.TrimEnd(','); BasicJson += "}"; byte[] bytedata = Encoding.UTF8.GetBytes(BasicJson); string content = Convert.ToBase64String(bytedata, 0, bytedata.Length); content = "type=docapp&action=004&content=" + content + "&contentkey=#HQ*" + content; string Url = "http://qacsupport.duapp.com/port/port.php"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = Encoding.UTF8.GetBytes(content); request.ContentLength = bytes.Length; //request.Timeout = 10000; Stream reqstream = request.GetRequestStream(); reqstream.Write(bytes, 0, bytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamReceive = response.GetResponseStream(); Encoding encoding = Encoding.UTF8; StreamReader streamReader = new StreamReader(streamReceive, encoding); string strResult = streamReader.ReadToEnd(); streamReceive.Dispose(); streamReader.Dispose(); return strResult; } catch (WebException ex) { using (WebResponse response = ex.Response) { HttpWebResponse httpResponse = (HttpWebResponse)response; Console.WriteLine("Error code: {0}", httpResponse.StatusCode); using (Stream data = response.GetResponseStream()) using (var reader = new StreamReader(data)) { string text = reader.ReadToEnd(); Console.WriteLine(text); } } return ex.Message; } }
public int SetM3RiskInput(DataConnection pclsCache, string PatientId, M3RiskInput M3RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType) { int ret = 0; int fret = 1; try { #region//插入PsVitalSigns表 ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M3RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M3RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M3", "QG0013", M3RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion #region//插入PsBasicInfoDetail表 ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0025", 1, M3RiskInput.EF.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QF0011", 1, M3RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0045", 1, M3RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QH0001", 1, M3RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0008", 1, M3RiskInput.NYHA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0046", 1, M3RiskInput.Lung.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0047", 1, M3RiskInput.HF18.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0008", 1, M3RiskInput.Beta.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0009", 1, M3RiskInput.AA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType); if (ret == 0) { fret = 0; } #endregion return fret; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM3RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return 0; } finally { pclsCache.DisConnect(); } }
/// <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 revUserId, string TerminalName, string TerminalIP, int DeviceType) { string UserId = new UsersMethod().GetIDByInput(pclsCache, "PhoneNo", VitalSigns.mobilephone); int RecordDate = Convert.ToInt32(VitalSigns.DateTime.Split('|')[0]); int RecordTime = Convert.ToInt32(VitalSigns.DateTime.Split('|')[1]); int ret = 0; if (VitalSigns.Bloodpressure_1.Type != "" && VitalSigns.Bloodpressure_1.Name != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Bloodpressure", "Bloodpressure_1", VitalSigns.Bloodpressure_1.Type, VitalSigns.Bloodpressure_1.Name, revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.Bloodpressure_2.Type != "" && VitalSigns.Bloodpressure_2.Name != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Bloodpressure", "Bloodpressure_2", VitalSigns.Bloodpressure_2.Type, VitalSigns.Bloodpressure_2.Name, revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.Pulserate_1.Type != "" && VitalSigns.Pulserate_1.Name != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Pulserate", "Pulserate_1", VitalSigns.Pulserate_1.Type, VitalSigns.Pulserate_1.Name, revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.Bloodglucose.Type != "" && VitalSigns.Bloodglucose.Name != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "BloodSugar", "BloodSugar_1", VitalSigns.Bloodglucose.Type, VitalSigns.Bloodglucose.Name, revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.Respiratoryrate.Type != "" && VitalSigns.Respiratoryrate.Name != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "BreathStatus", "Respiratoryrate", VitalSigns.Respiratoryrate.Type, VitalSigns.Respiratoryrate.Name, revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.ECG != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "ECG", "ECG_1", VitalSigns.ECG, "", revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } if (VitalSigns.Activity != "") { ret = new VitalInfoRepository().SetPatientVitalSigns(pclsCache, UserId, RecordDate, RecordTime, "Activity", "Activity_1", VitalSigns.Activity, "", revUserId, TerminalName, TerminalIP, DeviceType); if (ret == 0) return ret; } return ret; }
/// <summary> /// 获取健康专员列表 SYF 20151022 /// </summary> /// <param name="pclsCache"></param> /// <returns></returns> public List<HealthCoachList> GetHealthCoachList(DataConnection pclsCache) { List<HealthCoachList> list = new List<HealthCoachList>(); List<ActiveUser> list1 = new List<ActiveUser>(); GetDoctorInfoDetail list2 = new GetDoctorInfoDetail(); string moudlecodes = ""; string[] moudlecode = null; //string DoctorId = ""; try { list1 = GetActiveUserByRole(pclsCache, "HealthCoach");//根据角色获取已激活的用户 if (list1 != null) { for (int i = 0; i < list1.Count; i++) { DoctorInfo dcf = new DoctorInfo(); HealthCoachList hcf = new HealthCoachList(); //一次循环取一个健康专员的信息 // DoctorId = list1[i].UserId; dcf = new UsersMethod().GetDoctorInfo(pclsCache, list1[i].UserId);//获取基本信息 hcf.healthCoachID = list1[i].UserId; hcf.name = ""; hcf.sex = ""; hcf.age = ""; if (dcf != null) { hcf.name = dcf.DoctorName; hcf.sex = dcf.Gender; hcf.age = Convert.ToString(new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(dcf.Birthday))); } moudlecodes = new UsersMethod().GetModuleByDoctorId(pclsCache, list1[i].UserId); if (moudlecodes != null) { moudlecode = moudlecodes.Split(new char[] { '_' }); for (int k = 0; k < moudlecode.Length; k++) { if (k == 0) { hcf.module = new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } else { hcf.module = hcf.module + "/" + new UsersMethod().GetCategoryName(pclsCache, moudlecode[k]); } } } list2 = new UsersMethod().GetDoctorInfoDetail(pclsCache, list1[i].UserId); if (list2 != null) { hcf.imageURL = list2.PhotoAddress; hcf.score = Math.Round(Convert.ToDouble(list2.GeneralScore),1).ToString(); //hcf.score = list2.GeneralScore; //hcf.score = Double.Parse(hcf.score).ToString("F1"); } list.Add(hcf); } } return list; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UserMethod.GetHealthCoachList", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return null; } finally { pclsCache.DisConnect(); } }
public List<ConsultationStatus> ConsultationGetPatientsByStatus(DataConnection pclsCache, string DoctorId, int Status) { List<ConsultationStatus> items = new List<ConsultationStatus>(); if(Status == 7) { for(int i=3; i>0; i--) { List<ConsultationStatus> item = new List<ConsultationStatus>(); item = new UsersMethod().ConsultationGetPatientsByStatus(pclsCache, DoctorId, i); if(item != null) { items.AddRange(item); } } } else if(Status == 8) { for (int i=6; i>3; i--) { List<ConsultationStatus> item = new List<ConsultationStatus>(); item = new UsersMethod().ConsultationGetPatientsByStatus(pclsCache, DoctorId, i); if (item != null) { items.AddRange(item); } } } else { items = new UsersMethod().ConsultationGetPatientsByStatus(pclsCache, DoctorId, Status); } return items; }
public List<AppoitmentPatient> GetAppoitmentPatientList(DataConnection pclsCache, string healthCoachID, string Status) { List<AppoitmentPatient> list = new List<AppoitmentPatient>(); List<PatientsByStatus> list1 = new List<PatientsByStatus>(); try { list1 = GetPatientsByStatus(pclsCache, healthCoachID, Status); if (list1 != null) { for (int i = 0; i < list1.Count; i++) { AppoitmentPatient app = new AppoitmentPatient(); app.PatientID = list1[i].PatientId; app.module = list1[i].Module; app.AppointmentStatus = list1[i].Status; app.Description = list1[i].Description; app.ApplicationTime = list1[i].ApplicationTime; app.ApplicationTime = list1[i].ApplicationTime; app.AppointmentAdd = list1[i].AppointmentAdd; if (app.PatientID != "") { //list[i].imageURL = Ps.DoctorInfoDetail.GetValue(pclsCache.CacheConnectionObject, app.PatientID, "Contact", "Contact001_4", 1); app.imageURL = new UsersMethod().GetPatientValue(pclsCache, app.PatientID, "Contact", "Contact001_4", 1);//病人照片 UserBasicInfo ret = new UserBasicInfo(); ret = new UsersMethod().GetUserBasicInfo(pclsCache, app.PatientID); if (ret != null) { app.name = ret.UserName; app.age = ret.Age; //app.age = Convert.ToString(Ps.BasicInfo.GetAgeByBirthDay(pclsCache.CacheConnectionObject, Convert.ToInt32(ret.Birthday))); app.sex = ret.Gender; } } list.Add(app); } } return list; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "UserMethod.GetAppoitmentPatientList", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return null; } finally { pclsCache.DisConnect(); } }