/// <summary>
        /// 更新终端资料库中的查体资料--内科,外科
        /// </summary>
        /// <param name="model"></param>
        /// <param name="RecordDate"></param>
        /// <returns></returns>
        public void InsertByChestX(RecordsAssistCheckModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"
                            INSERT INTO
                                ARCHIVE_ASSISTCHECK
                            (
                                PhysicalID
                                ,IDCardNo
                                ,CHESTX
                                ,CHESTXEx
                                ,OutKey
                            )
                            VALUES
                             (
                                @PhysicalID
                                ,@IDCardNo
                                ,@CHESTX
                                ,@CHESTXEx
                                ,@OutKey
                            ) ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CHESTX", model.CHESTX),
                new MySqlParameter("@CHESTXEx", model.CHESTXEx),
                new MySqlParameter("@OutKey", model.OutKey),
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@PhysicalID", model.PhysicalID)
            };

            MySQLHelper.ExecuteSql(builder.ToString(), cmdParms);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 血糖同步
        /// </summary>
        /// <param name="model"></param>
        /// <param name="checkDate"></param>
        /// <returns></returns>
        public bool UpdateByMiniSTPad(RecordsAssistCheckModel model, string checkDate)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"UPDATE 
                                    ARCHIVE_ASSISTCHECK  D
                             SET 
                                    FPGL=@FPGL
                               
                             WHERE
                                    EXISTS
                                    (
                                        SELECT 
                                            ID 
                                        FROM
                                        ARCHIVE_CUSTOMERBASEINFO M
                                        WHERE M.ID = D.OutKey
                                        AND M.IDCardNo = @IDCardNo
                                        AND M.CheckDate = @CheckDate
                                    )
                            ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@CheckDate", checkDate),
                new MySqlParameter("@FPGL", model.FPGL)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新终端资料库中的查体资料--X光
        /// </summary>
        /// <param name="model"></param>
        /// <param name="RecordDate"></param>
        /// <returns></returns>
        public bool UpdateByChestX(RecordsAssistCheckModel model, string RecordDate)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"
                            UPDATE 
                                ARCHIVE_ASSISTCHECK D
                            SET 
                                CHESTX = @CHESTX 
                                ,CHESTXEx = @CHESTXEx
                            WHERE 
                                EXISTS
                                (
                                    SELECT 
                                        D.ID 
                                    FROM
                                        ARCHIVE_CUSTOMERBASEINFO M 
                                    WHERE  
                                        IFNULL(M.IsDel,'')!='Y'
                                        AND M.ID= D.OUTkey
                                        AND M.IDCardNo = @IDCardNo
                                        AND M.CheckDate = @CheckDate
                                );  ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CHESTX", model.CHESTX),
                new MySqlParameter("@CHESTXEx", model.CHESTXEx),
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@CheckDate", RecordDate)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 尿常规同步
        /// </summary>
        /// <param name="model"></param>
        /// <param name="checkDate"></param>
        /// <returns></returns>
        public bool UpdateByMiniPad(RecordsAssistCheckModel model, string checkDate)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"UPDATE 
                                         ARCHIVE_ASSISTCHECK  D
                                       SET 
                                         BLD=@BLD
                                        ,KET=@KET
                                        ,GLU=@GLU
                                        ,PRO=@PRO ");

            if (!string.IsNullOrEmpty(model.UrineOther))
            {
                builder.Append(",UrineOther=@UrineOther");
            }
            else if (!string.IsNullOrEmpty(model.UrineOther) && model.UrineOther.Equals("陕西"))
            {
                builder.Append(",UrineOther=REPLACE(UrineOther,'未配合检查','')");
            }

            builder.Append(@" WHERE
                                    EXISTS
                                    (
                                        SELECT 
                                            ID 
                                        FROM
                                        ARCHIVE_CUSTOMERBASEINFO M
                                        WHERE M.ID = D.OutKey
                                        AND M.IDCardNo = @IDCardNo
                                        AND M.CheckDate = @CheckDate
                                    )
                            ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@CheckDate", checkDate),
                new MySqlParameter("@BLD", model.BLD),
                new MySqlParameter("@KET", model.KET),
                new MySqlParameter("@GLU", model.GLU),
                new MySqlParameter("@PRO", model.PRO),
                new MySqlParameter("@UrineOther", model.UrineOther)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
        /// <summary>
        /// 更新终端资料库中的查体资料--X光
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateByChestX(RecordsAssistCheckModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"
                            UPDATE 
                                ARCHIVE_ASSISTCHECK
                            SET 
                                CHESTX = @CHESTX 
                                ,CHESTXEx = @CHESTXEx
                            WHERE 
                              OutKey=@OutKey  ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CHESTX", model.CHESTX),
                new MySqlParameter("@CHESTXEx", model.CHESTXEx),
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@OutKey", model.OutKey)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新终端资料库中的查体资料--X光
        /// </summary>
        /// <param name="model"></param>
        /// <param name="RecordDate"></param>
        /// <returns></returns>
        public bool UpdateByChestX(RecordsAssistCheckModel model, string RecordDate)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"
                            UPDATE 
                                ARCHIVE_ASSISTCHECK D
                            SET 
                                CHESTX = @CHESTX 
                                ,CHESTXEx = @CHESTXEx
                            WHERE 
                                D.OUTKEY=
                                (
                                    SELECT 
                                        M.ID 
                                    FROM
                                        ARCHIVE_CUSTOMERBASEINFO M 
                                    WHERE  
                                        IFNULL(M.IsDel,'')!='Y'
                                        AND M.IDCardNo =@IDCardNo 
                                        AND LEFT(M.CheckDate,4) = @CheckDate 
                                        order by M.CheckDate DESC LIMIT 0,1 
                                );  ");

            if (Convert.ToString(RecordDate).Length > 3)
            {
                RecordDate = RecordDate.Substring(0, 4);
            }

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CHESTX", model.CHESTX),
                new MySqlParameter("@CHESTXEx", model.CHESTXEx),
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@CheckDate", RecordDate)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 新尿常规同步
 /// </summary>
 /// <param name="model"></param>
 /// <param name="barCode"></param>
 /// <returns></returns>
 public bool Update(RecordsAssistCheckModel model, string barCode)
 {
     return(this.dal.Update(model, barCode));
 }
Ejemplo n.º 8
0
 public bool UpdateByMiniPad(RecordsAssistCheckModel model, string checkDate)
 {
     return(this.dal.UpdateByMiniPad(model, checkDate));
 }
Ejemplo n.º 9
0
 public int Add(RecordsAssistCheckModel model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// B超正常异常信息更新到健康体检中
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateBC(RecordsAssistCheckModel model)
 {
     return(this.dal.UpdateBC(model));
 }
Ejemplo n.º 11
0
        private void btndataupload_Click(object sender, EventArgs e)
        {
            string strwhere = "";

            if (this.ckbcheckdate.Checked)
            {
                strwhere = string.Format(" CheckDate BETWEEN '{0}' and '{1}' ",
                                         this.dtpstart.Value.Date.ToString("yyyy-MM-dd"), this.dtpend.Value.Date.ToString("yyyy-MM-dd"));
            }

            DataSet customds = new RecordsCustomerBaseInfoBLL().GetList(strwhere);

            int amount = 0;

            progressBar1.Visible   = true;
            progressBar1.Minimum   = 0;
            progressBar1.Maximum   = customds.Tables[0].Rows.Count;
            progressBar1.BackColor = Color.Green;
            labCountnum.Text       = customds.Tables[0].Rows.Count.ToString();

            foreach (DataRow row in customds.Tables[0].Rows)
            {
                int OutKey = Convert.ToInt32(row["ID"].ToString());

                if (string.IsNullOrEmpty(row["IDCardNo"].ToString()))
                {
                    continue;
                }

                // 基本信息
                RecordsBaseInfoModel Model = new RecordsBaseInfoBLL().GetModel(row["IDCardNo"].ToString());
                if (Model == null)
                {
                    Model = new RecordsBaseInfoModel();
                }

                // 一般状况
                RecordsGeneralConditionModel generalConditionModel = new RecordsGeneralConditionBLL().GetModelByOutKey(OutKey);
                if (generalConditionModel == null)
                {
                    generalConditionModel = new RecordsGeneralConditionModel();
                }

                ChronicDiadetesVisitModel diabetesModel = new ChronicDiadetesVisitModel();

                diabetesModel.IDCardNo     = row["IDCardNo"].ToString();
                diabetesModel.Hypertension = generalConditionModel.RightHeight;
                diabetesModel.Hypotension  = generalConditionModel.RightPre;
                diabetesModel.BMI          = generalConditionModel.BMI;
                diabetesModel.Weight       = generalConditionModel.Weight;
                diabetesModel.Hight        = generalConditionModel.Height;

                if (diabetesModel.BMI != null)
                {
                    if (diabetesModel.BMI >= 24)
                    {
                        diabetesModel.TargetWeight = diabetesModel.Weight - 5;
                    }
                }

                // 生活方式
                RecordsLifeStyleModel lifeModel = new RecordsLifeStyleBLL().GetModelByOutKey(OutKey);
                if (lifeModel == null)
                {
                    lifeModel = new RecordsLifeStyleModel();
                }

                if (lifeModel.SmokeCondition == "3")
                {
                    diabetesModel.DailySmokeNum = lifeModel.SmokeDayNum;
                }
                else
                {
                    diabetesModel.DailySmokeNum = 0;
                }

                if (lifeModel.DrinkRate == "2" || lifeModel.DrinkRate == "3" || lifeModel.DrinkRate == "4")
                {
                    diabetesModel.DailyDrinkNum = lifeModel.DayDrinkVolume;
                }
                else
                {
                    diabetesModel.DailyDrinkNum = 0;
                }

                diabetesModel.DailySmokeNumTarget      = 0;
                diabetesModel.DailyDrinkNumTarget      = 0;
                diabetesModel.SportTimePerWeekTarget   = 7;
                diabetesModel.SportPerMinuteTimeTarget = 60;

                // 辅助检查
                RecordsAssistCheckModel AssistCheck = new RecordsAssistCheckBLL().GetModelByOutKey(OutKey);
                if (AssistCheck == null)
                {
                    AssistCheck = new RecordsAssistCheckModel();
                }

                diabetesModel.FPG   = AssistCheck.FPGL;
                diabetesModel.HbAlc = AssistCheck.HBALC;

                new ChronicDiadetesVisitBLL().UpdateDate(diabetesModel);

                ChronicHypertensionVisitModel hypertensionModel = new ChronicHypertensionVisitModel();
                hypertensionModel.Hypertension = generalConditionModel.RightHeight;
                hypertensionModel.Hypotension  = generalConditionModel.RightPre;
                hypertensionModel.BMI          = generalConditionModel.BMI;
                hypertensionModel.Weight       = generalConditionModel.Weight;
                hypertensionModel.Hight        = generalConditionModel.Height;

                if (hypertensionModel.BMI != null)
                {
                    if (hypertensionModel.BMI >= 24)
                    {
                        hypertensionModel.WeightTarGet = hypertensionModel.Weight - 5;
                    }
                }
                if (AssistCheck.FPGL != null)
                {
                    hypertensionModel.AssistantExam = $"空腹血糖:{AssistCheck.FPGL}mmol/L";
                }

                // 查体
                RecordsPhysicalExamModel physicalModel = new RecordsPhysicalExamBLL().GetModelByOutKey(OutKey);
                if (physicalModel == null)
                {
                    physicalModel = new RecordsPhysicalExamModel();
                }

                decimal dd = 0;
                if (!string.IsNullOrEmpty(physicalModel.HeartRate))
                {
                    if (decimal.TryParse(physicalModel.HeartRate, out dd))
                    {
                        hypertensionModel.HeartRate = dd;
                    }
                }

                if (lifeModel.SmokeCondition == "3")
                {
                    hypertensionModel.DailySmokeNum = lifeModel.SmokeDayNum;
                }
                else
                {
                    hypertensionModel.DailySmokeNum = 0;
                }

                if (lifeModel.DrinkRate == "2" || lifeModel.DrinkRate == "3" || lifeModel.DrinkRate == "4")
                {
                    hypertensionModel.DailyDrinkNum = lifeModel.DayDrinkVolume;
                }
                else
                {
                    hypertensionModel.DailyDrinkNum = 0;
                }

                hypertensionModel.DailySmokeNumTarget       = 0;
                hypertensionModel.DailyDrinkNumTarget       = 0;
                hypertensionModel.SportTimeSperWeekTarget   = 7;
                hypertensionModel.SportPerMinutesTimeTarget = 60;
                hypertensionModel.IDCardNo = row["IDCardNo"].ToString();

                new ChronicHypertensionVisitBLL().UpdateDate(hypertensionModel);

                amount++;
                labUploadnum.Text  = amount.ToString();
                progressBar1.Value = amount;
            }

            MessageBox.Show("成功匹配:" + amount + "条数据!", "提示");
            progressBar1.Visible = false;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 新增终端资料库中的查体资料--X光
 /// </summary>
 /// <param name="model"></param>
 /// <param name="RecordDate"></param>
 /// <returns></returns>
 public void InsertByChestX(RecordsAssistCheckModel model)
 {
     this.dal.InsertByChestX(model);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 更新终端资料库中的查体资料--X光
 /// </summary>
 /// <param name="model"></param>
 /// <param name="RecordDate"></param>
 /// <returns></returns>
 public bool UpdateByChestX(RecordsAssistCheckModel model, string RecordDate)
 {
     return(this.dal.UpdateByChestX(model, RecordDate));
 }
Ejemplo n.º 14
0
        public bool Update(RecordsAssistCheckModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ARCHIVE_ASSISTCHECK set ");
            builder.Append("PhysicalID=@PhysicalID,");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("HB=@HB,");
            builder.Append("WBC=@WBC,");
            builder.Append("PLT=@PLT,");
            builder.Append("PRO=@PRO,");
            builder.Append("GLU=@GLU,");
            builder.Append("KET=@KET,");
            builder.Append("BLD=@BLD,");
            builder.Append("FPGL=@FPGL,");
            builder.Append("ECG=@ECG,");
            builder.Append("ALBUMIN=@ALBUMIN,");
            builder.Append("FOB=@FOB,");
            builder.Append("HBALC=@HBALC,");
            builder.Append("HBSAG=@HBSAG,");
            builder.Append("SGPT=@SGPT,");
            builder.Append("GOT=@GOT,");
            builder.Append("BP=@BP,");
            builder.Append("TBIL=@TBIL,");
            builder.Append("CB=@CB,");
            builder.Append("SCR=@SCR,");
            builder.Append("BUN=@BUN,");
            builder.Append("PC=@PC,");
            builder.Append("HYPE=@HYPE,");
            builder.Append("TC=@TC,");
            builder.Append("TG=@TG,");
            builder.Append("LowCho=@LowCho,");
            builder.Append("HeiCho=@HeiCho,");
            builder.Append("CHESTX=@CHESTX,");
            builder.Append("BCHAO=@BCHAO,");
            builder.Append("BloodOther=@BloodOther,");
            builder.Append("UrineOther=@UrineOther,");
            builder.Append("Other=@Other,");
            builder.Append("CERVIX=@CERVIX,");
            builder.Append("GT=@GT,");
            builder.Append("ECGEx=@ECGEx,");
            builder.Append("CHESTXEx=@CHESTXEx,");
            builder.Append("BCHAOEx=@BCHAOEx,");
            builder.Append("CERVIXEx=@CERVIXEx,");
            builder.Append("FPGDL=@FPGDL,UA=@UA,HCY=@HCY,BCHAOther=@BCHAOther,BCHAOtherEx=@BCHAOtherEx,");
            builder.Append("BloodType=@BloodType,");
            builder.Append("RH=@RH,");
            builder.Append("TP=@TP,");
            builder.Append("GLB=@GLB,");
            builder.Append("AG=@AG,");
            builder.Append("IBIL=@IBIL ");
            builder.Append(" where OutKey=@OutKey");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@HB", MySqlDbType.Decimal),
                new MySqlParameter("@WBC", MySqlDbType.Decimal),
                new MySqlParameter("@PLT", MySqlDbType.Decimal),
                new MySqlParameter("@PRO", MySqlDbType.String, 10),
                new MySqlParameter("@GLU", MySqlDbType.String, 10),
                new MySqlParameter("@KET", MySqlDbType.String, 10),
                new MySqlParameter("@BLD", MySqlDbType.String, 10),
                new MySqlParameter("@FPGL", MySqlDbType.Decimal),
                new MySqlParameter("@ECG", MySqlDbType.String, 100),
                new MySqlParameter("@ALBUMIN", MySqlDbType.Decimal),
                new MySqlParameter("@FOB", MySqlDbType.String, 1),
                new MySqlParameter("@HBALC", MySqlDbType.Decimal),
                new MySqlParameter("@HBSAG", MySqlDbType.String, 1),
                new MySqlParameter("@SGPT", MySqlDbType.Decimal),
                new MySqlParameter("@GOT", MySqlDbType.Decimal),
                new MySqlParameter("@BP", MySqlDbType.Decimal),
                new MySqlParameter("@TBIL", MySqlDbType.Decimal),
                new MySqlParameter("@CB", MySqlDbType.Decimal),
                new MySqlParameter("@SCR", MySqlDbType.Decimal),
                new MySqlParameter("@BUN", MySqlDbType.Decimal),
                new MySqlParameter("@PC", MySqlDbType.Decimal),
                new MySqlParameter("@HYPE", MySqlDbType.Decimal),
                new MySqlParameter("@TC", MySqlDbType.Decimal),
                new MySqlParameter("@TG", MySqlDbType.Decimal),
                new MySqlParameter("@LowCho", MySqlDbType.Decimal),
                new MySqlParameter("@HeiCho", MySqlDbType.Decimal),
                new MySqlParameter("@CHESTX", MySqlDbType.String, 1),
                new MySqlParameter("@BCHAO", MySqlDbType.String, 1),
                new MySqlParameter("@BloodOther", MySqlDbType.String, 50),
                new MySqlParameter("@UrineOther", MySqlDbType.String, 50),
                new MySqlParameter("@Other", MySqlDbType.String, 50),
                new MySqlParameter("@CERVIX", MySqlDbType.String, 1),
                new MySqlParameter("@GT", MySqlDbType.Decimal),
                new MySqlParameter("@ECGEx", MySqlDbType.String, 500),
                new MySqlParameter("@CHESTXEx", MySqlDbType.String, 500),
                new MySqlParameter("@BCHAOEx", MySqlDbType.String, 500),
                new MySqlParameter("@CERVIXEx", MySqlDbType.String, 500),
                new MySqlParameter("@FPGDL", MySqlDbType.Decimal),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 8),
                new MySqlParameter("@UA", MySqlDbType.String, 500),

                new MySqlParameter("@HCY", MySqlDbType.Decimal),
                new MySqlParameter("@BCHAOther", MySqlDbType.String, 500),
                new MySqlParameter("@BCHAOtherEx", MySqlDbType.String, 500),
                new MySqlParameter("@BloodType", MySqlDbType.String, 1),
                new MySqlParameter("@RH", MySqlDbType.String, 1),
                new MySqlParameter("@TP", MySqlDbType.Decimal),
                new MySqlParameter("@GLB", MySqlDbType.Decimal),
                new MySqlParameter("@AG", MySqlDbType.Decimal),
                new MySqlParameter("@IBIL", MySqlDbType.Decimal)
            };
            cmdParms[0].Value  = model.PhysicalID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.HB;
            cmdParms[3].Value  = model.WBC;
            cmdParms[4].Value  = model.PLT;
            cmdParms[5].Value  = model.PRO;
            cmdParms[6].Value  = model.GLU;
            cmdParms[7].Value  = model.KET;
            cmdParms[8].Value  = model.BLD;
            cmdParms[9].Value  = model.FPGL;
            cmdParms[10].Value = model.ECG;
            cmdParms[11].Value = model.ALBUMIN;
            cmdParms[12].Value = model.FOB;
            cmdParms[13].Value = model.HBALC;
            cmdParms[14].Value = model.HBSAG;
            cmdParms[15].Value = model.SGPT;
            cmdParms[16].Value = model.GOT;
            cmdParms[17].Value = model.BP;
            cmdParms[18].Value = model.TBIL;
            cmdParms[19].Value = model.CB;
            cmdParms[20].Value = model.SCR;
            cmdParms[21].Value = model.BUN;
            cmdParms[22].Value = model.PC;
            cmdParms[23].Value = model.HYPE;
            cmdParms[24].Value = model.TC;
            cmdParms[25].Value = model.TG;
            cmdParms[26].Value = model.LowCho;
            cmdParms[27].Value = model.HeiCho;
            cmdParms[28].Value = model.CHESTX;
            cmdParms[29].Value = model.BCHAO;
            cmdParms[30].Value = model.BloodOther;
            cmdParms[31].Value = model.UrineOther;
            cmdParms[32].Value = model.Other;
            cmdParms[33].Value = model.CERVIX;
            cmdParms[34].Value = model.GT;
            cmdParms[35].Value = model.ECGEx;
            cmdParms[36].Value = model.CHESTXEx;
            cmdParms[37].Value = model.BCHAOEx;
            cmdParms[38].Value = model.CERVIXEx;
            cmdParms[39].Value = model.FPGDL;
            cmdParms[40].Value = model.OutKey;
            cmdParms[41].Value = model.UA;
            //HCY,BCHAOther,BCHAOtherEx
            cmdParms[42].Value = model.HCY;
            cmdParms[43].Value = model.BCHAOther;
            cmdParms[44].Value = model.BCHAOtherEx;
            cmdParms[45].Value = model.BloodType;
            cmdParms[46].Value = model.RH;
            cmdParms[47].Value = model.TP;
            cmdParms[48].Value = model.GLB;
            cmdParms[49].Value = model.AG;
            cmdParms[50].Value = model.IBIL;

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 15
0
        public int Add(RecordsAssistCheckModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into ARCHIVE_ASSISTCHECK(");
            builder.Append("PhysicalID,IDCardNo,HB,WBC,PLT,PRO,GLU,KET,BLD,FPGL,ECG,ALBUMIN,FOB,HBALC,HBSAG,SGPT,GOT,BP,TBIL,CB,SCR,BUN,PC,HYPE,TC,TG,LowCho,HeiCho,CHESTX,BCHAO,BloodOther,UrineOther,Other,CERVIX,GT,ECGEx,CHESTXEx,BCHAOEx,CERVIXEx,FPGDL,OutKey,UA,HCY,BCHAOther,BCHAOtherEx,BloodType,RH,TP,GLB,AG,IBIL)");
            builder.Append(" values (");
            builder.Append("@PhysicalID,@IDCardNo,@HB,@WBC,@PLT,@PRO,@GLU,@KET,@BLD,@FPGL,@ECG,@ALBUMIN,@FOB,@HBALC,@HBSAG,@SGPT,@GOT,@BP,@TBIL,@CB,@SCR,@BUN,@PC,@HYPE,@TC,@TG,@LowCho,@HeiCho,@CHESTX,@BCHAO,@BloodOther,@UrineOther,@Other,@CERVIX,@GT,@ECGEx,@CHESTXEx,@BCHAOEx,@CERVIXEx,@FPGDL,@OutKey,@UA,@HCY,@BCHAOther,@BCHAOtherEx,@BloodType,@RH,@TP,@GLB,@AG,@IBIL)");
            builder.Append(";select @@IDENTITY");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@HB", MySqlDbType.Decimal),
                new MySqlParameter("@WBC", MySqlDbType.Decimal),
                new MySqlParameter("@PLT", MySqlDbType.Decimal),
                new MySqlParameter("@PRO", MySqlDbType.String, 10),
                new MySqlParameter("@GLU", MySqlDbType.String, 10),
                new MySqlParameter("@KET", MySqlDbType.String, 10),
                new MySqlParameter("@BLD", MySqlDbType.String, 10),
                new MySqlParameter("@FPGL", MySqlDbType.Decimal),
                new MySqlParameter("@ECG", MySqlDbType.String, 100),
                new MySqlParameter("@ALBUMIN", MySqlDbType.Decimal),
                new MySqlParameter("@FOB", MySqlDbType.String, 1),
                new MySqlParameter("@HBALC", MySqlDbType.Decimal),
                new MySqlParameter("@HBSAG", MySqlDbType.String, 1),
                new MySqlParameter("@SGPT", MySqlDbType.Decimal),
                new MySqlParameter("@GOT", MySqlDbType.Decimal),
                new MySqlParameter("@BP", MySqlDbType.Decimal),
                new MySqlParameter("@TBIL", MySqlDbType.Decimal),
                new MySqlParameter("@CB", MySqlDbType.Decimal),
                new MySqlParameter("@SCR", MySqlDbType.Decimal),
                new MySqlParameter("@BUN", MySqlDbType.Decimal),
                new MySqlParameter("@PC", MySqlDbType.Decimal),
                new MySqlParameter("@HYPE", MySqlDbType.Decimal),
                new MySqlParameter("@TC", MySqlDbType.Decimal),
                new MySqlParameter("@TG", MySqlDbType.Decimal),
                new MySqlParameter("@LowCho", MySqlDbType.Decimal),
                new MySqlParameter("@HeiCho", MySqlDbType.Decimal),
                new MySqlParameter("@CHESTX", MySqlDbType.String, 1),
                new MySqlParameter("@BCHAO", MySqlDbType.String, 1),
                new MySqlParameter("@BloodOther", MySqlDbType.String, 50),
                new MySqlParameter("@UrineOther", MySqlDbType.String, 50),
                new MySqlParameter("@Other", MySqlDbType.String, 50),
                new MySqlParameter("@CERVIX", MySqlDbType.String, 1),
                new MySqlParameter("@GT", MySqlDbType.Decimal),
                new MySqlParameter("@ECGEx", MySqlDbType.String, 500),
                new MySqlParameter("@CHESTXEx", MySqlDbType.String, 500),
                new MySqlParameter("@BCHAOEx", MySqlDbType.String, 500),
                new MySqlParameter("@CERVIXEx", MySqlDbType.String, 500),
                new MySqlParameter("@FPGDL", MySqlDbType.Decimal),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4),
                new MySqlParameter("@UA", MySqlDbType.String, 500),
                new MySqlParameter("@HCY", MySqlDbType.Decimal),
                new MySqlParameter("@BCHAOther", MySqlDbType.String, 500),
                new MySqlParameter("@BCHAOtherEx", MySqlDbType.String, 500),
                new MySqlParameter("@BloodType", MySqlDbType.String, 1),
                new MySqlParameter("@RH", MySqlDbType.String, 1),
                new MySqlParameter("@TP", MySqlDbType.Decimal),
                new MySqlParameter("@GLB", MySqlDbType.Decimal),
                new MySqlParameter("@AG", MySqlDbType.Decimal),
                new MySqlParameter("@IBIL", MySqlDbType.Decimal)
            };
            cmdParms[0].Value  = model.PhysicalID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.HB;
            cmdParms[3].Value  = model.WBC;
            cmdParms[4].Value  = model.PLT;
            cmdParms[5].Value  = model.PRO;
            cmdParms[6].Value  = model.GLU;
            cmdParms[7].Value  = model.KET;
            cmdParms[8].Value  = model.BLD;
            cmdParms[9].Value  = model.FPGL;
            cmdParms[10].Value = model.ECG;
            cmdParms[11].Value = model.ALBUMIN;
            cmdParms[12].Value = model.FOB;
            cmdParms[13].Value = model.HBALC;
            cmdParms[14].Value = model.HBSAG;
            cmdParms[15].Value = model.SGPT;
            cmdParms[16].Value = model.GOT;
            cmdParms[17].Value = model.BP;
            cmdParms[18].Value = model.TBIL;
            cmdParms[19].Value = model.CB;
            cmdParms[20].Value = model.SCR;
            cmdParms[21].Value = model.BUN;
            cmdParms[22].Value = model.PC;
            cmdParms[23].Value = model.HYPE;
            cmdParms[24].Value = model.TC;
            cmdParms[25].Value = model.TG;
            cmdParms[26].Value = model.LowCho;
            cmdParms[27].Value = model.HeiCho;
            cmdParms[28].Value = model.CHESTX;
            cmdParms[29].Value = model.BCHAO;
            cmdParms[30].Value = model.BloodOther;
            cmdParms[31].Value = model.UrineOther;
            cmdParms[32].Value = model.Other;
            cmdParms[33].Value = model.CERVIX;
            cmdParms[34].Value = model.GT;
            cmdParms[35].Value = model.ECGEx;
            cmdParms[36].Value = model.CHESTXEx;
            cmdParms[37].Value = model.BCHAOEx;
            cmdParms[38].Value = model.CERVIXEx;
            cmdParms[39].Value = model.FPGDL;
            cmdParms[40].Value = model.OutKey;//UA
            cmdParms[41].Value = model.UA;
            cmdParms[42].Value = model.HCY;
            cmdParms[43].Value = model.BCHAOther;
            cmdParms[44].Value = model.BCHAOtherEx;
            cmdParms[45].Value = model.BloodType;
            cmdParms[46].Value = model.RH;
            cmdParms[47].Value = model.TP;
            cmdParms[48].Value = model.GLB;
            cmdParms[49].Value = model.AG;
            cmdParms[50].Value = model.IBIL;
            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
Ejemplo n.º 16
0
        public void SavePhysical(string IDCardNo, DateTime CheckDate, string VersionNo, string barCode = "")
        {
            try
            {
                DataTable dsRequire = new RequireBLL().GetList("TabName = '健康体检' ").Tables[0];
                DataView  dv        = dsRequire.DefaultView;

                // 获取最后一次体检数据
                RecordsCustomerBaseInfoModel customerOldModel = CustomerBaseInfoBLL.GetMaxModel(IDCardNo);
                if (customerOldModel == null)
                {
                    customerOldModel = new RecordsCustomerBaseInfoModel();
                }
                RecordsCustomerBaseInfoModel customerNewModel = new RecordsCustomerBaseInfoModel();

                customerNewModel.IDCardNo       = IDCardNo;
                customerNewModel.CheckDate      = CheckDate;
                customerNewModel.CustomerID     = barCode;
                customerNewModel.Doctor         = ConfigHelper.GetNode("doctorName");
                customerNewModel.CreateBy       = ConfigHelper.GetNodeDec("doctor");
                customerNewModel.CreateDate     = DateTime.Now;
                customerNewModel.LastUpdateBy   = ConfigHelper.GetNodeDec("doctor");
                customerNewModel.LastUpdateDate = DateTime.Now;

                #region 一般状况

                dv.RowFilter = "Comment='一般状况' AND (IsSetValue='是' OR IsSetValue='预设上次体检') AND OptionName='Symptom' ";
                DataTable dt = dv.ToTable();

                // 栏位名遍历默认项配置
                foreach (DataRow item in dt.Rows)
                {
                    if (item["IsSetValue"].ToString() == "是")
                    {
                        customerNewModel.Symptom = item["ItemValue"].ToString();
                    }
                    else
                    {
                        customerNewModel.Symptom = customerOldModel.Symptom;
                        customerNewModel.Other   = customerOldModel.Other;
                    }
                }

                dv.RowFilter = null;
                dv.RowFilter = "Comment='一般状况' AND (IsSetValue='是' OR IsSetValue='预设上次体检') AND OptionName<>'Symptom' ";
                dt           = dv.ToTable();
                RecordsGeneralConditionModel gerneralOldModel = GeneralConditionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsGeneralConditionModel gerneralNewModel = new RecordsGeneralConditionModel();

                gerneralNewModel = EntityAssignment <RecordsGeneralConditionModel>(gerneralOldModel, gerneralNewModel, dt);

                #endregion

                #region 生活方式

                dv.RowFilter = null;
                dv.RowFilter = "Comment='生活方式' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsLifeStyleModel lifeStyleOldModel = LifeStyleBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsLifeStyleModel lifeStyleNewModel = new RecordsLifeStyleModel();
                if (lifeStyleOldModel == null)
                {
                    lifeStyleOldModel = new RecordsLifeStyleModel();
                }

                lifeStyleNewModel = EntityAssignment <RecordsLifeStyleModel>(lifeStyleOldModel, lifeStyleNewModel, dt);

                #endregion

                #region 查体信息

                dv.RowFilter = null;
                dv.RowFilter = "Comment='查体信息' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsPhysicalExamModel physicalExamOldModel = PhysicalExamBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsPhysicalExamModel physicalExamNewModel = new RecordsPhysicalExamModel();
                if (physicalExamOldModel == null)
                {
                    physicalExamOldModel = new RecordsPhysicalExamModel();
                }

                physicalExamNewModel = EntityAssignment <RecordsPhysicalExamModel>(physicalExamOldModel, physicalExamNewModel, dt);

                #endregion

                #region 辅助检查

                dv.RowFilter = null;
                dv.RowFilter = "Comment='辅助检查' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsAssistCheckModel assistCheckOldModel = AssistCheckBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsAssistCheckModel assistCheckNewModel = new RecordsAssistCheckModel();
                if (assistCheckOldModel == null)
                {
                    assistCheckOldModel = new RecordsAssistCheckModel();
                }

                assistCheckNewModel = EntityAssignment <RecordsAssistCheckModel>(assistCheckOldModel, assistCheckNewModel, dt);

                #endregion

                #region 脏器功能

                dv.RowFilter = null;
                dv.RowFilter = "Comment='脏器功能' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsVisceraFunctionModel visceraOldModel = VisceraFunctionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsVisceraFunctionModel visceraNewModel = new RecordsVisceraFunctionModel();
                if (visceraOldModel == null)
                {
                    visceraOldModel = new RecordsVisceraFunctionModel();
                }

                visceraNewModel = EntityAssignment <RecordsVisceraFunctionModel>(visceraOldModel, visceraNewModel, dt);

                #endregion

                #region 中医体质

                RecordsMediPhysDistModel mediPhysDistModel = new RecordsMediPhysDistModel();

                #endregion

                #region 健康评价

                RecordsAssessmentGuideModel assessmentGuideModel = new RecordsAssessmentGuideModel();

                #endregion

                #region 健康问题

                dv.RowFilter = null;
                dv.RowFilter = "Comment='健康问题' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsHealthQuestionModel questionOldModel = HealthQuestionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsHealthQuestionModel questionNewModel = new RecordsHealthQuestionModel();
                if (questionOldModel == null)
                {
                    questionOldModel = new RecordsHealthQuestionModel();
                }

                questionNewModel = EntityAssignment <RecordsHealthQuestionModel>(questionOldModel, questionNewModel, dt);

                #endregion

                #region 住院史、用药情况

                dv.RowFilter = null;
                dv.RowFilter = "Comment='治疗情况' AND (IsSetValue='是' OR IsSetValue='预设上次体检' OR IsSetValue='预设随访用药') ";
                dt           = dv.ToTable();

                // 获取list model对象,用来获取最后一次体检数据的值
                List <RecordsHospitalHistoryModel> hospitalHistoryOld = HospitalHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                List <RecordsFamilyBedHistoryModel> familyBedHistoryInfoOld = FamilyBedHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                List <RecordsMedicationModel> medicationOld = MedicationBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));

                if (hospitalHistoryOld == null)
                {
                    hospitalHistoryOld = new List <RecordsHospitalHistoryModel>();
                }
                if (familyBedHistoryInfoOld == null)
                {
                    familyBedHistoryInfoOld = new List <RecordsFamilyBedHistoryModel>();
                }
                if (medicationOld == null)
                {
                    medicationOld = new List <RecordsMedicationModel>();
                }

                #region 随访用药

                List <RecordsMedicationModel> medicationFollowUp = new List <RecordsMedicationModel>();

                // 高血压随访
                ChronicHypertensionVisitModel HyperModel = new ChronicHypertensionVisitBLL().GetMaxModel(IDCardNo, VersionNo);

                if (HyperModel != null)
                {
                    List <ChronicDrugConditionModel> DrugConditions = new ChronicDrugConditionBLL().GetModelList(
                        string.Format(" IDCardNo='{0}' AND Type='{1}' AND OutKey='{2}' ", IDCardNo, "1", HyperModel.ID));

                    foreach (ChronicDrugConditionModel drugModel in DrugConditions)
                    {
                        RecordsMedicationModel newModel = new RecordsMedicationModel
                        {
                            MedicinalName = drugModel.Name,
                            UseNum        = drugModel.DosAge,
                            IDCardNo      = IDCardNo
                        };

                        medicationFollowUp.Add(newModel);
                    }
                }

                // 糖尿病随访
                ChronicDiadetesVisitModel DiaModel = new ChronicDiadetesVisitBLL().GetMaxModel(IDCardNo);

                if (DiaModel != null)
                {
                    List <ChronicDrugConditionModel> DiaDrugConditions = new ChronicDrugConditionBLL().GetModelList(
                        string.Format(" IDCardNo='{0}' AND Type='{1}' AND OutKey='{2}' ", IDCardNo, "2", DiaModel.ID));

                    foreach (ChronicDrugConditionModel drugModel in DiaDrugConditions)
                    {
                        RecordsMedicationModel newModel = new RecordsMedicationModel
                        {
                            MedicinalName = drugModel.Name,
                            UseNum        = drugModel.DosAge,
                            IDCardNo      = IDCardNo
                        };

                        medicationFollowUp.Add(newModel);
                    }
                }

                #endregion

                // 用于存储需存档的体检数据
                List <RecordsHospitalHistoryModel>  hospitalHistoryNew      = new List <RecordsHospitalHistoryModel>();
                List <RecordsFamilyBedHistoryModel> familyBedHistoryInfoNew = new List <RecordsFamilyBedHistoryModel>();
                List <RecordsMedicationModel>       medicationNew           = new List <RecordsMedicationModel>();

                // 临时存储住院史的默认值
                RecordsHospitalHistoryModel hModel = new RecordsHospitalHistoryModel();

                //通过栏位名,遍历默认项配置
                foreach (DataRow item in dt.Rows)
                {
                    switch (item["ChinName"].ToString())
                    {
                    case "住院史":
                        if (item["IsSetValue"].ToString() == "是")
                        {
                            if (!string.IsNullOrEmpty(item["ItemValue"].ToString()))
                            {
                                string[] resList = item["ItemValue"].ToString().Split(';');

                                if (resList.Length > 4)
                                {
                                    hModel.InHospitalDate  = Convert.ToDateTime(resList[0].ToString());
                                    hModel.OutHospitalDate = Convert.ToDateTime(resList[1].ToString());
                                    hModel.Reason          = resList[2].ToString();
                                    hModel.HospitalName    = resList[3].ToString();
                                    hModel.IllcaseNum      = resList[4].ToString();
                                }
                                else if (resList.Length == 1)
                                {
                                    hModel.Reason = resList[0].ToString();
                                }

                                hospitalHistoryNew.Add(hModel);
                            }
                        }
                        else
                        {
                            hospitalHistoryNew = hospitalHistoryOld;
                        }
                        break;

                    case "家庭病床史":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            familyBedHistoryInfoNew = familyBedHistoryInfoOld;
                        }
                        break;

                    case "用药情况":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            medicationNew = medicationOld;
                        }
                        else if (item["IsSetValue"].ToString() == "预设随访用药")
                        {
                            medicationNew = medicationFollowUp;
                        }
                        break;

                    default:
                        break;
                    }
                }

                #endregion

                #region 预防接种史

                dv.RowFilter = null;
                dv.RowFilter = "Comment='健康评价' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                List <RecordsInoculationHistoryModel> inoculationHistoryOld = InoculationHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                if (inoculationHistoryOld == null)
                {
                    inoculationHistoryOld = new List <RecordsInoculationHistoryModel>();
                }

                List <RecordsInoculationHistoryModel> inoculationHistoryNew = new List <RecordsInoculationHistoryModel>();

                foreach (DataRow item in dt.Rows)
                {
                    switch (item["ChinName"].ToString())
                    {
                    case "非免疫预防接种史":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            inoculationHistoryNew = inoculationHistoryOld;
                        }
                        break;
                    }
                }

                #endregion

                #region 保存默认值

                // 体检主档保存
                int id = CustomerBaseInfoBLL.Add(customerNewModel);

                if (id > 0)
                {
                    // 一般状况
                    gerneralNewModel.IDCardNo = IDCardNo;
                    gerneralNewModel.OutKey   = id;
                    GeneralConditionBLL.Add(gerneralNewModel, VersionNo);

                    // 生活方式
                    lifeStyleNewModel.IDCardNo = IDCardNo;
                    lifeStyleNewModel.OutKey   = id;
                    LifeStyleBLL.Add(lifeStyleNewModel);

                    // 查体信息
                    physicalExamNewModel.IDCardNo = IDCardNo;
                    physicalExamNewModel.OutKey   = id;
                    PhysicalExamBLL.Add(physicalExamNewModel);

                    // 辅助检查
                    assistCheckNewModel.IDCardNo = IDCardNo;
                    assistCheckNewModel.OutKey   = id;
                    AssistCheckBLL.Add(assistCheckNewModel);

                    // 脏器功能
                    visceraNewModel.IDCardNo = IDCardNo;
                    visceraNewModel.OutKey   = id;
                    VisceraFunctionBLL.Add(visceraNewModel);

                    // 中医体质
                    mediPhysDistModel.IDCardNo = IDCardNo;
                    mediPhysDistModel.OutKey   = id;
                    MediPhysDistBLL.Add(mediPhysDistModel);

                    // 健康问题
                    questionNewModel.IDCardNo = IDCardNo;
                    questionNewModel.OutKey   = id;
                    HealthQuestionBLL.Add(questionNewModel);

                    // 健康评价
                    assessmentGuideModel.IDCardNo = IDCardNo;
                    assessmentGuideModel.OutKey   = id;
                    AssessmentGuideBLL.Add(assessmentGuideModel);

                    // 住院史
                    if (hospitalHistoryNew.Count > 0)
                    {
                        foreach (RecordsHospitalHistoryModel recordsInoculationHistoryModel in hospitalHistoryNew)
                        {
                            recordsInoculationHistoryModel.OutKey   = id;
                            recordsInoculationHistoryModel.IDCardNo = IDCardNo;
                        }

                        HospitalHistoryBLL.AddList(hospitalHistoryNew);
                    }

                    // 家庭住院史
                    if (familyBedHistoryInfoNew.Count > 0)
                    {
                        foreach (RecordsFamilyBedHistoryModel model in familyBedHistoryInfoNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        FamilyBedHistoryBLL.AddList(familyBedHistoryInfoNew);
                    }

                    // 用药
                    if (medicationNew.Count > 0)
                    {
                        foreach (RecordsMedicationModel model in medicationNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        MedicationBLL.AddList(medicationNew);
                    }

                    // 接种史
                    if (inoculationHistoryNew.Count > 0)
                    {
                        foreach (RecordsInoculationHistoryModel model in inoculationHistoryNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        InoculationHistoryBLL.AddList(inoculationHistoryNew);
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }