Example #1
0
        public bool Update(RecordsCustomerBaseInfoModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ARCHIVE_CUSTOMERBASEINFO set ");
            builder.Append("CustomerID=@CustomerID,");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("CheckDate=@CheckDate,");
            builder.Append("Doctor=@Doctor,");
            builder.Append("Symptom=@Symptom,");
            builder.Append("Other=@Other,");
            builder.Append("PhysicalID=@PhysicalID,");
            builder.Append("CreateBy=@CreateBy,");
            builder.Append("CreateDate=@CreateDate,");
            builder.Append("LastUpdateBy=@LastUpdateBy,");
            builder.Append("LastUpdateDate=@LastUpdateDate,");
            builder.Append("IsDel=@IsDel");
            builder.Append(" where ID=@ID");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@CustomerID", MySqlDbType.String, 18),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@CheckDate", MySqlDbType.Date),
                new MySqlParameter("@Doctor", MySqlDbType.String, 30),
                new MySqlParameter("@Symptom", MySqlDbType.String, 100),
                new MySqlParameter("@Other", MySqlDbType.String, 200),
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@CreateBy", MySqlDbType.Decimal),
                new MySqlParameter("@CreateDate", MySqlDbType.Date),
                new MySqlParameter("@LastUpdateBy", MySqlDbType.Decimal),
                new MySqlParameter("@LastUpdateDate", MySqlDbType.Date),
                new MySqlParameter("@IsDel", MySqlDbType.String, 1),
                new MySqlParameter("@ID", MySqlDbType.Int32, 8)
            };
            cmdParms[0].Value  = model.CustomerID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.CheckDate;
            cmdParms[3].Value  = model.Doctor;
            cmdParms[4].Value  = model.Symptom;
            cmdParms[5].Value  = model.Other;
            cmdParms[6].Value  = model.PhysicalID;
            cmdParms[7].Value  = model.CreateBy;
            cmdParms[8].Value  = model.CreateDate;
            cmdParms[9].Value  = model.LastUpdateBy;
            cmdParms[10].Value = model.LastUpdateDate;
            cmdParms[11].Value = model.IsDel;
            cmdParms[12].Value = model.ID;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Example #2
0
        public int Add(RecordsCustomerBaseInfoModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into ARCHIVE_CUSTOMERBASEINFO(");
            builder.Append("CustomerID,IDCardNo,CheckDate,Doctor,Symptom,Other,PhysicalID,CreateBy,CreateDate,LastUpdateBy,LastUpdateDate,IsDel)");
            builder.Append(" values (");
            builder.Append("@CustomerID,@IDCardNo,@CheckDate,@Doctor,@Symptom,@Other,@PhysicalID,@CreateBy,@CreateDate,@LastUpdateBy,@LastUpdateDate,@IsDel)");
            builder.Append(";select @@IDENTITY");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CustomerID", MySqlDbType.String, 18),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@CheckDate", MySqlDbType.Date),
                new MySqlParameter("@Doctor", MySqlDbType.String, 30),
                new MySqlParameter("@Symptom", MySqlDbType.String, 100),
                new MySqlParameter("@Other", MySqlDbType.String, 200),
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@CreateBy", MySqlDbType.Decimal),
                new MySqlParameter("@CreateDate", MySqlDbType.Date),
                new MySqlParameter("@LastUpdateBy", MySqlDbType.Decimal),
                new MySqlParameter("@LastUpdateDate", MySqlDbType.Date),
                new MySqlParameter("@IsDel", MySqlDbType.String, 1)
            };
            cmdParms[0].Value  = model.CustomerID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.CheckDate;
            cmdParms[3].Value  = model.Doctor;
            cmdParms[4].Value  = model.Symptom;
            cmdParms[5].Value  = model.Other;
            cmdParms[6].Value  = model.PhysicalID;
            cmdParms[7].Value  = model.CreateBy;
            cmdParms[8].Value  = model.CreateDate;
            cmdParms[9].Value  = model.LastUpdateBy;
            cmdParms[10].Value = model.LastUpdateDate;
            cmdParms[11].Value = model.IsDel;
            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
Example #3
0
        public FixedDocumentSequence getReport()
        {
            if (!string.IsNullOrEmpty(this.CardID))
            {
                if (File.Exists("printtemp\\ecg.png"))
                {
                    File.Delete("printtemp\\ecg.png");
                }

                string          xdWhere  = string.Format(" IDCardNo='{0}' AND LEFT(CreateTime,4)='{1}' ORDER BY CreateTime DESC,ID DESC LIMIT 0,1 ", this.CardID, DateTime.Now.Year.ToString());
                RecordsEcgModel ecgModel = new RecordsEcgBLL().GetModelByWhere(xdWhere);

                if (ecgModel == null)
                {
                    ecgModel = new RecordsEcgModel();
                }

                List <ListValue> list = new List <ListValue>();
                string           path = ECGReport + "\\" + ecgModel.MID + ".png";

                if (!File.Exists(path))
                {
                    list.Add(new ListValue
                    {
                        strMark = "&ecg",
                        strVal  = ""
                    });
                }
                else
                {
                    //读取文件流
                    FileStream fs = new System.IO.FileStream(path, FileMode.Open, FileAccess.Read);

                    int    byteLength = (int)fs.Length;
                    byte[] fileBytes  = new byte[byteLength];
                    fs.Read(fileBytes, 0, byteLength);

                    //文件流关閉,文件解除锁定
                    fs.Close();
                    Image image = Image.FromStream(new MemoryStream(fileBytes));

                    //if (community.Equals("聊城东昌府区"))
                    //{
                    Graphics g = Graphics.FromImage(image);

                    #region 禹城 检查医生取文字版,审核医生取手写版,检查日期取心电createTime
                    if (area.Equals("禹城"))
                    {
                        RecordsSignatureModel signModel = new RecordsSignatureBLL().GetModelByOutKey(0, "签字维护");
                        if (signModel == null)
                        {
                            signModel = new RecordsSignatureModel();
                        }

                        // 加载检查医生签名
                        string signPath = SignPath + "_Doctor16.png";

                        if (File.Exists(signPath))
                        {
                            //加载检查日期
                            string imgJianChaKong = SignPath + "_JianChaKongBai.png";
                            string imgJianChaZi   = SignPath + "Date//" + CardID + "_imgJianChaZi.png";

                            if (!File.Exists(imgJianChaKong))
                            {
                                //创建一个200*40的空白图
                                Bitmap   b1 = new Bitmap(200, 80);                             //新建位图zdb1
                                Graphics g1 = Graphics.FromImage(b1);                          //创建版b1的Graphics
                                g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 80)); //把b1涂成红色
                                b1.Save(imgJianChaKong);
                                b1.Dispose();
                            }

                            if (!File.Exists(SignPath + "Date"))
                            {
                                Directory.CreateDirectory(SignPath + "Date");
                            }

                            if (File.Exists(imgJianChaZi))
                            {
                                File.Delete(imgJianChaZi);
                            }

                            Bitmap     bitmap = new Bitmap(imgJianChaKong);
                            Graphics   gp     = Graphics.FromImage(bitmap);
                            Font       font   = new Font("KaiTi", 40, FontStyle.Bold);
                            SolidBrush sbrush = new SolidBrush(Color.Black);
                            gp.DrawString(signModel.AECGSn, font, sbrush, 10, 2);

                            bitmap.Save(imgJianChaZi);
                            bitmap.Dispose();

                            Image imgrq = Image.FromFile(imgJianChaZi);
                            g.DrawImage(image, 0, 0, image.Width, image.Height);
                            g.DrawImage(imgrq, 300, 1950, imgrq.Width, imgrq.Height);
                        }

                        //加载检查日期
                        string imgKong = SignPath + "_KongBai.png";
                        string imgZi   = SignPath + "Date//" + CardID + "_imgZi.png";

                        //绑定检查日期
                        DateTime checkDate;
                        if (DateTime.TryParse(ecgModel.CreateTime.ToString(), out checkDate))
                        {
                            // 加载心电检查医生签名
                            string examinePath = SignPath + "_Doctor16.png";

                            if (File.Exists(SignPath + checkDate.ToString("yyyy-MM-dd") + "//_Doctor16.png"))
                            {
                                Image img = Image.FromFile(SignPath + checkDate.ToString("yyyy-MM-dd") + "//_Doctor16.png");

                                // 将医生签名拼接到检查医生的位置
                                g.DrawImage(image, 0, 0, image.Width, image.Height);
                                g.DrawImage(img, 1300, 1950, img.Width, img.Height);
                            }
                            else
                            {
                                if (File.Exists(examinePath))
                                {
                                    Image img = Image.FromFile(examinePath);

                                    // 将医生签名拼接到检查医生的位置
                                    g.DrawImage(image, 0, 0, image.Width, image.Height);
                                    g.DrawImage(img, 1300, 1950, img.Width, img.Height);
                                }
                            }


                            if (!File.Exists(imgKong))
                            {
                                //创建一个200*40的空白图
                                Bitmap   b1 = new Bitmap(200, 40);                             //新建位图zdb1
                                Graphics g1 = Graphics.FromImage(b1);                          //创建版b1的Graphics
                                g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 40)); //把b1涂成红色
                                b1.Save(imgKong);
                                b1.Dispose();
                            }

                            if (!File.Exists(SignPath + "Date"))
                            {
                                Directory.CreateDirectory(SignPath + "Date");
                            }

                            if (File.Exists(imgZi))
                            {
                                File.Delete(imgZi);
                            }

                            Bitmap     bitmap = new Bitmap(imgKong);
                            Graphics   gp     = Graphics.FromImage(bitmap);
                            string     label  = checkDate.ToString("yyyy-MM-dd");
                            Font       font   = new Font("KaiTi", bitmap.Width / 10, FontStyle.Bold);
                            SolidBrush sbrush = new SolidBrush(Color.Black);
                            gp.DrawString(label, font, sbrush, 10, 2);

                            bitmap.Save(imgZi);
                            bitmap.Dispose();

                            Image imgrq = Image.FromFile(imgZi);
                            g.DrawImage(image, 0, 0, image.Width, image.Height);
                            g.DrawImage(imgrq, 1830, 1950, imgrq.Width, imgrq.Height);
                        }
                        else
                        {
                            // 加载心电检查医生签名
                            string examinePath = SignPath + "_Doctor16.png";

                            if (File.Exists(examinePath))
                            {
                                Image img = Image.FromFile(examinePath);

                                // 将医生签名拼接到检查医生的位置
                                g.DrawImage(image, 0, 0, image.Width, image.Height);
                                g.DrawImage(img, 1300, 1950, img.Width, img.Height);
                            }
                        }
                    }
                    #endregion
                    #region 乐陵
                    else if (area.Equals("乐陵"))
                    {
                        // 加载心电医生签名
                        string signPath = SignPath + "_Doctor16.png";

                        if (File.Exists(signPath))
                        {
                            Image img = Image.FromFile(signPath);

                            // 将医生签名拼接到检查医生的位置
                            g.DrawImage(image, 0, 0, image.Width, image.Height);
                            g.DrawImage(img, 300, 1950, img.Width, img.Height);
                        }

                        // 加载心电检查医生签名
                        string examinePath = SignPath + "_Doctor23.png";

                        if (File.Exists(examinePath))
                        {
                            Image img = Image.FromFile(examinePath);

                            // 将医生签名拼接到检查医生的位置
                            g.DrawImage(image, 0, 0, image.Width, image.Height);
                            g.DrawImage(img, 1300, 1950, img.Width, img.Height);
                        }

                        //加载检查日期
                        RecordsCustomerBaseInfoModel model2 = new RecordsCustomerBaseInfoModel();
                        string strYear  = DateTime.Now.Year.ToString();
                        string strWhere = string.Format(" IDCardNo='{0}'AND LEFT(CheckDate,4)='{1}' ORDER BY CheckDate DESC LIMIT 0,1 ", this.CardID, DateTime.Now.Year);

                        string imgKong = SignPath + "_KongBai.png";
                        string imgZi   = SignPath + "Date//" + CardID + "_imgZi.png";

                        //获取本年度最新一笔数据
                        model2 = new RecordsCustomerBaseInfoBLL().GetModelByWhere(strWhere);
                        if (model2 != null)
                        {
                            DateTime checkDate;
                            if (DateTime.TryParse(model2.CheckDate.ToString(), out checkDate))
                            {
                                if (!File.Exists(imgKong))
                                {
                                    //创建一个200*40的空白图
                                    Bitmap   b1 = new Bitmap(200, 40);                             //新建位图zdb1
                                    Graphics g1 = Graphics.FromImage(b1);                          //创建版b1的Graphics
                                    g1.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 40)); //把b1涂成红色
                                    b1.Save(imgKong);
                                    b1.Dispose();
                                }

                                if (!File.Exists(SignPath + "Date"))
                                {
                                    Directory.CreateDirectory(SignPath + "Date");
                                }

                                if (File.Exists(imgZi))
                                {
                                    File.Delete(imgZi);
                                }

                                Bitmap     bitmap = new Bitmap(imgKong);
                                Graphics   gp     = Graphics.FromImage(bitmap);
                                string     label  = checkDate.ToString("yyyy-MM-dd");
                                Font       font   = new Font("KaiTi", bitmap.Width / 10, FontStyle.Bold);
                                SolidBrush sbrush = new SolidBrush(Color.Black);
                                gp.DrawString(label, font, sbrush, 10, 2);

                                bitmap.Save(imgZi);
                                bitmap.Dispose();

                                Image imgrq = Image.FromFile(imgZi);
                                g.DrawImage(image, 0, 0, image.Width, image.Height);
                                g.DrawImage(imgrq, 1770, 1960, imgrq.Width, imgrq.Height);
                            }
                        }
                    }
                    #endregion
                    else
                    {
                        // 加载心电医生签名
                        string signPath = SignPath + "_Doctor16.png";

                        if (File.Exists(signPath))
                        {
                            Image img = Image.FromFile(signPath);

                            // 将医生签名拼接到检查医生的位置
                            g.DrawImage(image, 0, 0, image.Width, image.Height);
                            g.DrawImage(img, 300, 1950, img.Width, img.Height);
                        }
                    }

                    // 旋转图片
                    image.RotateFlip(RotateFlipType.Rotate270FlipNone);

                    fs.Close();
                    image.Save("printtemp\\ecg.png");

                    list.Add(new ListValue
                    {
                        strMark = "&ecg",
                        strVal  = "printtemp\\ecg.png"
                    });

                    image.Dispose();
                }

                return(DrawItems.setPage("printXps\\38心电图.xps", list));
            }

            return(null);
        }
Example #4
0
        /// <summary>
        /// 糖尿病
        /// </summary>
        /// <param name="IDCardNo"></param>
        /// <param name="CheckDate"></param>
        /// <param name="VersionNo"></param>
        /// <param name="Model"></param>
        public void SaveDiadetes(string IDCardNo, DateTime CheckDate, string VersionNo, RecordsBaseInfoModel Model, RecordsCustomerBaseInfoModel CustomerModel)
        {
            try
            {
                DataView dv = dsRequire.DefaultView;

                // 获取最后一次随访数据
                ChronicDiadetesVisitModel diadetesOldModel = DiadetesVisitBLL.GetMaxModel(IDCardNo);
                if (diadetesOldModel == null)
                {
                    diadetesOldModel = new ChronicDiadetesVisitModel();
                }
                ChronicDiadetesVisitModel diadetesNewModel = new ChronicDiadetesVisitModel();

                // 取得体检一般情况资料
                RecordsGeneralConditionModel conditionModel = new RecordsGeneralConditionBLL().GetModelByOutKey(CustomerModel.ID);

                // 取得体检生活方式资料
                RecordsLifeStyleModel lifeModel = new RecordsLifeStyleBLL().GetModelByOutKey(CustomerModel.ID);
                if (lifeModel == null)
                {
                    lifeModel = new RecordsLifeStyleModel();
                }

                // 取得体检查体资料
                RecordsPhysicalExamModel physicalModel = new RecordsPhysicalExamBLL().GetModelByOutKey(CustomerModel.ID);
                if (physicalModel == null)
                {
                    physicalModel = new RecordsPhysicalExamModel();
                }

                // 取得体检辅助检查资料
                RecordsAssistCheckModel checkModel = new RecordsAssistCheckBLL().GetModelByOutKey(CustomerModel.ID);

                #region 糖尿病基本信息

                dv.RowFilter = null;
                dv.RowFilter = "TabName='糖尿病随访' AND Comment='糖尿病基本信息' AND (IsSetValue='是' OR IsSetValue='预设上次随访') ";
                DataTable dt = dv.ToTable();

                // 是否有基本信息
                int count = DiadetesVisitBLL.GetBaseDataCount(IDCardNo);

                if (count < 1)
                {
                    // 新增糖尿病基本信息
                    ChronicDiabetesBaseInfoModel baseModel = new ChronicDiabetesBaseInfoModel()
                    {
                        IDCardNo       = IDCardNo,
                        RecordID       = Model.RecordID,
                        CreateBy       = ConfigHelper.GetNodeDec("doctor"),
                        CreateDate     = DateTime.Now,
                        LastUpdateBy   = ConfigHelper.GetNodeDec("doctor"),
                        LastUpdateDate = DateTime.Now
                    };

                    baseModel = EntityAssignment <ChronicDiabetesBaseInfoModel>(baseModel, baseModel, dt);

                    DiadetesVisitBLL.Add(baseModel, VersionNo);
                }

                #endregion

                #region 随访信息

                dv.RowFilter = null;
                dv.RowFilter = "TabName='糖尿病随访' AND Comment='糖尿病随访信息' AND (IsSetValue='是' OR IsSetValue='预设上次随访') AND ChinName<>'用药情况'  ";
                dt           = dv.ToTable();

                diadetesNewModel = EntityAssignment <ChronicDiadetesVisitModel>(diadetesOldModel, diadetesNewModel, dt);

                diadetesNewModel.IDCardNo           = IDCardNo;
                diadetesNewModel.RecordID           = Model.RecordID;
                diadetesNewModel.CustomerName       = StringPlus.toString(diadetesNewModel.CustomerName) == "" ? Model.CustomerName : diadetesNewModel.CustomerName;
                diadetesNewModel.Hypertension       = conditionModel.LeftHeight;
                diadetesNewModel.Hypotension        = conditionModel.LeftPre;
                diadetesNewModel.Weight             = conditionModel.Weight;
                diadetesNewModel.Height             = conditionModel.Height;
                diadetesNewModel.BMI                = conditionModel.BMI;
                diadetesNewModel.DorsalisPedispulse = StringPlus.toString(physicalModel.FootBack) != "" ? (int.Parse(physicalModel.FootBack) - 1).ToString() : null;
                diadetesNewModel.DailySmokeNum      = lifeModel.SmokeDayNum;
                diadetesNewModel.DailyDrinkNum      = lifeModel.DayDrinkVolume;
                diadetesNewModel.FPG                = checkModel.FPGL;
                diadetesNewModel.HbAlc              = checkModel.HBALC;
                diadetesNewModel.VisitDate          = CheckDate;
                diadetesNewModel.NextVisitDate      = CheckDate.AddMonths(3);
                diadetesNewModel.VisitDoctor        = ConfigHelper.GetNode("doctorName");
                diadetesNewModel.CreateBy           = ConfigHelper.GetNode("doctor");
                diadetesNewModel.CreateDate         = DateTime.Now;
                diadetesNewModel.LastUpdateBy       = ConfigHelper.GetNode("doctor");
                diadetesNewModel.LastUpdateDate     = DateTime.Now;

                #endregion

                #region 保存默认值

                // 随访信息存档
                int id = DiadetesVisitBLL.Add(diadetesNewModel, VersionNo);

                #endregion

                // 保存用药
                SaveMedication(IDCardNo, "2", id);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }
Example #5
0
        public void SaveFollowUp(string IDCardNo, DateTime CheckDate, string PopulationType, string VersionNo, RecordsBaseInfoModel Model, RecordsCustomerBaseInfoModel CustomerModel)
        {
            try
            {
                dsRequire = new RequireBLL().GetList("TabName LIKE '%随访' ").Tables[0];

                // 4:老年人
                if (PopulationType.Contains("4"))
                {
                    SaveOld(IDCardNo, CheckDate, VersionNo);
                }

                // 5:重精神病
                if (PopulationType.Contains("5"))
                {
                    SaveMental(IDCardNo, CheckDate, VersionNo, Model);
                }

                // 6:高血压
                if (PopulationType.Contains("6"))
                {
                    SaveHypertension(IDCardNo, CheckDate, VersionNo, Model, CustomerModel);
                }

                // 7:糖尿病
                if (PopulationType.Contains("7"))
                {
                    SaveDiadetes(IDCardNo, CheckDate, VersionNo, Model, CustomerModel);
                }

                // 8:冠心病
                if (PopulationType.Contains("8"))
                {
                    SaveChd(IDCardNo, CheckDate, VersionNo, Model);
                }

                // 9:脑卒中
                if (PopulationType.Contains("9"))
                {
                    SaveStroke(IDCardNo, CheckDate, VersionNo, Model);
                }

                // 10:肺结核
                if (PopulationType.Contains("10"))
                {
                    SaveLunger(IDCardNo, CheckDate, VersionNo, Model);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }
Example #6
0
        /// <summary>
        /// 高血压
        /// </summary>
        /// <param name="IDCardNo"></param>
        /// <param name="CheckDate"></param>
        /// <param name="VersionNo"></param>
        /// <param name="Model"></param>
        public void SaveHypertension(string IDCardNo, DateTime CheckDate, string VersionNo, RecordsBaseInfoModel Model, RecordsCustomerBaseInfoModel CustomerModel)
        {
            try
            {
                DataView dv = dsRequire.DefaultView;

                // 获取最后一次随访数据
                ChronicHypertensionVisitModel hypertensionOldModel = HypertensionVisitBLL.GetMaxModel(IDCardNo, VersionNo);
                if (hypertensionOldModel == null)
                {
                    hypertensionOldModel = new ChronicHypertensionVisitModel();
                }
                ChronicHypertensionVisitModel hypertensionNewModel = new ChronicHypertensionVisitModel();

                // 取得体检一般情况资料
                RecordsGeneralConditionModel conditionModel = new RecordsGeneralConditionBLL().GetModelByOutKey(CustomerModel.ID);

                // 取得体检生活方式资料
                RecordsLifeStyleModel lifeModel = new RecordsLifeStyleBLL().GetModelByOutKey(CustomerModel.ID);
                if (lifeModel == null)
                {
                    lifeModel = new RecordsLifeStyleModel();
                }

                // 取得体检查体资料
                RecordsPhysicalExamModel physicalModel = new RecordsPhysicalExamBLL().GetModelByOutKey(CustomerModel.ID);
                if (physicalModel == null)
                {
                    physicalModel = new RecordsPhysicalExamModel();
                }

                #region 高血压基本信息

                dv.RowFilter = null;
                dv.RowFilter = "TabName='高血压随访' AND Comment='高血压基本信息' AND (IsSetValue='是' OR IsSetValue='预设上次随访') ";
                DataTable dt = dv.ToTable();

                // 是否有基本信息
                int count = HypertensionVisitBLL.GetDataCount(IDCardNo);

                if (count < 1)
                {
                    // 新增高血压基本信息
                    ChronicHypertensionBaseInfoModel baseModel = new ChronicHypertensionBaseInfoModel()
                    {
                        IDCardNo       = IDCardNo,
                        RecordID       = Model.RecordID,
                        CreatedBy      = ConfigHelper.GetNodeDec("doctor"),
                        CreatedDate    = DateTime.Now,
                        LastUpdateBy   = ConfigHelper.GetNodeDec("doctor"),
                        LastUpdateDate = DateTime.Now
                    };

                    baseModel = EntityAssignment <ChronicHypertensionBaseInfoModel>(baseModel, baseModel, dt);

                    HypertensionVisitBLL.Add(baseModel, VersionNo);
                }

                #endregion

                #region 随访信息

                dv.RowFilter = null;
                dv.RowFilter = "TabName='高血压随访' AND Comment='高血压随访信息' AND (IsSetValue='是' OR IsSetValue='预设上次随访') AND ChinName<>'用药情况' ";
                dt           = dv.ToTable();

                hypertensionNewModel = EntityAssignment <ChronicHypertensionVisitModel>(hypertensionOldModel, hypertensionNewModel, dt);

                hypertensionNewModel.IDCardNo         = IDCardNo;
                hypertensionNewModel.RecordID         = Model.RecordID;
                hypertensionNewModel.CustomerName     = StringPlus.toString(hypertensionNewModel.CustomerName) == "" ? Model.CustomerName : hypertensionNewModel.CustomerName;
                hypertensionNewModel.Hypertension     = conditionModel.LeftHeight;
                hypertensionNewModel.Hypotension      = conditionModel.LeftPre;
                hypertensionNewModel.Weight           = conditionModel.Weight;
                hypertensionNewModel.Height           = conditionModel.Height;
                hypertensionNewModel.BMI              = conditionModel.BMI;
                hypertensionNewModel.HeartRate        = physicalModel.HeartRate;
                hypertensionNewModel.DailySmokeNum    = lifeModel.SmokeDayNum;
                hypertensionNewModel.DailyDrinkNum    = lifeModel.DayDrinkVolume;
                hypertensionNewModel.FollowUpDate     = CheckDate;
                hypertensionNewModel.NextFollowUpDate = CheckDate.AddMonths(3);
                hypertensionNewModel.FollowUpDoctor   = ConfigHelper.GetNode("doctorName");
                hypertensionNewModel.CreatedBy        = ConfigHelper.GetNode("doctor");
                hypertensionNewModel.CreatedDate      = DateTime.Now;
                hypertensionNewModel.LastUpdateBy     = ConfigHelper.GetNode("doctor");
                hypertensionNewModel.LastUpdateDate   = DateTime.Now;

                #endregion

                #region 保存默认值

                if (VersionNo.Contains("3.0"))
                {
                    hypertensionNewModel.FollowUpType = hypertensionNewModel.VisitType;
                    hypertensionNewModel.FollowUpWay  = hypertensionNewModel.VisitWay;
                }

                // 随访信息存档
                int id = HypertensionVisitBLL.Add(hypertensionNewModel, VersionNo);

                #endregion

                // 保存用药
                SaveMedication(IDCardNo, "1", id);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }
Example #7
0
        public RecordsCustomerBaseInfoModel DataRowToModel(DataRow row)
        {
            RecordsCustomerBaseInfoModel recordsCustomerBaseInfoModel = new RecordsCustomerBaseInfoModel();

            if (row != null)
            {
                if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.ID = int.Parse(row["ID"].ToString());
                }
                if ((row["CustomerID"] != null) && (row["CustomerID"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.CustomerID = row["CustomerID"].ToString();
                }
                if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.IDCardNo = row["IDCardNo"].ToString();
                }
                if (((row["CheckDate"] != null) && (row["CheckDate"] != DBNull.Value)) && (row["CheckDate"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.CheckDate = new DateTime?(DateTime.Parse(row["CheckDate"].ToString()));
                }
                if ((row["Doctor"] != null) && (row["Doctor"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.Doctor = row["Doctor"].ToString();
                }
                if ((row["Symptom"] != null) && (row["Symptom"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.Symptom = row["Symptom"].ToString();
                }
                if ((row["Other"] != null) && (row["Other"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.Other = row["Other"].ToString();
                }
                if ((row["PhysicalID"] != null) && (row["PhysicalID"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.PhysicalID = row["PhysicalID"].ToString();
                }
                if (((row["CreateBy"] != null) && (row["CreateBy"] != DBNull.Value)) && (row["CreateBy"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.CreateBy = new decimal?(decimal.Parse(row["CreateBy"].ToString()));
                }
                if (((row["CreateDate"] != null) && (row["CreateDate"] != DBNull.Value)) && (row["CreateDate"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.CreateDate = new DateTime?(DateTime.Parse(row["CreateDate"].ToString()));
                }
                if (((row["LastUpdateBy"] != null) && (row["LastUpdateBy"] != DBNull.Value)) && (row["LastUpdateBy"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.LastUpdateBy = new decimal?(decimal.Parse(row["LastUpdateBy"].ToString()));
                }
                if (((row["LastUpdateDate"] != null) && (row["LastUpdateDate"] != DBNull.Value)) && (row["LastUpdateDate"].ToString() != ""))
                {
                    recordsCustomerBaseInfoModel.LastUpdateDate = new DateTime?(DateTime.Parse(row["LastUpdateDate"].ToString()));
                }
                if ((row["IsDel"] != null) && (row["IsDel"] != DBNull.Value))
                {
                    recordsCustomerBaseInfoModel.IsDel = row["IsDel"].ToString();
                }
            }
            return(recordsCustomerBaseInfoModel);
        }
 public bool Update(RecordsCustomerBaseInfoModel model)
 {
     return(this.dal.Update(model));
 }
 public int Add(RecordsCustomerBaseInfoModel model)
 {
     return(this.dal.Add(model));
 }
Example #10
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;
            }
        }
 /// <summary>
 /// 体检问询更新体检
 /// </summary>
 /// <param name="customerBaseInfoModel"></param>
 /// <param name="deciveModel"></param>
 /// <param name="MedicationModel"></param>
 /// <param name="HistoryModel"></param>
 /// <param name="area"></param>
 /// <param name="versionNo"></param>
 /// <returns></returns>
 public bool Update(RecordsCustomerBaseInfoModel customerBaseInfoModel, DataUploadModel deciveModel,
                    List <RecordsMedicationModel> MedicationModel, List <History> HistoryModel, string area, string versionNo)
 {
     return(dal.Update(customerBaseInfoModel, deciveModel, MedicationModel, HistoryModel, area, versionNo));
 }