public void InitEveryThing() { this.elderSelf = new OlderSelfCareabilityBLL().GetModelID(this.IDPerson); if (this.elderSelf == null) { return; } else { this.elderSelf.LastUpDateBy = new decimal?(ConfigHelper.GetNodeDec("doctor")); this.elderSelf.LastUpDateDate = new DateTime?(DateTime.Today); } this.cp_elderSelf = GlbTools.DeepCopy(this.elderSelf); if (string.IsNullOrEmpty(this.elderSelf.FollowUpDoctor)) { this.elderSelf.FollowUpDoctor = ConfigHelper.GetNode("doctorName"); } this.tbDoctor.DataBindings.Add("TEXT", this.elderSelf, "FollowUpDoctor", false, DataSourceUpdateMode.OnPropertyChanged); if (string.IsNullOrEmpty(this.elderSelf.NextVisitAim)) { this.elderSelf.NextVisitAim = "低盐饮食,预防高血压"; } this.txbNextVisitAim.DataBindings.Add("TEXT", this.elderSelf, "NextVisitAim", false, DataSourceUpdateMode.OnPropertyChanged); this.CbSimpleBind(this.cbDinner, "DINE"); this.CbSimpleBind(this.cbGromming, "Groming"); this.CbSimpleBind(this.cbDressing, "Dressing"); this.CbSimpleBind(this.cbTolet, "Tolet"); this.CbSimpleBind(this.cbAct, "Activity"); if (this.elderSelf.TotalScore.HasValue) { this.tbTotal.Text = this.elderSelf.TotalScore.Value.ToString(); } if (this.elderSelf.FollowUpDate.HasValue) { this.dtpCheckdate.Value = this.elderSelf.FollowUpDate.Value; } else { this.dtpCheckdate.Value = DateTime.Now; } if (this.elderSelf.NextFollowUpDate.HasValue) { this.dtpNextF.Value = this.elderSelf.NextFollowUpDate.Value; } else { this.dtpNextF.Value = DateTime.Today.AddYears(1); } MustChoose(); this.EveryThingIsOk = true; }
/// <summary> /// 数据同步自理能力存档 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateByUpload(OlderSelfCareabilityModel model) { StringBuilder builder = new StringBuilder(); builder.Append("UPDATE OLDER_SELFCAREABILITY SET "); builder.Append("Dine=@Dine"); builder.Append(",Groming=@Groming"); builder.Append(",Dressing=@Dressing"); builder.Append(",Tolet=@Tolet"); builder.Append(",Activity=@Activity"); builder.Append(",TotalScore=@TotalScore"); builder.Append(",LastUpDateBy=@LastUpDateBy"); builder.Append(",LastUpDateDate=@LastUpDateDate"); builder.Append(" WHERE FollowUpDate=@FollowUpDate"); builder.Append(" AND IDCardNo=@IDCardNo"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@Dine", MySqlDbType.Decimal), new MySqlParameter("@Groming", MySqlDbType.Decimal), new MySqlParameter("@Dressing", MySqlDbType.Decimal), new MySqlParameter("@Tolet", MySqlDbType.Decimal), new MySqlParameter("@Activity", MySqlDbType.Decimal), new MySqlParameter("@TotalScore", MySqlDbType.Decimal), new MySqlParameter("@FollowUpDate", MySqlDbType.Date), new MySqlParameter("@LastUpDateBy", MySqlDbType.Decimal), new MySqlParameter("@LastUpDateDate", MySqlDbType.Date) }; cmdParms[0].Value = model.IDCardNo; cmdParms[1].Value = model.Dine; cmdParms[2].Value = model.Groming; cmdParms[3].Value = model.Dressing; cmdParms[4].Value = model.Tolet; cmdParms[5].Value = model.Activity; cmdParms[6].Value = model.TotalScore; cmdParms[7].Value = model.FollowUpDate; cmdParms[8].Value = model.LastUpDateBy; cmdParms[9].Value = model.LastUpDateDate; return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0); }
/// <summary> /// 老年人 /// </summary> /// <param name="IDCardNo"></param> /// <param name="CheckDate"></param> /// <param name="VersionNo"></param> public void SaveOld(string IDCardNo, DateTime CheckDate, string VersionNo) { try { DataView dv = dsRequire.DefaultView; // 获取最后一次随访数据 OlderSelfCareabilityModel oldSelfOldModel = OldSelfBLL.GetMaxModel(IDCardNo, ""); if (oldSelfOldModel == null) { oldSelfOldModel = new OlderSelfCareabilityModel(); } OlderSelfCareabilityModel oldSelfNewModel = new OlderSelfCareabilityModel(); #region 自理能力 dv.RowFilter = null; dv.RowFilter = "TabName='老年人随访' AND Comment='健康评估' AND (IsSetValue='是' OR IsSetValue='预设上次随访') "; DataTable dt = dv.ToTable(); oldSelfNewModel = EntityAssignment <OlderSelfCareabilityModel>(oldSelfOldModel, oldSelfNewModel, dt); oldSelfNewModel.IDCardNo = IDCardNo; oldSelfNewModel.FollowUpDate = CheckDate; oldSelfNewModel.FollowUpDoctor = ConfigHelper.GetNode("doctorName"); oldSelfNewModel.NextFollowUpDate = CheckDate.AddMonths(3); oldSelfNewModel.CreatedBy = ConfigHelper.GetNodeDec("doctor"); oldSelfNewModel.CreatedDate = DateTime.Now; oldSelfNewModel.LastUpDateBy = ConfigHelper.GetNodeDec("doctor"); oldSelfNewModel.LastUpDateDate = DateTime.Now; #endregion #region 中医体质及体质结果 MedicineModel oldMedicineOldModel = new MedicineModel(); // 如果为3.0版本,则中医与自理能力都是独立功能,获取最后一次随访数据 if (VersionNo.Contains("3.0")) { oldMedicineOldModel = OldMedicineCnBLL.GetAllModel(IDCardNo); } else { oldMedicineOldModel = OldMedicineCnBLL.GetModelByKey(oldSelfOldModel.ID); } MedicineModel oldMedicineNewModel = new MedicineModel(); if (oldMedicineOldModel == null) { oldMedicineOldModel = new MedicineModel(); } // 中医体质预设上次随访内容 oldMedicineNewModel = EntityAssignment <MedicineModel>(oldMedicineOldModel, oldMedicineNewModel); #endregion #region 保存默认值 // 自理能力存档 int id = OldSelfBLL.Add(oldSelfNewModel, VersionNo); if (id > 0) { // 中医体质 oldMedicineNewModel.IDCardNo = IDCardNo; oldMedicineNewModel.OutKey = id; oldMedicineNewModel.RecordDate = CheckDate.ToString("yyyy-MM-dd"); oldMedicineNewModel.FollowUpDoctor = ConfigHelper.GetNode("doctorName"); oldMedicineNewModel.NextFollowUpDate = CheckDate.AddMonths(3); oldMedicineNewModel.CreatedBy = ConfigHelper.GetNodeDec("doctor"); oldMedicineNewModel.CreatedDate = DateTime.Now; oldMedicineNewModel.LastUpdateBy = ConfigHelper.GetNodeDec("doctor"); oldMedicineNewModel.LastUpdateDate = DateTime.Now; int medicineID = OldMedicineCnBLL.Add(oldMedicineNewModel, VersionNo); // 中医体质结果 oldMedicineNewModel.MedicineID = medicineID; OldMedicineResultBLL.Add(oldMedicineNewModel, VersionNo); // 中医指导建议 OldMedGuideModel GuideModeTemp = new OldMedGuideModel(); string strTzlx = ""; GuideModeTemp.Type = 0; GuideModeTemp.OutKey = Convert.ToInt32(id); GuideModeTemp.Doctor = ConfigHelper.GetNode("doctorName"); GuideModeTemp.GuideDate = CheckDate; GuideModeTemp.IDCardNo = IDCardNo; #region 根据体质对应体质类型及见意 if (oldMedicineNewModel.Mild == "1" || oldMedicineNewModel.Mild == "2") { strTzlx = "平和质"; GuideModeTemp.IdentifyResult = "1"; } else if (oldMedicineNewModel.Faint == "1" || oldMedicineNewModel.Faint == "2") { strTzlx = "气虚质"; GuideModeTemp.IdentifyResult = "2"; } else if (oldMedicineNewModel.Yang == "1" || oldMedicineNewModel.Yang == "2") { strTzlx = "阳虚质"; GuideModeTemp.IdentifyResult = "3"; } else if (oldMedicineNewModel.Yin == "1" || oldMedicineNewModel.Yin == "2") { strTzlx = "阴虚质"; GuideModeTemp.IdentifyResult = "4"; } else if (oldMedicineNewModel.PhlegmDamp == "1" || oldMedicineNewModel.PhlegmDamp == "2") { strTzlx = "痰湿质"; GuideModeTemp.IdentifyResult = "5"; } else if (oldMedicineNewModel.Muggy == "1" || oldMedicineNewModel.Muggy == "2") { strTzlx = "湿热质"; GuideModeTemp.IdentifyResult = "6"; } else if (oldMedicineNewModel.BloodStasis == "1" || oldMedicineNewModel.BloodStasis == "2") { strTzlx = "血瘀质"; GuideModeTemp.IdentifyResult = "7"; } else if (oldMedicineNewModel.QiConstraint == "1" || oldMedicineNewModel.QiConstraint == "2") { strTzlx = "气郁质"; GuideModeTemp.IdentifyResult = "8"; } else if (oldMedicineNewModel.Characteristic == "1" || oldMedicineNewModel.Characteristic == "2") { strTzlx = "特兼质"; GuideModeTemp.IdentifyResult = "9"; } DataTable dtOldCN = new DataTable(); if (File.Exists(Application.StartupPath + "\\OldCN.xml")) { DataSet ds = new DataSet(); ds.ReadXml(Application.StartupPath + "\\OldCN.xml"); dtOldCN = ds.Tables[0]; } if (!string.IsNullOrEmpty(strTzlx) && dtOldCN != null) { foreach (DataRow item in dtOldCN.Rows) { if (item["name"].ToString() == strTzlx) { GuideModeTemp.EmotionAdjust = item["qzts"].ToString().Trim(); GuideModeTemp.DietAdjust = item["ysty"].ToString().Trim(); GuideModeTemp.LiveAdjust = item["qjts"].ToString().Trim(); GuideModeTemp.Sport = item["ydbj"].ToString().Trim(); GuideModeTemp.Collateral = item["jlbj"].ToString().Trim(); GuideModeTemp.Attention = item["zysx"].ToString().Trim(); GuideModeTemp.OtherGuide = item["qtzd"].ToString().Trim(); GuideModeTemp.IdentifyDes = item["bsjgms"].ToString().Trim(); break; } } // 随访修改中医体质意见 if (!OldMedGuideBLL.UpdateByUpload(GuideModeTemp)) { // 修改不到则新增 OldMedGuideBLL.Add(GuideModeTemp); } } #endregion } #endregion } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); throw ex; } }
/// <summary> /// 数据同步自理能力存档 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateByUpload(OlderSelfCareabilityModel model) { return(this.dal.UpdateByUpload(model)); }
public int Add(OlderSelfCareabilityModel model, string Version = "V2.0") { return(this.dal.Add(model, Version)); }
public int Add(OlderSelfCareabilityModel model) { return(this.dal.Add(model)); }
public void SetCnResult(string IDCardNo) { if (string.IsNullOrEmpty(Convert.ToString(RecordsManageMentModel.BMI)) && string.IsNullOrEmpty(Convert.ToString(RecordsManageMentModel.Waistline))) { return; } string strYear = DateTime.Now.Year.ToString(); string strOldWhere = string.Format("IDCardNo='{0}' AND left(FollowUpDate,4) = '{1}' order by FollowUpDate Desc limit 0,1 ", IDCardNo, strYear); List <OlderSelfCareabilityModel> OlderList = new List <OlderSelfCareabilityModel>(); OlderList = new OlderSelfCareabilityBLL().GetModelList(strOldWhere); if (OlderList.Count == 0) { return; } OlderSelfCareabilityModel olderModel = OlderList[0]; oldMedCn = olderMedicineCnBLL.GetModel(olderModel.IDCardNo, olderModel.ID); oldMedResult = olderMedicineResultBLL.GetModel(olderModel.IDCardNo, olderModel.ID); if (oldMedCn == null || oldMedResult == null) { return; } this.judge_qixu = new ScoreJudge(this.oldMedResult, "FaintScore", "Faint"); this.judge_yang = new ScoreJudge(this.oldMedResult, "YangsCore", "Yang"); this.judge_yin = new ScoreJudge(this.oldMedResult, "YinScore", "Yin"); this.judge_tanshi = new ScoreJudge(this.oldMedResult, "PhlegmdampScore", "PhlegmDamp"); this.judge_shire = new ScoreJudge(this.oldMedResult, "MuggyScore", "Muggy"); this.judge_xueyu = new ScoreJudge(this.oldMedResult, "BloodStasisScore", "BloodStasis"); this.judge_qiyu = new ScoreJudge(this.oldMedResult, "QiConstraintScore", "QiConstraint"); this.judge_tebing = new ScoreJudge(this.oldMedResult, "CharacteristicScore", "Characteristic"); this.judge_tizhiAll = new List <ScoreJudge>(); this.judge_tizhiAll.AddRange((IEnumerable <ScoreJudge>) new ScoreJudge[] { this.judge_qixu, this.judge_yang, this.judge_yin, this.judge_tanshi, this.judge_shire, this.judge_xueyu, this.judge_qiyu, this.judge_tebing }); if (!string.IsNullOrEmpty(Convert.ToString(RecordsManageMentModel.BMI))) { if (Convert.ToDouble(RecordsManageMentModel.BMI) < 24) { oldMedCn.Weight = 1; } else if (Convert.ToDouble(RecordsManageMentModel.BMI) >= 24 && Convert.ToDouble(RecordsManageMentModel.BMI) < 25) { oldMedCn.Weight = 2; } else if (Convert.ToDouble(RecordsManageMentModel.BMI) >= 25 && Convert.ToDouble(RecordsManageMentModel.BMI) < 26) { oldMedCn.Weight = 3; } else if (Convert.ToDouble(RecordsManageMentModel.BMI) >= 26 && Convert.ToDouble(RecordsManageMentModel.BMI) < 28) { oldMedCn.Weight = 4; } else if (Convert.ToDouble(RecordsManageMentModel.BMI) >= 28) { oldMedCn.Weight = 5; } } if (!string.IsNullOrEmpty(Convert.ToString(RecordsManageMentModel.Waistline))) { if (Convert.ToDouble(RecordsManageMentModel.Waistline) < 80) { oldMedCn.Abdomen = 1; } else if (Convert.ToDouble(RecordsManageMentModel.Waistline) >= 80 && Convert.ToDouble(RecordsManageMentModel.Waistline) <= 85) { oldMedCn.Abdomen = 2; } else if (Convert.ToDouble(RecordsManageMentModel.Waistline) >= 86 && Convert.ToDouble(RecordsManageMentModel.Waistline) <= 90) { oldMedCn.Abdomen = 3; } else if (Convert.ToDouble(RecordsManageMentModel.Waistline) >= 91 && Convert.ToDouble(RecordsManageMentModel.Waistline) <= 105) { oldMedCn.Abdomen = 4; } else if (Convert.ToDouble(RecordsManageMentModel.Waistline) > 105) { oldMedCn.Abdomen = 5; } } //this.xmlDs = new DataSet(); //this.xmlDs.ReadXml(Application.StartupPath + @"\old_med.xml"); //GlbTools.DatatableFillModel<OlderMedicineCnModel>(oldMedCn, this.xmlDs.Tables[0]); oldMedResult.FaintScore = new decimal?(this.GetScore(oldMedCn.Tired, oldMedCn.Breath, oldMedCn.Voice, oldMedCn.Influenza)); oldMedResult.YangsCore = new decimal?(this.GetScore(oldMedCn.FootHand, oldMedCn.Stomach, oldMedCn.Cold, oldMedCn.Coolfood)); oldMedResult.YinScore = new decimal?(this.GetScore(oldMedCn.Eye, oldMedCn.Mouth, oldMedCn.Thirsty, oldMedCn.Defecatedry)); oldMedResult.PhlegmdampScore = new decimal?(this.GetScore(oldMedCn.Weight, oldMedCn.Snore, oldMedCn.Abdomen, oldMedCn.Tongue)); oldMedResult.MuggyScore = new decimal?(this.GetScore(oldMedCn.Greasy, oldMedCn.Eczema, oldMedCn.Smell, oldMedCn.Defecate)); oldMedResult.BloodStasisScore = new decimal?(this.GetScore(oldMedCn.Skin, oldMedCn.Arms, oldMedCn.Spot, oldMedCn.Vein)); oldMedResult.QiConstraintScore = new decimal?(this.GetScore(oldMedCn.Emotion, oldMedCn.Spirit, oldMedCn.Alone, oldMedCn.Fear)); oldMedResult.CharacteristicScore = new decimal?(this.GetScore(oldMedCn.Nasal, oldMedCn.Allergy, oldMedCn.Urticaria, oldMedCn.Scratch)); oldMedResult.MildScore = new decimal?(this.GetPinghe(oldMedCn.Energy, oldMedCn.Tired, oldMedCn.Voice, oldMedCn.Emotion, oldMedCn.Cold)); this.UpdateJudge(); //修改数据 olderMedicineCnBLL.Update(this.oldMedCn); olderMedicineResultBLL.Update(this.oldMedResult); }
public bool Update(OlderSelfCareabilityModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update OLDER_SELFCAREABILITY set "); builder.Append("CustomerID=@CustomerID,"); builder.Append("RecordID=@RecordID,"); builder.Append("IDCardNo=@IDCardNo,"); builder.Append("Dine=@Dine,"); builder.Append("Groming=@Groming,"); builder.Append("Dressing=@Dressing,"); builder.Append("Tolet=@Tolet,"); builder.Append("Activity=@Activity,"); builder.Append("TotalScore=@TotalScore,"); builder.Append("FollowUpDate=@FollowUpDate,"); builder.Append("FollowUpDoctor=@FollowUpDoctor,"); builder.Append("NextfollowUpDate=@NextfollowUpDate,"); builder.Append("CreatedBy=@CreatedBy,"); builder.Append("CreatedDate=@CreatedDate,"); builder.Append("LastUpDateBy=@LastUpDateBy,"); builder.Append("LastUpDateDate=@LastUpDateDate,"); //新增字段 builder.Append("NextVisitAim=@NextVisitAim "); builder.Append(" where ID=@ID"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@CustomerID", MySqlDbType.String, 0x12), new MySqlParameter("@RecordID", MySqlDbType.String, 0x11), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@Dine", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Groming", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Dressing", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Tolet", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Activity", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@TotalScore", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@FollowUpDate", MySqlDbType.Date), new MySqlParameter("@FollowUpDoctor", MySqlDbType.String, 30), new MySqlParameter("@NextfollowUpDate", MySqlDbType.Date), new MySqlParameter("@CreatedBy", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@CreatedDate", MySqlDbType.Date), new MySqlParameter("@LastUpDateBy", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@LastUpDateDate", MySqlDbType.Date), //新增字段 new MySqlParameter("@NextVisitAim", MySqlDbType.String, 100), new MySqlParameter("@ID", MySqlDbType.Int32, 8) }; cmdParms[0].Value = model.CustomerID; cmdParms[1].Value = model.RecordID; cmdParms[2].Value = model.IDCardNo; cmdParms[3].Value = model.Dine; cmdParms[4].Value = model.Groming; cmdParms[5].Value = model.Dressing; cmdParms[6].Value = model.Tolet; cmdParms[7].Value = model.Activity; cmdParms[8].Value = model.TotalScore; cmdParms[9].Value = model.FollowUpDate; cmdParms[10].Value = model.FollowUpDoctor; cmdParms[11].Value = model.NextFollowUpDate; cmdParms[12].Value = model.CreatedBy; cmdParms[13].Value = model.CreatedDate; cmdParms[14].Value = model.LastUpDateBy; cmdParms[15].Value = model.LastUpDateDate; //新增字段 cmdParms[16].Value = model.NextVisitAim; cmdParms[17].Value = model.ID; return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public int Add(OlderSelfCareabilityModel model) { StringBuilder builder = new StringBuilder(); builder.Append("INSERT INTO OLDER_SELFCAREABILITY("); builder.Append("CustomerID,RecordID,IDCardNo,Dine,Groming,Dressing,Tolet,Activity,TotalScore,FollowUpDate,"); builder.Append("FollowUpDoctor,NextfollowUpDate,CreatedBy,CreatedDate,LastUpDateBy,LastUpDateDate,NextVisitAim)"); builder.Append(" VALUES ("); builder.Append("@CustomerID,@RecordID,@IDCardNo,@Dine,@Groming,@Dressing,@Tolet,@Activity,@TotalScore,"); builder.Append("@FollowUpDate,@FollowUpDoctor,@NextfollowUpDate,@CreatedBy,@CreatedDate,"); builder.Append("@LastUpDateBy,@LastUpDateDate,@NextVisitAim) "); builder.Append(";SELECT @@IDENTITY"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@CustomerID", MySqlDbType.String, 0x12), new MySqlParameter("@RecordID", MySqlDbType.String, 0x11), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@Dine", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Groming", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Dressing", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Tolet", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@Activity", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@TotalScore", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@FollowUpDate", MySqlDbType.Date), new MySqlParameter("@FollowUpDoctor", MySqlDbType.String, 30), new MySqlParameter("@NextfollowUpDate", MySqlDbType.Date), new MySqlParameter("@CreatedBy", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@CreatedDate", MySqlDbType.Date), new MySqlParameter("@LastUpDateBy", MySqlDbType.Decimal, 0x7fffffff), new MySqlParameter("@LastUpDateDate", MySqlDbType.Date), //新增字段 new MySqlParameter("@NextVisitAim", MySqlDbType.String, 100) }; cmdParms[0].Value = model.CustomerID; cmdParms[1].Value = model.RecordID; cmdParms[2].Value = model.IDCardNo; cmdParms[3].Value = model.Dine; cmdParms[4].Value = model.Groming; cmdParms[5].Value = model.Dressing; cmdParms[6].Value = model.Tolet; cmdParms[7].Value = model.Activity; cmdParms[8].Value = model.TotalScore; cmdParms[9].Value = model.FollowUpDate; cmdParms[10].Value = model.FollowUpDoctor; cmdParms[11].Value = model.NextFollowUpDate; cmdParms[12].Value = model.CreatedBy; cmdParms[13].Value = model.CreatedDate; cmdParms[14].Value = model.LastUpDateBy; cmdParms[15].Value = model.LastUpDateDate; //新增字段 cmdParms[16].Value = model.NextVisitAim; object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms); if (single == null) { return(0); } return(Convert.ToInt32(single)); }