Ejemplo n.º 1
0
        /// <summary>
        /// 获取数据的文本值
        /// </summary>
        /// <returns></returns>
        public virtual string GetDataText()
        {
            string strValue = string.Empty;

            if (this.InfoType == EnumPatientInfoType.年龄)
            {
                if (GlobalPatient.currPatient != null)
                {
                    if (CalcAgeType == 1)
                    {
                        strValue = CalcAge.GetAge(GlobalPatient.currPatient.Birthday, GlobalPatient.currPatient.RegisterDate);
                    }
                    else
                    {
                        int intAge = CalcAge.GetAgeInt(GlobalPatient.currPatient.Birthday);
                        if (intAge < 1)
                        {
                            strValue = CalcAge.GetAge(GlobalPatient.currPatient.Birthday, GlobalPatient.currPatient.RegisterDate);
                        }
                        else
                        {
                            strValue = CalcAge.GetAge(GlobalPatient.currPatient.Birthday);
                        }
                    }
                }
            }
            else
            {
                strValue = PatientInfoHelper.GetTypePatientInfo(this.InfoType);
            }

            return(strValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取传染病列表
        /// </summary>
        /// <param name="dicParm"></param>
        /// <returns></returns>
        internal List <EntityContagionDisplay> GetContagionList(List <EntityParm> dicParm)
        {
            string Sql     = string.Empty;
            string Sql1    = string.Empty;
            string xmlData = string.Empty;
            Dictionary <string, string>   dicData = new Dictionary <string, string>();
            List <EntityContagionDisplay> data    = new List <EntityContagionDisplay>();
            SqlHelper svc = null;

            try
            {
                #region Sql
                svc = new SqlHelper(EnumBiz.onlineDB);
                Sql = @"select t.rptId,
                               t.reportId,
                               t.reportTime,
                               t.reportOperCode,
                               t.reportOperName,
                               t.registerCode,
                               t.patno,
                               t.patname,
                               t.patsex,
                               t.birthday,
                               t.contacttel,
                               t.deptcode,
                               b.DEPT_NAME as deptName,
                               c.xmlData
                          from rptContagion t
                          left join code_department b
                            on t.deptcode = b.DEPT_CODE
                          left join rptContagionData c 
                            on t.rptId = c.rptId
                         where t.status = 1
                           and t.reportId = ?
                           ";

                Sql1 = @"select t.rptId,
                               t.reportId,
                               t.reportTime,
                               t.reportOperCode,
                               t.reportOperName,
                               t.registerCode,
                               t.patno,
                               t.patname,
                               t.patsex,
                               t.birthday,
                               t.contacttel,
                               t.deptcode,
                               b.DEPT_NAME as deptName,
                               c.xmlData
                          from rptContagion t
                         inner join patientinfo a
                            on t.patno = a.CARD_NO
                          left join code_department b
                            on t.deptcode = b.DEPT_CODE
                         left join rptContagionData c 
                            on t.rptId = c.rptId
                         where t.status = 1
                           and t.reportId = ?
                           ";
                #endregion

                #region 条件

                string strSub = string.Empty;
                List <IDataParameter> lstParm = new List <IDataParameter>();
                // 默认参数
                IDataParameter parm = svc.CreateParm();
                parm.Value = dicParm.FirstOrDefault(t => t.key == "reportId").value;
                lstParm.Add(parm);

                foreach (EntityParm po in dicParm)
                {
                    parm = svc.CreateParm();
                    string keyValue = po.value;
                    parm.Value = keyValue;
                    switch (po.key)
                    {
                    case "reportDate":
                        IDataParameter parm1 = svc.CreateParm();
                        parm1.Value = keyValue.Split('|')[0] + " 00:00:00";
                        lstParm.Add(parm1);
                        IDataParameter parm2 = svc.CreateParm();
                        parm2.Value = keyValue.Split('|')[1] + " 23:59:59";
                        lstParm.Add(parm2);
                        strSub += " and (t.reportTime between ? and ?)";
                        break;

                    case "deptCode":
                        if (keyValue.IndexOf("','") > 0)
                        {
                            strSub += " and (t.deptCode in (" + keyValue + "))";
                        }
                        else
                        {
                            parm.Value = parm.Value.ToString().Replace("'", "");
                            lstParm.Add(parm);
                            strSub += " and (t.deptCode = ?)";
                        }
                        break;

                    case "cardNo":
                        lstParm.Add(parm);
                        strSub += " and (t.patno= ?)";
                        break;

                    case "patName":
                        Sql        = Sql1;
                        parm.Value = "%" + keyValue + "%";
                        lstParm.Add(parm);
                        strSub += " and (a.name like ?)";
                        break;

                    default:
                        break;
                    }
                }

                #endregion

                #region 赋值

                // 组合条件
                Sql += strSub;
                DataTable dt = svc.GetDataTable(Sql, lstParm.ToArray());
                if (dt != null)
                {
                    EntityContagionDisplay vo = null;
                    foreach (DataRow dr in dt.Rows)
                    {
                        vo                = new EntityContagionDisplay();
                        vo.rptId          = dr["rptId"].ToString();
                        vo.reportTime     = dr["reportTime"].ToString();
                        vo.reportOperCode = dr["reportOperCode"].ToString();
                        vo.reportOperName = dr["reportOperName"].ToString();
                        vo.registerCode   = dr["registerCode"].ToString();
                        vo.patNo          = dr["patNo"].ToString();
                        vo.patName        = dr["patName"].ToString();
                        vo.patSex         = dr["patSex"].ToString() == "1" ? "男" : "女";
                        if (dr["birthday"] != DBNull.Value)
                        {
                            vo.patBirthDay = dr["birthday"].ToString();
                            vo.patAge      = CalcAge.GetAge(Function.Datetime(dr["birthday"]));
                        }
                        vo.contactTel = dr["contactTel"].ToString();
                        vo.deptName   = dr["deptName"].ToString();

                        xmlData = dr["xmlData"].ToString();
                        if (!string.IsNullOrEmpty(xmlData))
                        {
                            dicData = Function.ReadXmlNodes(xmlData, "FormData");
                            if (dicData.ContainsKey("XSHR") && dicData["XSHR"] != "")
                            {
                                vo.SH  = "已审核";
                                vo.SHR = dicData["XSHR"];
                            }
                            if (dicData.ContainsKey("XSHD") && dicData["XSHD"] != "")
                            {
                                vo.SHSJ = dicData["XSHD"];
                            }
                            if (dicData.ContainsKey("XBKS") && dicData["XBKS"] != "")
                            {
                                vo.reportDept = dicData["XBKS"];
                            }
                        }
                        data.Add(vo);
                    }
                }
                #endregion
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
            }
            finally
            {
                svc = null;
            }
            return(data);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parms"></param>
        /// <returns></returns>
        public List <EntityQnRecord> GetQnRecords(List <EntityParm> parms)
        {
            List <EntityQnRecord> data = null;
            SqlHelper             svc  = new SqlHelper(EnumBiz.onlineDB);
            string Sql = string.Empty;

            Sql = @"select a.recId,
                           b.clientNo,
                           b.clientName,
                           b.gender,
						   b.gradeName,
                           b.birthday,
                           a.qnName,
						   a.qnType,
                           a.qnDate,
                           a.qnSource,
                           a.qnId,
                           d.oper_name as recorder,
                           q.xmlData
                        from qnRecord a
                     left join qnData q
                        on a.recId = q.recId
                     inner join v_clientInfo b
                        on a.clientNo = b.clientNo
                      left join code_operator d
                        on a.recorder = d.oper_code 
                            where a.status != -1";

            string sub = string.Empty;

            if (parms != null)
            {
                foreach (EntityParm pa in parms)
                {
                    string key = pa.key;

                    switch (key)
                    {
                    case "qnType":
                        sub += " and a.qnType = '" + pa.value + "'";
                        break;

                    case "clientNo":
                        sub += " and a.clientNo = '" + pa.value + "'";
                        break;

                    case "search":
                        sub += "and a.clientNo like '%" + pa.value + "%' or a.clientName like '%" + pa.value + "%'";
                        break;

                    default:
                        break;
                    }
                }
            }

            if (!string.IsNullOrEmpty(sub))
            {
                Sql += sub;
            }

            DataTable dt = svc.GetDataTable(Sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                data = new List <EntityQnRecord>();
                EntityQnRecord vo = null;
                foreach (DataRow dr in dt.Rows)
                {
                    vo        = new EntityQnRecord();
                    vo.recId  = Function.Dec(dr["recId"]);
                    vo.gender = Function.Int(dr["gender"]);
                    if (vo.gender == 1)
                    {
                        vo.sex = "男";
                    }
                    if (vo.gender == 2)
                    {
                        vo.sex = "女";
                    }
                    vo.clientNo   = dr["clientNo"].ToString();
                    vo.clientName = dr["clientName"].ToString();
                    vo.gradeName  = dr["gradeName"].ToString();
                    vo.age        = dr["birthday"] == DBNull.Value ? "" : CalcAge.GetAge(Function.Datetime(dr["birthday"]));
                    vo.qnName     = dr["qnName"].ToString();
                    vo.qnId       = Function.Dec(dr["qnId"]);
                    vo.qnSource   = Function.Dec(dr["qnSource"]);
                    if (vo.qnSource == 1)
                    {
                        vo.strQnSource = "采集系统";
                    }
                    vo.qnDate    = Function.Datetime(dr["qnDate"]);
                    vo.strQnDate = Function.Datetime(dr["qnDate"]).ToString("yyyy-MM-dd");
                    vo.recorder  = dr["recorder"].ToString();
                    vo.xmlData   = dr["xmlData"].ToString();
                    if (data.Any(r => r.recId == vo.recId))
                    {
                        continue;
                    }
                    data.Add(vo);
                }
            }
            return(data);
        }