Exemplo n.º 1
0
        public int Add(OldMedGuideModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" INSERT INTO tbl_oldmedguide( ");
            builder.Append(" IDCardNo,GuideDate,Doctor,IdentifyResult,IdentifyDes,EmotionAdjust,DietAdjust,LiveAdjust,Sport,Collateral,Attention,OtherGuide,Type,OutKey) ");
            builder.Append(" VALUES (");
            builder.Append(" @IDCardNo,@GuideDate,@Doctor,@IdentifyResult,@IdentifyDes,@EmotionAdjust,@DietAdjust,@LiveAdjust,@Sport,@Collateral,@Attention,@OtherGuide,@Type,@OutKey) ");
            builder.Append(";SELECT @@IDENTITY");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@GuideDate", MySqlDbType.Date),
                new MySqlParameter("@Doctor", MySqlDbType.String, 50),
                new MySqlParameter("@IdentifyResult", MySqlDbType.String, 10),
                new MySqlParameter("@IdentifyDes", MySqlDbType.String, 1000),
                new MySqlParameter("@EmotionAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@DietAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@LiveAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@Sport", MySqlDbType.String, 1000),
                new MySqlParameter("@Collateral", MySqlDbType.String, 1000),
                new MySqlParameter("@Attention", MySqlDbType.String, 1000),
                new MySqlParameter("@OtherGuide", MySqlDbType.String, 1000),
                new MySqlParameter("@Type", MySqlDbType.Int32, 4),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4)
            };

            cmdParms[0].Value  = model.IDCardNo;
            cmdParms[1].Value  = model.GuideDate;
            cmdParms[2].Value  = model.Doctor;
            cmdParms[3].Value  = model.IdentifyResult;
            cmdParms[4].Value  = model.IdentifyDes;
            cmdParms[5].Value  = model.EmotionAdjust;
            cmdParms[6].Value  = model.DietAdjust;
            cmdParms[7].Value  = model.LiveAdjust;
            cmdParms[8].Value  = model.Sport;
            cmdParms[9].Value  = model.Collateral;
            cmdParms[10].Value = model.Attention;
            cmdParms[11].Value = model.OtherGuide;
            cmdParms[12].Value = model.Type;
            cmdParms[13].Value = model.OutKey;

            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }

            return(Convert.ToInt32(single));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 中医体质同步存入指导意见
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateByUpload(OldMedGuideModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("UPDATE tbl_oldmedguide SET ");
            builder.Append("Doctor=@Doctor,");
            builder.Append("IdentifyResult=@IdentifyResult,");
            builder.Append("IdentifyDes=@IdentifyDes,");
            builder.Append("EmotionAdjust=@EmotionAdjust,");
            builder.Append("DietAdjust=@DietAdjust,");
            builder.Append("LiveAdjust=@LiveAdjust,");
            builder.Append("Sport=@Sport,");
            builder.Append("Collateral=@Collateral,");
            builder.Append("Attention=@Attention, ");
            builder.Append("OtherGuide=@OtherGuide ");
            builder.Append(" WHERE OutKey=@OutKey");
            builder.Append(" AND Type=@Type");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@Doctor", MySqlDbType.String, 50),
                new MySqlParameter("@IdentifyResult", MySqlDbType.String, 10),
                new MySqlParameter("@IdentifyDes", MySqlDbType.String, 1000),
                new MySqlParameter("@EmotionAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@DietAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@LiveAdjust", MySqlDbType.String, 1000),
                new MySqlParameter("@Sport", MySqlDbType.String, 1000),
                new MySqlParameter("@Collateral", MySqlDbType.String, 1000),
                new MySqlParameter("@Attention", MySqlDbType.String, 1000),
                new MySqlParameter("@OtherGuide", MySqlDbType.String, 1000),
                new MySqlParameter("@OutKey", MySqlDbType.Int32),
                new MySqlParameter("@Type", MySqlDbType.Int32)
            };

            cmdParms[0].Value  = model.Doctor;
            cmdParms[1].Value  = model.IdentifyResult;
            cmdParms[2].Value  = model.IdentifyDes;
            cmdParms[3].Value  = model.EmotionAdjust;
            cmdParms[4].Value  = model.DietAdjust;
            cmdParms[5].Value  = model.LiveAdjust;
            cmdParms[6].Value  = model.Sport;
            cmdParms[7].Value  = model.Collateral;
            cmdParms[8].Value  = model.Attention;
            cmdParms[9].Value  = model.OtherGuide;
            cmdParms[10].Value = model.OutKey;
            cmdParms[11].Value = model.Type;

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Exemplo n.º 3
0
 public int Add(OldMedGuideModel model)
 {
     return(this.dal.Add(model));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 中医体质同步存入指导意见
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateByUpload(OldMedGuideModel model)
 {
     return(this.dal.UpdateByUpload(model));
 }
Exemplo n.º 5
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;
            }
        }