Beispiel #1
0
 /// <summary>
 /// 保存记录
 /// </summary>
 /// <param name="mdAccessRec"></param>
 /// <param name="recId"></param>
 /// <returns></returns>
 public int SaveMdAccessRecord(EntitymModelAccessRecord mdAccessRec, out decimal recId)
 {
     using (Biz203 biz = new Biz203())
     {
         return(biz.SaveMdAccessRecord(mdAccessRec, out recId));
     }
 }
Beispiel #2
0
        public override void Edit()
        {
            try
            {
                this.BeginLoading();
                EntitymModelAccessRecord       mdAccessRecord       = GetRowObject();
                List <EntityModelParamCalc>    lstMdParamCalc       = null;
                List <EntityRiskFactorsResult> lstRiskFactorsResult = null;
                if (mdAccessRecord.qnRecId <= 0)
                {
                    DialogBox.Msg("请选择问卷");
                    return;
                }

                EntityClientReport rpt = GneralPersonalReport(mdAccessRecord, out lstMdParamCalc, out lstRiskFactorsResult);
                frmPopup2030101    frm = new frmPopup2030101(rpt);
                frm.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                this.CloseLoading();
            }
        }
Beispiel #3
0
 /// <summary>
 /// 疾病模型结果及名项得分
 /// </summary>
 /// <param name="lstMdParamCalc"></param>
 /// <returns></returns>
 public int SaveModelResultAndParamCalc(EntitymModelAccessRecord mdAccessRecord, List <EntityClientModelResult> lstMdResult, List <EntityModelParamCalc> lstMdParamCalc, List <EntityRiskFactorsResult> lstRiskFactorsResult)
 {
     using (Biz203 biz = new Biz203())
     {
         return(biz.SaveModelResultAndParamCalc(mdAccessRecord, lstMdResult, lstMdParamCalc, lstRiskFactorsResult));
     }
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="disClientRpt"></param>
        /// <returns></returns>
        public EntityClientReport GneralPersonalReport(EntitymModelAccessRecord mdAccessRecord, out List <EntityModelParamCalc> lstMdParamCalcData, out List <EntityRiskFactorsResult> lstRiskFactorsResult)
        {
            EntityClientReport rpt = new EntityClientReport();

            rpt.clientName = mdAccessRecord.clientName;
            rpt.clientNo   = mdAccessRecord.clientNo;
            rpt.reportDate = mdAccessRecord.reportDateStr;
            rpt.reportNo   = mdAccessRecord.regNo;
            rpt.sex        = mdAccessRecord.sex;
            rpt.company    = mdAccessRecord.company;
            rpt.age        = mdAccessRecord.age;
            if (!string.IsNullOrEmpty(mdAccessRecord.strQnDate))
            {
                rpt.qnDate = mdAccessRecord.strQnDate;
            }
            rpt.image01  = ReadImageFile("pic01.png");
            rpt.image02  = ReadImageFile("pic02.jpg");
            rpt.image03  = ReadImageFile("pic03.png");
            rpt.image04  = ReadImageFile("pic04.png");
            rpt.image05  = ReadImageFile("pic05.png");
            rpt.imageTip = ReadImageFile("picTip.png");
            rpt.image07  = ReadImageFile("pic07.png");


            rpt.lstRptModelAcess = new List <EntityRptModelAcess>();
            lstMdParamCalcData   = new List <EntityModelParamCalc>();
            List <EntityModelParamCalc> lstMdParamCalc = new List <EntityModelParamCalc>();

            lstRiskFactorsResult = new List <EntityRiskFactorsResult>();
            List <EntityModelAccess> lstMdAcess = GetModelAccess(mdAccessRecord);

            #region 健康汇总及重要指标
            rpt.lstMainItem = GetMainIndicate(mdAccessRecord);
            if (tjjljyVo != null)
            {
                rpt.tjSumup = tjjljyVo.sumup;
            }
            #endregion

            #region 疾病评估
            if (lstMdAcess != null)
            {
                foreach (var mdAcess in lstMdAcess)
                {
                    rpt.lstRptModelAcess.Add(GetRptModelParam(mdAcess.modelId, mdAccessRecord, out lstMdParamCalc));

                    if (lstMdParamCalc != null && lstMdParamCalc.Count > 0)
                    {
                        lstMdParamCalcData.AddRange(lstMdParamCalc);
                    }
                }
            }
            #endregion

            #region 危险要素
            lstRiskFactorsResult = GetRiskFactorsResults(mdAccessRecord);
            #endregion

            return(rpt);
        }
Beispiel #5
0
 /// <summary>
 /// 取消审核
 /// </summary>
 /// <param name="mdAccessRecord"></param>
 /// <returns></returns>
 public int UnConfirmRpt(EntitymModelAccessRecord mdAccessRecord)
 {
     using (Biz203 biz = new Biz203())
     {
         return(biz.UnConfirmRpt(mdAccessRecord));
     }
 }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void blbiAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            EntityClientInfo client = GetRowObject();

            if (client == null)
            {
                return;
            }
            List <EntityParm> parms = new List <EntityParm>();
            EntityParm        vo1   = new EntityParm();

            vo1.key   = "clientNo";
            vo1.value = client.clientNo;
            parms.Add(vo1);

            EntityParm vo2 = new EntityParm();

            vo2.key   = "regTimes";
            vo2.value = client.regTimes.ToString();
            parms.Add(vo2);

            using (ProxyHms proxy = new ProxyHms())
            {
                List <EntitymModelAccessRecord> lstRecord = proxy.Service.GetModelAccessRec(parms);

                if (lstRecord != null)
                {
                    DialogBox.Msg("人员已添加,请重新选择!");
                    return;
                }
            }

            EntitymModelAccessRecord mdAccessRec = new EntitymModelAccessRecord();

            mdAccessRec.clientNo   = client.clientNo;
            mdAccessRec.regNo      = client.regNo;
            mdAccessRec.recordDate = DateTime.Now;
            mdAccessRec.regTimes   = client.regTimes;
            mdAccessRec.status     = 0;
            decimal recId = 0;

            using (ProxyHms proxy = new ProxyHms())
            {
                int affect = proxy.Service.SaveMdAccessRecord(mdAccessRec, out recId);
                if (affect > 0)
                {
                    isRefresh         = true;
                    mdAccessRec.recId = recId;
                    DialogBox.Msg("添加成功!");
                }
                else
                {
                    DialogBox.Msg("添加失败!");
                }
            }
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mdAccessRecord"></param>
        /// <returns></returns>
        public int UnConfirmRpt(EntitymModelAccessRecord mdAccessRecord)
        {
            int       affect = -1;
            SqlHelper svc    = new SqlHelper(EnumBiz.onlineDB);
            string    sql    = "update modelAccessRecord set status = 0 where  qnRecId = ?";

            IDataParameter[] param = svc.CreateParm(1);
            param[0].Value = mdAccessRecord.qnRecId;
            affect         = svc.ExecSql(sql, param);
            return(affect);
        }
Beispiel #8
0
        /// <summary>
        /// 保存人员记录
        /// </summary>
        /// <param name="gxyRecord"></param>
        /// <param name="recId"></param>
        /// <returns></returns>
        public int SaveMdAccessRecord(EntitymModelAccessRecord mdAccessRec, out decimal recId)
        {
            int affectRows = 0;

            recId = 0;
            string    Sql = string.Empty;
            SqlHelper svc = null;

            try
            {
                if (mdAccessRec == null)
                {
                    return(-1);
                }
                decimal        id      = 0;
                List <DacParm> lstParm = new List <DacParm>();
                svc = new SqlHelper(EnumBiz.onlineDB);

                if (mdAccessRec.recId <= 0)
                {
                    string sql = @"insert into modelAccessRecord(recid,clientno,regtimes,regno,recorder,recorddate,status) values (?,?,?,?,?,?,?)";
                    id = svc.GetNextID("modelAccessRecord", "recId");
                    mdAccessRec.recordDate = DateTime.Now;
                    mdAccessRec.recorder   = "00";
                    IDataParameter[] param = svc.CreateParm(7);
                    param[0].Value = id;
                    param[1].Value = mdAccessRec.clientNo;
                    param[2].Value = mdAccessRec.regTimes;
                    param[3].Value = mdAccessRec.regNo;
                    param[4].Value = mdAccessRec.recorder;
                    param[5].Value = mdAccessRec.recordDate;
                    param[6].Value = mdAccessRec.status;
                    lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param));
                }
                recId = id;

                if (lstParm.Count > 0)
                {
                    affectRows = svc.Commit(lstParm);
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="disClientRpt"></param>
        /// <returns></returns>
        internal List <EntityModelAccess> GetModelAccess(EntitymModelAccessRecord mdAccessRecord)
        {
            List <EntityModelAccess>    data    = new List <EntityModelAccess>();
            Dictionary <string, string> dicData = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(mdAccessRecord.qnData))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(mdAccessRecord.qnData);
                XmlNodeList list = document["FormData"].ChildNodes;
                dicData = Function.ReadXML(mdAccessRecord.qnData);
            }
            int age = 0;

            if (dicData.ContainsKey("Birthday"))
            {
                age = CalcAge.GetAgeInt(Function.Datetime(dicData["Birthday"]));
            }
            string sexStr = dicData["Sex"];
            int    sex    = 0;

            if (sexStr == "男")
            {
                sex = 1;
            }
            if (sexStr == "女")
            {
                sex = 2;
            }

            if (lstModelAccess != null)
            {
                List <EntityModelAccess> tmpList = lstModelAccess.FindAll(r => (r.modelSex == sex || r.modelSex == 0));
                foreach (var maVo in tmpList)
                {
                    decimal minAge = maVo.minAge;
                    decimal maxAge = maVo.maxAge;

                    if (age >= minAge && age <= maxAge)
                    {
                        data.Add(maVo);
                    }
                }
            }

            return(data);
        }
Beispiel #10
0
        /// <summary>
        /// 重要指标
        /// </summary>
        /// <returns></returns>
        internal List <EntityReportMainItem> GetMainIndicate(EntitymModelAccessRecord vo)
        {
            List <EntityReportMainItem>       data = new List <EntityReportMainItem>();
            List <EntityReportMainItemConfig> lstMainItemConfig;

            using (ProxyHms proxy = new ProxyHms())
            {
                proxy.Service.GetTjResult(vo.regNo, out lstTjResult, out lstXjResult, out tjjljyVo);
                lstMainItemConfig = proxy.Service.GetReportMainItemConfig();
            }
            if (lstTjResult == null)
            {
                return(null);
            }
            EntityReportMainItem mainItem;

            foreach (var mConfig in lstMainItemConfig)
            {
                EntityTjResult result = lstTjResult.Find(r => r.itemCode == mConfig.itemCode);
                if (result != null)
                {
                    mainItem              = new EntityReportMainItem();
                    mainItem.reportId     = result.regNo;
                    mainItem.sectionName  = result.itemName;
                    mainItem.itemName     = result.itemName;
                    mainItem.itemValue    = result.itemResult;
                    mainItem.itemUnits    = result.unit;
                    mainItem.itemRefrange = result.range;
                    mainItem.isNormal     = result.hint;
                    if (!string.IsNullOrEmpty(result.hint))
                    {
                        mainItem.pic = ReadImageFile("picHint.png");
                    }
                    if (result.ttop == "2" && !string.IsNullOrEmpty(result.examinationNo))
                    {
                        EntityTjResult resultTmp = lstTjResult.Find(r => r.itemCode == result.examinationNo);
                        mainItem.sectionName = resultTmp.itemName;
                    }
                    data.Add(mainItem);
                }
            }

            return(data);
        }
Beispiel #11
0
        private void btnLoadReport_Click(object sender, EventArgs e)
        {
            List <EntityModelParamCalc>    lstMdParamCalc        = null;
            List <EntityRiskFactorsResult> lstRiskFactorsResults = null;
            frm20301 frm = new frm20301();
            EntitymModelAccessRecord mdAccessRecord = GetRowObject();

            if (mdAccessRecord != null)
            {
                if (mdAccessRecord.qnRecId <= 0)
                {
                    DialogBox.Msg("请在个人报告选择问卷,并生成报告!");
                    return;
                }
                frm.Init();
                EntityClientReport rpt    = frm.GneralPersonalReport(mdAccessRecord, out lstMdParamCalc, out lstRiskFactorsResults);
                frmPopup2030101    frmRpt = new frmPopup2030101(rpt);
                frmRpt.ShowDialog();
            }
        }
Beispiel #12
0
        /// <summary>
        /// 问卷
        /// </summary>

        public override void Remind()
        {
            List <EntityQnRecord>    dataQn = null;
            EntitymModelAccessRecord vo     = GetRowObject();

            if (vo != null)
            {
                if (vo.status == 1)
                {
                    DialogBox.Msg("该报告已审核,重新生成请先取消审核!");
                    return;
                }

                List <EntityParm> lstParms = new List <EntityParm>();
                EntityParm        parm     = new EntityParm();
                parm.key   = "clientNo";
                parm.value = vo.clientNo;
                lstParms.Add(parm);
                EntityParm parm2 = new EntityParm();
                parm2.key   = "qnType";
                parm2.value = "1";
                lstParms.Add(parm2);

                using (ProxyHms proxy = new ProxyHms())
                {
                    dataQn = proxy.Service.GetQnRecords(lstParms);
                }

                frmPopup2030102 frm = new frmPopup2030102(dataQn);
                frm.ShowDialog();

                if (frm.isSelect)
                {
                    vo.strQnDate = frm.qnRecord.strQnDate;
                    vo.qnRecId   = frm.qnRecord.recId;
                    vo.qnData    = frm.qnRecord.xmlData;
                }
            }
        }
Beispiel #13
0
        /// <summary>
        /// 反审核
        /// </summary>
        public override void Cancel()
        {
            int affect = -1;

            if (DialogBox.Msg("确定取消审核报告 ?", MessageBoxIcon.Question) == DialogResult.Yes)
            {
                EntitymModelAccessRecord vo = GetRowObject();
                if (vo != null)
                {
                    if (!string.IsNullOrEmpty(vo.qnData))
                    {
                        EntitymModelAccessRecord voR = new EntitymModelAccessRecord();
                        voR.regNo   = vo.regNo;
                        voR.qnRecId = vo.qnRecId;

                        using (ProxyHms proxy = new ProxyHms())
                        {
                            affect = proxy.Service.UnConfirmRpt(voR);
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                if (affect > 0)
                {
                    this.Search();
                }
                else
                {
                    DialogBox.Msg("反审核失败!");
                }
            }
        }
Beispiel #14
0
        /// <summary>
        /// 人员列表
        /// </summary>
        /// <param name="parms"></param>
        /// <returns></returns>
        public List <EntitymModelAccessRecord> GetModelAccessRec(List <EntityParm> parms)
        {
            List <EntitymModelAccessRecord> data = null;
            SqlHelper svc = new SqlHelper(EnumBiz.onlineDB);
            string    Sql = string.Empty;

            Sql = @"select a.recId,a.regNo,
                           b.clientNo,
                           b.clientName,
                           a.regTimes,
                           b.gender,
                           b.birthday,
                           b.gradeName,
                           b.company
                      from modelAccessRecord a
                     inner join V_ClientInfo b
                        on a.clientNo = b.clientNo  and a.regTimes = b.regTimes
                    where a.recid >= 0 ";
            string subStr = string.Empty;
            List <IDataParameter> lstParm = new List <IDataParameter>();

            if (parms != null)
            {
                foreach (var po in parms)
                {
                    switch (po.key)
                    {
                    case "queryDate":
                        IDataParameter[] param = svc.CreateParm(2);
                        param[0].Value = po.value.Split('|')[0] + " 00:00:00";
                        param[1].Value = po.value.Split('|')[1] + " 23:59:59";
                        subStr        += " and a.recordDate between ? and ?";
                        lstParm.AddRange(param);
                        break;

                    case "clientNo":
                        subStr += " and a.clientNo = '" + po.value + "'";
                        break;

                    case "regTimes":
                        subStr += " and a.regTimes = '" + po.value + "'";
                        break;

                    default:
                        break;
                    }
                }
            }
            Sql += subStr;
            DataTable dt = svc.GetDataTable(Sql, lstParm);

            if (dt != null && dt.Rows.Count > 0)
            {
                data = new List <EntitymModelAccessRecord>();
                EntitymModelAccessRecord vo = null;
                foreach (DataRow dr in dt.Rows)
                {
                    vo            = new EntitymModelAccessRecord();
                    vo.recId      = Function.Dec(dr["recId"]);
                    vo.regNo      = dr["regNo"].ToString();
                    vo.regTimes   = Function.Int(dr["regTimes"]);
                    vo.clientNo   = dr["clientNo"].ToString();
                    vo.clientName = dr["clientName"].ToString();
                    string gender = dr["gender"].ToString();
                    if (gender == "1")
                    {
                        vo.sex = "男";
                    }
                    else if (gender == "2")
                    {
                        vo.sex = "女";
                    }
                    vo.age       = dr["birthday"] == DBNull.Value ? "" : Function.CalcAge(Function.Datetime(dr["birthday"]));
                    vo.gradeName = dr["gradeName"].ToString();
                    vo.company   = dr["company"].ToString();
                    data.Add(vo);
                }
            }
            return(data);
        }
Beispiel #15
0
        /// <summary>
        /// 疾病模型结果及各项得分
        /// </summary>
        /// <param name="lstMdResult"></param>
        /// <returns></returns>

        public int SaveModelResultAndParamCalc(EntitymModelAccessRecord mdAccessRecord, List <EntityClientModelResult> lstMdResult, List <EntityModelParamCalc> lstMdParamCalc, List <EntityRiskFactorsResult> lstRiskFactorsResult)
        {
            SqlHelper svc    = null;
            int       affect = -1;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                List <DacParm> lstParm = new List <DacParm>();
                string         sql     = string.Empty;
                if (mdAccessRecord != null)
                {
                    lstParm.Add(svc.GetDelParmByPk(mdAccessRecord));
                    lstParm.Add(svc.GetInsertParm(mdAccessRecord));
                }

                if (lstMdResult != null)
                {
                    foreach (var mdVo in lstMdResult)
                    {
                        lstParm.Add(svc.GetDelParmByPk(mdVo));
                    }

                    foreach (var mdVo in lstMdResult)
                    {
                        lstParm.Add(svc.GetInsertParm(mdVo));
                    }
                }

                if (lstMdParamCalc != null)
                {
                    foreach (var mdVo in lstMdParamCalc)
                    {
                        lstParm.Add(svc.GetDelParmByPk(mdVo));
                    }

                    foreach (var mdVo in lstMdParamCalc)
                    {
                        lstParm.Add(svc.GetInsertParm(mdVo));
                    }
                }

                if (lstRiskFactorsResult != null)
                {
                    foreach (var rrVo in lstRiskFactorsResult)
                    {
                        lstParm.Add(svc.GetDelParmByPk(rrVo));
                    }

                    foreach (var rrVo in lstRiskFactorsResult)
                    {
                        lstParm.Add(svc.GetInsertParm(rrVo));
                    }
                }

                if (lstParm.Count > 0)
                {
                    affect = svc.Commit(lstParm);
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(ex);
                affect = -1;
            }
            finally
            {
                svc = null;
            }

            return(affect);
        }
Beispiel #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="modelId"></param>
        /// <returns></returns>
        internal List <EntityModelParamCalc> CalcModelResult(decimal modelId, EntitymModelAccessRecord vo, out decimal result, out decimal bestDf)
        {
            result = 0;
            bestDf = 0;
            bool ageFlag = false;
            List <EntityModelParamCalc> data        = null;
            EntityModelParamCalc        paramCalcVo = null;
            Dictionary <string, string> dicData     = new Dictionary <string, string>();
            List <EntityModelGroupItem> lstGxyModel = lstModelGroupItem.FindAll(r => r.modelId == modelId && r.isMain == 1);

            //EntityDisplayClientRpt vo = GetRowObject();
            if (!string.IsNullOrEmpty(vo.qnData))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(vo.qnData);
                XmlNodeList list = document["FormData"].ChildNodes;
                dicData = Function.ReadXML(vo.qnData);
            }

            if (lstGxyModel != null)
            {
                data = new List <EntityModelParamCalc>();
                foreach (var model in lstGxyModel)
                {
                    List <EntityModelParam> lstModelParamGxy = lstModelParam.FindAll(r => r.parentFieldId == model.paramNo && r.modelId == modelId);
                    if (lstModelParamGxy != null)
                    {
                        //问卷
                        if (model.paramType == 3 || model.paramType == 4)
                        {
                            foreach (var modelGxy in lstModelParamGxy)
                            {
                                if (!string.IsNullOrEmpty(vo.qnData))
                                {
                                    //评估得分
                                    if (dicData.ContainsKey(modelGxy.paramNo))
                                    {
                                        decimal score = 0;
                                        if (dicData[modelGxy.paramNo] == "1")
                                        {
                                            score += Function.Dec(modelGxy.score);

                                            paramCalcVo            = new EntityModelParamCalc();
                                            paramCalcVo.clientId   = vo.clientNo;
                                            paramCalcVo.qnRecId    = vo.qnRecId;
                                            paramCalcVo.regNo      = vo.regNo;
                                            paramCalcVo.modelId    = modelId;
                                            paramCalcVo.paramNo    = model.paramNo;
                                            paramCalcVo.paramName  = model.paramName;
                                            paramCalcVo.calcScore  = score;
                                            paramCalcVo.paramValue = dicData[modelGxy.paramNo];
                                            paramCalcVo.recordDate = DateTime.Now;

                                            if (data.Any(r => r.paramNo == paramCalcVo.paramNo && r.modelId == modelId && r.qnRecId == paramCalcVo.qnRecId && r.regNo == paramCalcVo.regNo))
                                            {
                                                EntityModelParamCalc cloneVo = data.Find(r => r.paramNo == paramCalcVo.paramNo && r.modelId == modelId && r.qnRecId == paramCalcVo.qnRecId && r.regNo == paramCalcVo.regNo);
                                                cloneVo.calcScore = score;
                                            }
                                            else
                                            {
                                                data.Add(paramCalcVo);
                                            }
                                        }

                                        result += score;
                                    }
                                    if (modelGxy.paramNo == "Age")
                                    {
                                        decimal df  = 0;
                                        decimal bDf = 0;
                                        decimal age = 0;
                                        if (dicData.ContainsKey("Birthday") && !ageFlag)
                                        {
                                            if (!string.IsNullOrEmpty(dicData["Birthday"]))
                                            {
                                                age                    = CalcAge.GetAgeInt(Function.Datetime(dicData["Birthday"]));
                                                df                     = CalcDf(age, modelId, modelGxy.paramNo, out bDf);
                                                result                += df;
                                                ageFlag                = true;
                                                paramCalcVo            = new EntityModelParamCalc();
                                                paramCalcVo.clientId   = vo.clientNo;
                                                paramCalcVo.regNo      = vo.regNo;
                                                paramCalcVo.qnRecId    = vo.qnRecId;
                                                paramCalcVo.modelId    = modelId;
                                                paramCalcVo.paramNo    = modelGxy.paramNo;
                                                paramCalcVo.paramName  = modelGxy.paramName;
                                                paramCalcVo.calcScore  = df;
                                                paramCalcVo.recordDate = DateTime.Now;
                                                paramCalcVo.paramValue = dicData["Birthday"];
                                                paramCalcVo.recordDate = DateTime.Now;
                                                data.Add(paramCalcVo);
                                            }
                                        }
                                    }
                                    //最佳状态 得分
                                    if (modelGxy.isBest == "1")
                                    {
                                        bestDf += Function.Dec(modelGxy.score);
                                    }
                                }
                            }
                        }
                        else if (model.paramType == 2)
                        {
                            if (lstTjResult == null)
                            {
                                continue;
                            }
                            EntityTjResult tjVo = lstTjResult.Find(r => r.itemCode == model.paramNo);
                            if (tjVo == null)
                            {
                                continue;
                            }
                            decimal tjValue = Function.Dec(tjVo.itemResult);
                            decimal df      = 0;
                            decimal bDf     = 0;
                            df                     = CalcDf(tjValue, modelId, model.paramNo, out bDf);
                            paramCalcVo            = new EntityModelParamCalc();
                            paramCalcVo.clientId   = vo.clientNo;
                            paramCalcVo.regNo      = vo.regNo;
                            paramCalcVo.qnRecId    = vo.qnRecId;
                            paramCalcVo.modelId    = modelId;
                            paramCalcVo.paramNo    = model.paramNo;
                            paramCalcVo.paramName  = model.paramName;
                            paramCalcVo.calcScore  = df;
                            paramCalcVo.recordDate = DateTime.Now;
                            paramCalcVo.paramValue = tjVo.itemResult.ToString();
                            result                += df;
                            bestDf                += bDf;
                            if (data.Any(r => r.modelId == modelId && r.paramNo == model.paramNo && paramCalcVo.qnRecId == vo.qnRecId))
                            {
                                continue;
                            }
                            else
                            {
                                data.Add(paramCalcVo);
                            }
                        }
                    }
                }
            }
            return(data);
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vo"></param>
        /// <returns></returns>
        internal List <EntityRiskFactorsResult> GetRiskFactorsResults(EntitymModelAccessRecord vo)
        {
            List <EntityRiskFactorsResult> data    = null;
            Dictionary <string, string>    dicData = new Dictionary <string, string>();

            if (vo == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(vo.qnData))
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(vo.qnData))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(vo.qnData);
                XmlNodeList list = document["FormData"].ChildNodes;
                dicData = Function.ReadXML(vo.qnData);
            }

            if (lstRiskFactor != null)
            {
                data = new List <EntityRiskFactorsResult>();
                EntityRiskFactorsResult riskResult = null;
                foreach (var risk in lstRiskFactor)
                {
                    if (risk.id == "AA001") //家族史
                    {
                        string[] arrParentId = risk.inCondition.Split(';');
                        for (int i = 0; i < arrParentId.Length; i++)
                        {
                            string parentId = arrParentId[i];
                            List <EntityQnFamilyDease> lstFamilyTmp = lstFamilyDease.FindAll(r => r.parentFieldId == parentId);
                            if (lstFamilyTmp == null)
                            {
                                continue;
                            }
                            foreach (var fVo in lstFamilyTmp)
                            {
                                string filedId = fVo.fieldId;
                                if (dicData.ContainsKey(filedId))
                                {
                                    if (dicData[filedId] == risk.jugeValue)
                                    {
                                        riskResult            = new EntityRiskFactorsResult();
                                        riskResult.clientId   = vo.clientNo;
                                        riskResult.questionId = vo.qnRecId;
                                        riskResult.factorsId  = risk.id;
                                        //riskResult.organFactorsId = "organFactorsId";
                                        riskResult.isFamilyDisease = "1";
                                        //riskResult.isHand = "isHand";
                                        //riskResult.happenDate = "happenDate";
                                        riskResult.advise    = risk.advice;
                                        riskResult.filedId   = filedId;
                                        riskResult.filedName = fVo.fieldName;
                                        //riskResult.supplyExplian = "supplyExplian";
                                        riskResult.recordDate = DateTime.Now;
                                        riskResult.recordId   = "00";
                                        data.Add(riskResult);
                                    }
                                }
                            }
                        }
                    }
                    else if (risk.inCondition.Contains(";"))
                    {
                        string[] arrIncondition = risk.inCondition.Split(';');
                        for (int i = 0; i < arrIncondition.Length; i++)
                        {
                            string incondition = arrIncondition[i];

                            if (dicData.ContainsKey(incondition))
                            {
                                if (dicData[incondition] == risk.jugeValue)
                                {
                                    riskResult            = new EntityRiskFactorsResult();
                                    riskResult.clientId   = vo.clientNo;
                                    riskResult.questionId = vo.qnRecId;
                                    riskResult.factorsId  = risk.id;
                                    riskResult.advise     = risk.advice;
                                    riskResult.filedId    = incondition;
                                    riskResult.recordDate = DateTime.Now;
                                    riskResult.recordId   = "00";
                                    data.Add(riskResult);
                                }
                            }
                        }
                    }
                    else
                    {
                        string incondition = risk.inCondition;
                        if (dicData.ContainsKey(incondition))
                        {
                            if (dicData[incondition] == risk.jugeValue)
                            {
                                riskResult            = new EntityRiskFactorsResult();
                                riskResult.clientId   = vo.clientNo;
                                riskResult.questionId = vo.qnRecId;
                                riskResult.factorsId  = risk.id;
                                riskResult.advise     = risk.advice;
                                riskResult.filedId    = incondition;
                                riskResult.recordDate = DateTime.Now;
                                riskResult.recordId   = "00";
                                data.Add(riskResult);
                            }
                        }
                    }
                }
            }

            return(data);
        }
Beispiel #18
0
        /// <summary>
        /// 疾病模型评估
        /// </summary>
        /// <returns></returns>
        internal EntityRptModelAcess GetRptModelParam(decimal modelId, EntitymModelAccessRecord vo, out List <EntityModelParamCalc> lstMdParamCalc)
        {
            EntityRptModelAcess modelAcess = new EntityRptModelAcess();

            lstMdParamCalc           = new List <EntityModelParamCalc>();
            modelAcess.lstModelParam = new List <EntityRptModelParam>();
            Dictionary <string, string> dicData = new Dictionary <string, string>();
            EntityRptModelParam         param   = null;

            try
            {
                modelAcess.modelId = modelId;
                List <EntityModelGroupItem> lstModelGroup = lstModelGroupItem.FindAll(r => r.modelId == modelId && r.isMain == 1);

                if (!string.IsNullOrEmpty(vo.qnData))
                {
                    XmlDocument document = new XmlDocument();
                    document.LoadXml(vo.qnData);
                    XmlNodeList list = document["FormData"].ChildNodes;
                    dicData = Function.ReadXML(vo.qnData);
                }

                #region 主要评估参数
                if (lstModelGroup != null)
                {
                    bool rFlag = false;
                    foreach (var model in lstModelGroup)
                    {
                        rFlag          = false;
                        param          = new EntityRptModelParam();
                        param.itemCode = model.paramNo;
                        param.itemName = model.paramName;
                        param.pointId  = model.pointId;
                        //问卷
                        if (model.paramType == 3 || model.paramType == 4)
                        {
                            List <EntityModelParam> lstModelParamTmp = lstModelParam.FindAll(r => r.parentFieldId == model.paramNo && r.modelId == modelId);
                            if (lstModelParamTmp != null)
                            {
                                foreach (var gxyModel in lstModelParamTmp)
                                {
                                    rFlag = false;
                                    if (gxyModel.isNormal == "1")
                                    {
                                        param.range = gxyModel.judgeRange;
                                    }
                                    if (dicData.ContainsKey(gxyModel.paramNo))
                                    {
                                        if (gxyModel.judgeType == 2)
                                        {
                                            if (Function.Dec(dicData[gxyModel.paramNo]) == gxyModel.judgeValue)
                                            {
                                                param.result = gxyModel.judgeRange;
                                            }
                                            if (string.IsNullOrEmpty(param.result))
                                            {
                                                param.result = "无";
                                            }
                                        }
                                        else
                                        {
                                            param.result = dicData[model.paramNo];
                                        }

                                        rFlag = true;
                                    }
                                }
                            }
                        }
                        //体检项目
                        else if (model.paramType == 2)
                        {
                            if (lstTjResult == null)
                            {
                                continue;
                            }
                            if (!lstTjResult.Any(r => r.itemCode == param.itemCode))
                            {
                                continue;
                            }
                            EntityTjResult tjR = lstTjResult.Find(r => r.itemCode == param.itemCode);
                            param.itemName = tjR.itemName;
                            param.result   = tjR.itemResult;
                            param.range    = tjR.range;
                            param.unit     = tjR.unit;
                            if (!string.IsNullOrEmpty(tjR.hint))
                            {
                                param.pic = ReadImageFile("picHint.png");
                            }
                            rFlag = true;
                        }
                        if (rFlag)
                        {
                            modelAcess.lstModelParam.Add(param);
                        }
                    }
                }
                #endregion

                #region 预防要点
                //预防要点
                List <int> lstPoint = new List <int>();
                modelAcess.lstPoint = new List <string>();
                if (modelAcess.lstModelParam != null)
                {
                    foreach (var pVo in modelAcess.lstModelParam)
                    {
                        if (!lstPoint.Contains(pVo.pointId))
                        {
                            lstPoint.Add(pVo.pointId);
                        }
                    }

                    for (int i = 0; i < lstPoint.Count; i++)
                    {
                        EntityModelAnalysisPoint pointVo = lstModelPoint.Find(r => r.id == lstPoint[i]);
                        if (pointVo != null)
                        {
                            modelAcess.lstPoint.Add(pointVo.pintAdvice);
                        }
                    }
                }
                #endregion

                #region 风险评估
                decimal bestDf = 0;
                decimal df     = 0;
                lstMdParamCalc      = CalcModelResult(modelId, vo, out df, out bestDf);
                modelAcess.df       = df;
                modelAcess.bestDf   = bestDf;
                modelAcess.reduceDf = modelAcess.df - modelAcess.bestDf;
                if (modelAcess.df <= 5)
                {
                    modelAcess.imgFx01   = ReadImageFile("picFx.png");
                    modelAcess.resultStr = "低危";
                }
                else if (modelAcess.df > 5 && modelAcess.df < 20)
                {
                    modelAcess.imgFx02   = ReadImageFile("picFx.png");
                    modelAcess.resultStr = "中危";
                }
                else if (modelAcess.df > 20 && modelAcess.df < 50)
                {
                    modelAcess.imgFx03   = ReadImageFile("picFx.png");
                    modelAcess.resultStr = "高危";
                }
                else if (modelAcess.df >= 50)
                {
                    modelAcess.imgFx04   = ReadImageFile("picFx.png");
                    modelAcess.resultStr = "很高危";
                }

                modelAcess.lstEvaluate = new List <EntityEvaluateResult>();
                EntityEvaluateResult voEr = new EntityEvaluateResult();
                voEr.result         = Function.Double(modelAcess.df.ToString("0.00"));
                voEr.evaluationName = "本次结果";
                modelAcess.lstEvaluate.Add(voEr);
                EntityEvaluateResult voEb = new EntityEvaluateResult();
                voEb.result         = Function.Double(modelAcess.bestDf.ToString("0.00"));
                voEb.evaluationName = "最佳状态";
                modelAcess.lstEvaluate.Add(voEb);
                EntityEvaluateResult voEa = new EntityEvaluateResult();
                voEa.result         = 18;
                voEa.evaluationName = "平均水平";
                modelAcess.lstEvaluate.Add(voEa);

                #endregion
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(ex);
            }

            return(modelAcess);
        }
Beispiel #19
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="parms"></param>
        /// <returns></returns>
        public List <EntitymModelAccessRecord> GetClientMdAccessRecord(List <EntityParm> parms)
        {
            List <EntitymModelAccessRecord> data = null;
            SqlHelper svc  = new SqlHelper(EnumBiz.onlineDB);
            string    sql  = string.Empty;
            string    sql1 = string.Empty;
            string    sql2 = string.Empty;

            sql1 = @"SELECT
	                    a.recId,
	                    a.regNo,
                        a.confirmDate,
	                    b.clientNo,
	                    b.clientName,
	                    a.regTimes,
	                    b.gender,
	                    b.birthday,
	                    b.gradeName,
	                    b.company,
                        a.recordDate,
						t.reportDate,
	                    c.recId as qnRecid,
	                    c.qnName,
	                    c.qnType,
	                    c.qnDate,
	                    c.qnSource,
	                    c.qnId,
	                    d.xmlData,
                        a.status
                    FROM modelAccessRecord a
                    LEFT JOIN V_ClientInfo b 
                    ON a.clientNo = b.clientNo
                    AND a.regTimes = b.regTimes
                    left join V_TJXX t
                    on a.regNo = t.reportNo
                    LEFT JOIN qnRecord c 
                    ON a.qnRecId = c.recId
                    LEFT JOIN qnData d 
                    ON a.qnRecId = d.recId
                    WHERE a.status >= 0  ";
            string strSub  = string.Empty;
            string strSub1 = string.Empty;
            string strSub2 = string.Empty;
            List <IDataParameter> lstParm = new List <IDataParameter>();

            if (parms != null)
            {
                foreach (var po in parms)
                {
                    switch (po.key)
                    {
                    case "search":
                        strSub += " and (a.clientName like '%" + po.value + "%' or a.clientNo like '" + po.value + "%' or a.reportNo like '%" + po.value + "%' )";
                        break;

                    case "reportDate":
                        IDataParameter parm1 = svc.CreateParm();
                        parm1.Value = po.value.Split('|')[0];
                        lstParm.Add(parm1);
                        IDataParameter parm2 = svc.CreateParm();
                        parm2.Value = po.value.Split('|')[1];
                        lstParm.Add(parm2);
                        strSub += " and  a.recordDate between ? and ? ";

                        break;

                    case "clientNo":
                        strSub += " and  a.clientNo = '" + po.value + "'";
                        break;

                    default:
                        break;
                    }
                }
            }
            sql1 += strSub;
            DataTable dt = svc.GetDataTable(sql1, lstParm.ToArray());

            if (dt != null && dt.Rows.Count > 0)
            {
                data = new List <EntitymModelAccessRecord>();
                EntitymModelAccessRecord vo = null;
                foreach (DataRow dr in dt.Rows)
                {
                    vo            = new EntitymModelAccessRecord();
                    vo.recId      = Function.Dec(dr["recId"]);
                    vo.regNo      = dr["regNo"].ToString();
                    vo.recordDate = Function.Datetime(dr["recordDate"]);
                    Function.SetClientInfo(ref vo, dr);
                    vo.reportDateStr = Function.Datetime(dr["reportDate"]).ToString("yyyy-MM-dd");
                    vo.regTimes      = Function.Int(dr["regTimes"]);
                    vo.status        = Function.Int(dr["status"]);

                    if (dr["confirmDate"] != DBNull.Value)
                    {
                        vo.confirmDateStr = Function.Datetime(dr["confirmDate"]).ToString("yyyy-MM-dd");
                    }
                    if (!string.IsNullOrEmpty(dr["qnRecid"].ToString()))
                    {
                        vo.strQnDate   = Function.Datetime(dr["qnDate"]).ToString("yyyy-MM-dd");
                        vo.qnRecId     = Function.Dec(dr["qnRecid"]);
                        vo.qnName      = dr["qnName"].ToString();
                        vo.qnId        = Function.Dec(dr["qnId"]);
                        vo.strQnSource = "采集系统";
                        vo.qnData      = dr["xmlData"].ToString();
                    }

                    data.Add(vo);
                }
            }

            return(data);
        }
Beispiel #20
0
        /// <summary>
        /// 审核
        /// </summary>
        public override void Confirm()
        {
            try
            {
                this.BeginLoading();
                int affect = -1;
                EntitymModelAccessRecord       mdAccessRecord       = GetRowObject();
                List <EntityModelParamCalc>    lstMdParamCalc       = null;
                List <EntityRiskFactorsResult> lstRiskFactorsResult = null;
                if (mdAccessRecord.qnRecId <= 0)
                {
                    DialogBox.Msg("请选择问卷");
                    return;
                }

                if (mdAccessRecord.status == 1)
                {
                    DialogBox.Msg("该报告已审核,重新生成请先取消审核!");
                    return;
                }

                EntityClientReport             rpt         = GneralPersonalReport(mdAccessRecord, out lstMdParamCalc, out lstRiskFactorsResult);
                List <EntityClientModelResult> lstMdResult = null;

                if (rpt != null)
                {
                    mdAccessRecord.status      = 1;
                    mdAccessRecord.confirmDate = DateTime.Now;
                    if (rpt.lstRptModelAcess != null)
                    {
                        lstMdResult = new List <EntityClientModelResult>();
                        foreach (var mdAVo in rpt.lstRptModelAcess)
                        {
                            EntityClientModelResult vo = new EntityClientModelResult();
                            vo.clientId    = rpt.clientNo;
                            vo.reportId    = rpt.reportNo;
                            vo.qnRecId     = mdAccessRecord.qnRecId;
                            vo.modelId     = mdAVo.modelId;
                            vo.modelResult = mdAVo.resultStr;
                            vo.modelScore  = mdAVo.df;
                            vo.createDate  = DateTime.Now;

                            lstMdResult.Add(vo);
                        }
                    }
                }

                if (lstMdResult != null && lstMdParamCalc != null)
                {
                    using (ProxyHms proxy = new ProxyHms())
                    {
                        affect = proxy.Service.SaveModelResultAndParamCalc(mdAccessRecord, lstMdResult, lstMdParamCalc, lstRiskFactorsResult);
                    }
                }

                if (affect > 0)
                {
                    DialogBox.Msg("报告审核完成!");
                }
            }
            //catch (Exception ex)
            //{
            //    ExceptionLog.OutPutException(ex);
            //}
            finally
            {
                this.CloseLoading();
            }
        }