/// <summary> /// LoadForm /// </summary> /// <param name="vo"></param> internal void LoadForm(EntityAccount vo) { try { if (vo == null || string.IsNullOrEmpty(vo.FuncCode)) { return; } this.IsLoadform = true; string strPath = Application.StartupPath + "\\" + vo.FuncFile.Trim(); string className = vo.FuncCode.Trim(); if (className.IndexOf("|") > 0) { className = className.Substring(0, className.IndexOf("|")); } Assembly objAsm = Assembly.LoadFrom(strPath); object obj = objAsm.CreateInstance(className, true); Type objType = obj.GetType(); MethodInfo objMth; int n = 0; foreach (Form frm in Viewer.MdiChildren) { if (frm is frmBaseMdi) { n++; } } if (n >= 10) { DialogBox.Msg("界面设定为最多打开10个,请关闭暂时不需要的界面。", MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(vo.OperName)) { vo.OperName = "Show"; } string strMethod = vo.OperName; object[] objParams = null; int intIndex = strMethod.IndexOf("("); if (intIndex != -1) //带参 { string strParam = strMethod.Substring(intIndex + 1, strMethod.Length - intIndex - 2); objParams = strParam.Split(','); strMethod = strMethod.Substring(0, intIndex); objMth = objType.GetMethod(strMethod); } else { objMth = objType.GetMethod(vo.OperName, new Type[0]); } if (objMth == null) { DialogBox.Msg("自动创建模块失败。", MessageBoxIcon.Exclamation, Viewer); } if (obj is Form) { if (!FormExisted(obj.GetType(), vo.OperName)) { //if (vo.OperName.ToLower().Equals("show")) uiHelper.BeginLoading(Viewer); if (vo.OperName.ToLower().Contains("show")) { uiHelper.BeginLoading(Viewer); } GetFormFuncButton(vo.FuncCode); ((Form)obj).AccessibleName = vo.FuncCode; ((Form)obj).AccessibleDescription = vo.FuncName; MakeMdiForm(obj, vo.OperName); objMth.Invoke(obj, objParams); } } } catch (Exception e) { ExceptionLog.OutPutException(e); DialogBox.Msg(e.Message, MessageBoxIcon.Exclamation, Viewer); } finally { uiHelper.CloseLoading(Viewer); this.IsLoadform = false; } }
/// <summary> /// 保存 /// </summary> /// <param name="vo"></param> /// <param name="lstDet"></param> /// <param name="qnId"></param> /// <returns></returns> public int SaveQNnormal(EntityDicQnMain vo, List <EntityDicQnDetail> lstDet, out decimal qnId, List <EntityDicQnCtlLocation> lstLaction = null, List <EntityDicQnSetting> lstSettings = null) { int affectRows = 0; qnId = 0; string Sql = string.Empty; SqlHelper svc = null; try { svc = new SqlHelper(EnumBiz.onlineDB); if (vo.qnId <= 0) { Sql = @"select max(t.qnId) as maxId from dicQnMain t"; DataTable dt = svc.GetDataTable(Sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0]["maxId"] != DBNull.Value) { vo.qnId = Convert.ToDecimal(dt.Rows[0]["maxId"]) + 1; } } if (vo.qnId <= 0) { vo.qnId = 1; } } if (lstDet != null) { foreach (EntityDicQnDetail item in lstDet) { item.qnId = vo.qnId; } } if (lstLaction != null) { foreach (EntityDicQnCtlLocation item in lstLaction) { item.qnId = vo.qnId; } } if (lstSettings != null) { foreach (EntityDicQnSetting item in lstSettings) { item.qnId = vo.qnId; } } List <DacParm> lstParm = new List <DacParm>(); List <DacParm> lstParam2 = new List <DacParm>(); lstParm.Add(svc.GetDelParmByPk(vo)); lstParm.Add(svc.GetInsertParm(vo)); if (lstDet != null && lstDet.Count > 0) { lstParam2.Add(svc.GetDelParm(lstDet[0], EntityDicQnDetail.Columns.qnId)); lstParam2.Add(svc.GetInsertParm(lstDet.ToArray())); } if (lstLaction != null && lstLaction.Count > 0) { lstParm.Add(svc.GetDelParmByPk(lstLaction.ToArray())); lstParm.Add(svc.GetInsertParm(lstLaction.ToArray())); } if (lstSettings != null && lstSettings.Count > 0) { lstParm.Add(svc.GetDelParm(lstSettings[0], EntityDicQnSetting.Columns.qnId)); lstParm.Add(svc.GetInsertParm(lstSettings.FindAll(r => r.status == 1).ToArray())); } if (lstParam2.Count > 0) { affectRows = svc.Commit(lstParam2); } if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } qnId = vo.qnId; } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; qnId = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="ipNo"></param> /// <returns></returns> public List <entityLisInfo> QueryReport(string startDate, string endDate, string cardNo, ref int printed, ref int unPrinted) { string Sql = string.Empty; DataTable dt = null; SqlHelper svc = null; int n = 0; List <entityLisInfo> data = new List <entityLisInfo>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select distinct d.patientcardid_chr, s.application_id_chr, s.appl_dat, b.report_dat, a.check_content_vchr, s.patient_name_vchr, s.sex_chr, s.age_chr, s.patient_inhospitalno_chr, b.report_group_id_chr, b.report_print_chr, b.status_int from t_opr_lis_application a inner join t_opr_lis_app_report b on a.application_id_chr = b.application_id_chr and b.status_int > 0 inner join t_bse_patientcard d on a.patientcardid_chr = d.patientcardid_chr and d.status_int != 0 left join t_opr_lis_sample s on a.application_id_chr = s.application_id_chr where a.pstatus_int = 2 and b.status_int = 2 and b.report_dat is not null and s.status_int >= 3 and s.status_int <= 6 and s.patient_type_chr = 2 and d.patientcardid_chr = ? and s.modify_dat between to_date(?,'yyyy-mm-dd hh24:mi:ss') and to_date(?,'yyyy-mm-dd hh24:mi:ss') order by s.application_id_chr "; IDataParameter[] param = null; param = svc.CreateParm(3); param[0].Value = cardNo; param[1].Value = startDate + " 00:00:00";; param[2].Value = endDate + " 23:59:59"; dt = svc.GetDataTable(Sql, param); #region 赋值 if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { entityLisInfo vo = new entityLisInfo(); //vo.barCode = dr["barcode_vchr"].ToString(); vo.name = dr["check_content_vchr"].ToString(); vo.cardNo = dr["patientcardid_chr"].ToString(); vo.patName = dr["patient_name_vchr"].ToString(); vo.sex = dr["sex_chr"].ToString(); vo.age = dr["age_chr"].ToString(); vo.appDate = Function.Datetime(dr["appl_dat"]).ToString("yyyy-MM-dd HH:mm"); vo.rptDate = Function.Datetime(dr["report_dat"]).ToString("yyyy-MM-dd HH:mm"); vo.rptGroupId = dr["report_group_id_chr"].ToString(); vo.applicationId = dr["application_id_chr"].ToString(); vo.checkContent = dr["check_content_vchr"].ToString().Trim(); vo.printeded = dr["report_print_chr"].ToString(); if (vo.printeded == "" || vo.printeded == "0") { unPrinted++; if (vo.checkContent.Contains("性激素6项") && vo.checkContent.Contains("绒毛膜促性腺激素定量")) { unPrinted++; entityLisInfo vo1 = new entityLisInfo(); vo1.checkContent = dr["check_content_vchr"].ToString().Trim(); vo1.printeded = "1"; data.Add(vo1); } else { vo.checkContent = string.Empty; } } else { printed++; } vo.n = ++n; data.Add(vo); } } #endregion } catch (Exception objEx) { ExceptionLog.OutPutException("QueryReport-->" + objEx); printed = -1; } return(data); }
public long m_lngGetCheckResultByReportGroupIDAndApplicationID(IPrincipal p_objPrincipal, string p_strApplicationID, string p_strReportGroupID, bool p_blnConfirmed, out DataTable p_dtbCheckResult) { p_dtbCheckResult = null; long result = -1; string str = ""; if (p_blnConfirmed) { str = " and t2.status_int = 2"; } else { str = " and t2.status_int > 0"; } string Sql = @"select t4.oringin_dat,t3.sample_id_chr from t_opr_lis_app_report t2, t_opr_lis_app_sample t3, t_opr_lis_application t4 where t2.application_id_chr = ? and t2.report_group_id_chr = ? and t4.application_id_chr = t2.application_id_chr and t4.pstatus_int >= 0 and t3.application_id_chr = t2.application_id_chr and t3.report_group_id_chr = t2.report_group_id_chr "; string Sql2 = @"select /*+ use_hash(t1) */ t1.*,t9.print_title_vchr, t5.print_seq_int as report_print_seq_int, t8.item_print_seq_int as sample_print_seq_int, t7.rptno_chr, t7.check_item_english_name_vchr, t7.assist_code02_chr as item_type, t7.shortname_chr from (select /*+ all_rows */ * from t_opr_lis_check_result where sample_id_chr = ? and modify_dat >= to_date(?, 'yyyy-mm-dd hh24:mi:ss') and status_int = 1) t1, t_aid_lis_report_group_detail t5, t_bse_lis_check_item t7, v_lis_bse_sample_group_items t8, t_aid_lis_sample_group t9 where t9.sample_group_id_chr = t1.groupid_chr and t7.check_item_id_chr = t1.check_item_id_chr and t8.check_item_id_chr = t1.check_item_id_chr and t8.sample_group_id_chr = t1.groupid_chr and t5.sample_group_id_chr = t1.groupid_chr"; Sql += str; try { SqlHelper svc = null; svc = new SqlHelper(EnumBiz.onlineDB); IDataParameter[] param = null; param = svc.CreateParm(2); param[0].Value = p_strApplicationID; param[1].Value = p_strReportGroupID; p_dtbCheckResult = svc.GetDataTable(Sql, param); if (p_dtbCheckResult != null && p_dtbCheckResult.Rows.Count > 0) { string value = p_dtbCheckResult.Rows[0]["sample_id_chr"].ToString().Trim(); string value2 = p_dtbCheckResult.Rows[0]["oringin_dat"].ToString().Trim(); IDataParameter[] param2 = null; param2 = svc.CreateParm(2); param2[0].Value = value; param2[1].Value = value2; p_dtbCheckResult = null; p_dtbCheckResult = svc.GetDataTable(Sql2, param2); } } catch (Exception objEx) { ExceptionLog.OutPutException("m_lngGetCheckResultByReportGroupIDAndApplicationID-->" + objEx); } if (p_dtbCheckResult != null && p_dtbCheckResult.Rows.Count > 0) { result = 1; } return(result); }
/// <summary> /// 保存人员记录 /// </summary> /// <param name="tnbRecord"></param> /// <param name="recId"></param> /// <returns></returns> public int SaveTnbRecord(EntityTnbRecord tnbRecord, out decimal recId) { int affectRows = 0; recId = 0; string Sql = string.Empty; SqlHelper svc = null; try { if (tnbRecord == null) { return(-1); } decimal id = 0; List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); if (tnbRecord.recId <= 0) { string sql = @"insert into tnbRecord(recid,clientno,regtimes,regno,beginDate,recorder,recorddate,status) values (?,?,?,?,?,?,?,?)"; id = svc.GetNextID("tnbRecord", "recId"); tnbRecord.recordDate = DateTime.Now; tnbRecord.beginDate = DateTime.Now; tnbRecord.recorder = "00"; IDataParameter[] param = svc.CreateParm(8); param[0].Value = id; param[1].Value = tnbRecord.clientNo; param[2].Value = tnbRecord.regTimes; param[3].Value = tnbRecord.regNo; param[4].Value = tnbRecord.beginDate; param[5].Value = tnbRecord.recorder; param[6].Value = tnbRecord.recordDate; param[7].Value = tnbRecord.status; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } else { string sql = @"update tnbRecord set beginDate = ?, manageLevel = ?, nextSfDate = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(4); param[0].Value = tnbRecord.beginDate; param[1].Value = tnbRecord.manageLevel; param[2].Value = tnbRecord.nextSfDate; param[3].Value = tnbRecord.recId; 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); }
internal List <EntityBxgy> GetBxgy(string dteStart, string dteEnd, int flg) { string Sql = string.Empty; SqlHelper svc = null; List <EntityBxgy> data = new List <EntityBxgy>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select distinct a.patient_name_vchr AS HZXM, --患者姓名 a.sex_chr, a.patient_inhospitalno_chr, a.patientcardid_chr, a.appl_deptid_chr, e.deptname_vchr AS deptName, -- 送检科室 e1.lastname_vchr AS applyDoct, -- 申请医生 e2.lastname_vchr AS checker, --检验者 r1.check_item_id_chr , r1.check_item_name_vchr, t2.check_category_desc_vchr, d.sampletype_vchr AS BBLX, --标本类型 to_char(d.sampling_date_dat, 'yyyy-mm-dd hh24:mi:ss') AS CYSJ, --采样时间 to_char(r.report_dat, 'yyyy-mm-dd hh24:mi:ss') AS BGSJ, --报告时间 r1.refrange_vchr, r1.max_val_dec, r1.min_val_dec, r1.result_vchr from t_opr_lis_application a left join t_opr_lis_sample d on a.application_id_chr = d.application_id_chr left join t_opr_lis_app_apply_unit t on a.application_id_chr = t.application_id_chr left join t_aid_lis_apply_unit t1 on t.apply_unit_id_chr = t1.apply_unit_id_chr left join t_bse_lis_check_category t2 on t1.check_category_id_chr = t2.check_category_id_chr left join t_opr_lis_app_report r on a.application_id_chr = r.application_id_chr left join t_bse_deptdesc e on a.appl_deptid_chr = e.deptid_chr left join t_bse_employee e1 on a.appl_empid_chr = e1.empid_chr left join t_opr_lis_check_result r1 on d.sample_id_chr = r1.sample_id_chr left join t_bse_employee e2 on r.reportor_id_chr = e2.empid_chr where d.status_int > 5 and a.pstatus_int = 2 and r.report_dat between to_date(?, 'yyyy-mm-dd hh24:mi:ss') and to_date(?, 'yyyy-mm-dd hh24:mi:ss') and r.report_dat is not null and r.status_int > 1 and r1.result_vchr <> '\' and r1.status_int = 1 and r1.check_item_id_chr = '001782' order by e.deptname_vchr"; IDataParameter[] parm = svc.CreateParm(2); parm[0].Value = dteStart + " 00:00:00"; parm[1].Value = dteEnd + " 23:59:59";; DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { int n = 0; foreach (DataRow dr in dt.Rows) { EntityBxgy vo = new EntityBxgy(); vo.HZXM = dr["HZXM"].ToString(); if (!string.IsNullOrEmpty(dr["patient_inhospitalno_chr"].ToString().Trim())) { vo.KH = dr["patient_inhospitalno_chr"].ToString(); } else { vo.KH = dr["patientcardid_chr"].ToString(); } vo.BGSJ = dr["BGSJ"].ToString(); if (!string.IsNullOrEmpty(dr["result_vchr"].ToString().Trim())) { vo.JG = Function.Int(dr["result_vchr"]); } if (vo.JG < 20) { continue; } vo.n = ++n; data.Add(vo); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } return(data); }
/// <summary> /// AddQuestCtrl /// </summary> void AddQuestCtrl(EntityQnRecord qnRecord) { try { if (qnRecord != null) { if (!string.IsNullOrEmpty(qnRecord.xmlData)) { XmlDocument document = new XmlDocument(); document.LoadXml(qnRecord.xmlData); XmlNodeList list = document["FormData"].ChildNodes; xmlData = list[9].OuterXml; dicData = Function.ReadXML(xmlData); } } using (ProxyHms proxy = new ProxyHms()) { lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[8], qnRecord.qnId); lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); proxy.Service.GetQnCustom(1, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { if (clVo.name.Contains("FM")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; if (clVo.name == "FM0902" || clVo.name == "FM0903") { lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.ForeColor = System.Drawing.Color.Red; lblTopic.WidthF = clVo.width + 10; } else { lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); } locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.WidthF = clVo.width; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); } } } List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[8]) { if (string.IsNullOrEmpty(item.parentFieldId)) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = item.fieldId; lblTopic.Text = item.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == item.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; lblTopic.WidthF = ctrLocat.width; //lblTopic.HeightF = ctrLocat.height; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { if (childVo.typeId != "3") { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; chkAns.Width = ctrLocatChild.width; //chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); } else { DevExpress.XtraReports.UI.XRLabel txtAns = new DevExpress.XtraReports.UI.XRLabel(); string strEndWith = childVo.fieldId.Substring(4, 2); txtAns.Text = childVo.fieldName; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; txtAns.Width = ctrLocatChild.width; //txtAns.Height = ctrLocatChild.height; txtAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; txtAns.Text = value; } this.Detail.Controls.Add(txtAns); } } } } } } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } finally { } }
/// <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); }
/// <summary> /// 保存 /// </summary> /// <param name="vo"></param> /// <param name="rptId"></param> /// <returns></returns> internal int SaveContagion(EntityRptContagion vo, string reqNo, out decimal rptId) { int affectRows = 0; rptId = 0; string Sql = string.Empty; IDataParameter[] parm = null; SqlHelper svc = null; try { List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); EntityRptContagionData voData = new EntityRptContagionData(); if (vo.rptId <= 0) // new { rptId = svc.GetNextID(EntityTools.GetTableName(vo), EntityTools.GetFieldName(vo, EntityRptContagion.Columns.rptId)); vo.rptId = rptId; lstParm.Add(svc.GetInsertParm(vo)); voData.rptId = rptId; voData.xmlData = vo.xmlData; lstParm.Add(svc.GetInsertParm(voData)); if (!string.IsNullOrEmpty(reqNo)) { Sql = @"update rptContagion set reques_no = ? where rptId = ?"; parm = svc.CreateParm(2); parm[0].Value = reqNo; parm[1].Value = rptId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, Sql, parm)); } } else // edit { lstParm.Add(svc.GetUpdateParm(vo, new List <string>() { EntityRptContagion.Columns.reportTime, EntityRptContagion.Columns.reportOperCode, EntityRptContagion.Columns.reportOperName, EntityRptContagion.Columns.reportId, EntityRptContagion.Columns.registerCode, EntityRptContagion.Columns.patType, EntityRptContagion.Columns.patNo, EntityRptContagion.Columns.patName, EntityRptContagion.Columns.patSex, EntityRptContagion.Columns.birthday, EntityRptContagion.Columns.idCard, EntityRptContagion.Columns.contactAddr, EntityRptContagion.Columns.contactTel, EntityRptContagion.Columns.deptCode, EntityRptContagion.Columns.formId, EntityRptContagion.Columns.operCode, EntityRptContagion.Columns.recordDate, EntityRptContagion.Columns.status }, new List <string>() { EntityRptContagion.Columns.rptId })); voData.rptId = vo.rptId; voData.xmlData = vo.xmlData; lstParm.Add(svc.GetUpdateParm(voData, new List <string>() { EntityRptEventData.Columns.xmlData }, new List <string>() { EntityRptEventData.Columns.rptId })); rptId = vo.rptId; } affectRows = svc.Commit(lstParm); } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// 查找病人 /// </summary> /// <param name="cardNo">1 门诊卡号; 2 住院号</param> /// <param name="flag">1 门诊; 2 住院</param> /// <returns></returns> internal List <EntityAidsCheck> GetPatLisInfo(string cardNo, int flag, decimal formId) { string Sql = string.Empty; string Sql2 = string.Empty; string reqNo = string.Empty; string yz = string.Empty; int count = 0; List <EntityAidsCheck> lstVo = new List <EntityAidsCheck>(); SqlHelper svc = null; SqlHelper svcOn = null; SqlHelper lisSvc = null; try { svc = new SqlHelper(EnumBiz.interfaceDB); svcOn = new SqlHelper(EnumBiz.onlineDB); lisSvc = new SqlHelper(EnumBiz.lisDB); IDataParameter[] parm = null; IDataParameter[] parm2 = null; IDataParameter[] parm3 = null; if (flag == 1) { Sql = @"select a.card_no, a.reques_no ,a.hiv1,a.hiv2,a.hiv3,a.yzs, a.zx_time from FRE_CKECK a where a.card_no = ? order by a.zx_time desc"; parm = svc.CreateParm(1); parm[0].Value = cardNo; } else if (flag == 2) { Sql = @"select a.card_no,a.yzs,a.hiv1,a.hiv2,a.hiv3, a.reques_no , a.zx_time from FRE_CKECK a left join IP_REGISTER b on a.pid = b.PID where b.IP_NO = ? order by a.zx_time desc"; parm = svc.CreateParm(1); parm[0].Value = cardNo; } DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { reqNo = dt.Rows[0]["reques_no"].ToString(); yz = dt.Rows[0]["yzs"].ToString(); foreach (DataRow dr in dt.Rows) { if (dr["hiv1"] != DBNull.Value || dr["hiv2"] != DBNull.Value || dr["hiv3"] != DBNull.Value) { count++; } } Sql2 = @"select reques_no from rptContagion where reques_no = ? and status = 1 "; parm2 = svcOn.CreateParm(1); parm2[0].Value = reqNo; DataTable dt2 = svcOn.GetDataTable(Sql2, parm2); if (dt2 != null && dt2.Rows.Count > 0) { return(null); } Sql = @"SELECT samp_name = '标本类型:' + DMB_BB.SAMP_NAME, NOTE = (CASE WHEN DMB_BBZT.NAME IS NULL THEN '' ELSE '标本状态:' + DMB_BBZT.NAME END)+ ' ' + ISNULL(SJB_BGD.NOTE,''), SJB_BGDMXB.ITEM_CODE , item_name = ' ' + DMB_XM.ITEM_NAME, DMB_XM.SEQ_NO1, DMB_XM.TYPE, isnull(DMB_XM.unit,'') as unit , isnull(SJB_BGDMXB.UPBOUND ,'') as UPBOUND , isnull(SJB_BGDMXB.DOWNBOUND ,'') as DOWNBOUND , SJB_BGDMXB.NORMAL , SJB_BGDMXB.RESULT FROM SJB_BGDMXB, SJB_BGD, DMB_XM , DMB_BB, DMB_BBZT WHERE (SJB_BGD.REP_NO = SJB_BGDMXB.REP_NO) AND (DMB_XM.ROOM_CODE = SJB_BGD.ROOM_CODE) AND (DMB_XM.ITEM_CODE = SJB_BGDMXB.ITEM_CODE) AND ( SJB_BGDMXB.REP_NO = ? ) AND ( ltrim(SJB_BGDMXB.result) <> '') AND ( DMB_XM.P_FLAG <> 'F' ) AND ( SJB_BGD.SAMP_CODE = DMB_BB.SAMP_CODE) AND ( SJB_BGD.SAMP_STATUS *= DMB_BBZT.STATUS)"; parm3 = lisSvc.CreateParm(1); parm3[0].Value = reqNo; dt = svcOn.GetDataTable(Sql, parm3); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { #region //"3-II.艾滋病病毒感染孕产妇妊娠及所生婴儿登记卡" if (formId == 11) { EntityAidsCheck vo = new EntityAidsCheck(); vo.REQNO = reqNo; //申请单号 vo.YZ = yz; //孕周 vo.count = count; //白细胞计数 if (dr["item_code"].ToString() == "1221" || dr["item_code"].ToString() == "1055" || dr["item_code"].ToString() == "1351") { vo.BXBJS = dr["result"].ToString(); } //总淋巴细胞计数 if (dr["item_code"].ToString() == "1068") { vo.ZLBXBJS = dr["result"].ToString(); } //血小板计数 if (dr["item_code"].ToString() == "1369") { vo.XXBJS = dr["result"].ToString(); } //血红蛋白 if (dr["item_code"].ToString() == "1363") { vo.XHDB = dr["result"].ToString(); } //血糖 if (dr["item_code"].ToString() == "2713") { vo.XT = dr["result"].ToString(); } //谷丙转氨酶 if (dr["item_code"].ToString() == "3045") { vo.GBZAM = dr["result"].ToString(); } //谷草转氨酶 if (dr["item_code"].ToString() == "2002") { vo.GCZAM = dr["result"].ToString(); } //总胆红素 if (dr["item_code"].ToString() == "2008") { vo.ZDHS = dr["result"].ToString(); } //肌酐 if (dr["item_code"].ToString() == "2021") { vo.XJG = dr["result"].ToString(); } //尿素氮 if (dr["item_code"].ToString() == "2020") { vo.XNST = dr["result"].ToString(); } //梅毒螺旋体抗原血清学实验(TPPA/ELISA) if (dr["item_code"].ToString() == "3012") { vo.MD_TPPA_ELISA = dr["result"].ToString(); } //非梅毒螺旋体抗原血清学实验(RPR、TRUST) if (dr["item_code"].ToString() == "2339") { vo.MD_RPR_TRUST = dr["result"].ToString(); } //梅毒滴度 vo.iDD = -1; if (dr["item_code"].ToString() == "3206") { string result = dr["result"].ToString().Trim(); if (result.Contains(":")) { vo.iDD = Function.Int(result.Split(':')[1]); } } //乙肝表面抗原(HBsAg) if (dr["item_code"].ToString() == "2401" || dr["item_code"].ToString() == "3001" || dr["item_code"].ToString() == "2721") { vo.HBsAg = dr["result"].ToString(); } //乙肝e抗原(HBeAg) if (dr["item_code"].ToString() == "2723" || dr["item_code"].ToString() == "3003") { vo.HBeAg = dr["result"].ToString(); } // 丙肝抗体检测(HCV)-IgG if (dr["item_code"].ToString() == "3008") { vo.HCV_IGG = dr["result"].ToString(); } lstVo.Add(vo); } else if (formId == 15) //4-I梅毒感染孕产妇登记卡 { EntityAidsCheck vo = new EntityAidsCheck(); vo.REQNO = reqNo; //申请单号 vo.YZ = yz; //孕周 #region 4-I // 4——I //快速血浆反应素环状片试验(RPR)X133 //阴性X134 //阳性X135 //检测时间X137 vo.I_RPR = ""; vo.I_RPRTIME = ""; //甲苯胺红不加热血清试验(TRUST)X138 //阴性X139 //阳性X140 //检测时间X142 if (dr["item_code"].ToString() == "2399") { vo.I_TRUST = dr["result"].ToString(); } vo.I_TRUSTTIME = ""; //梅毒螺旋体颗粒凝集试验(TPPA)X145 //阴性X146 //阳性X147 //检测时间X149 if (dr["item_code"].ToString() == "3012") { vo.I_TPPA = dr["result"].ToString(); } vo.I_TPPATIME = ""; //酶联免疫吸附试验(ELISA)X150 //阴性X151 //阳性X152 //检测时间X154 vo.I_ELISA = ""; vo.I_ELISATIME = ""; //免疫层析法-快速体测(RT)X155 //阴性X156 //阳性X157 //检测时间X159 vo.I_RT = ""; vo.I_RTTIME = ""; //梅毒螺旋体IgM抗体检测: //未检测X166 //检测阳性X167 //检测阴性X168 //检测时间X169 vo.I_IGM = ""; vo.I_IGMTIME = ""; //暗视野显微镜梅毒螺旋体检测: //未检测X170 //检测X171 //(检测到梅毒螺旋体: //否X172 //是X173 //检测时间X174 vo.I_MD = ""; vo.I_MDTIME = ""; #endregion } #endregion } } } } catch (Exception e) { ExceptionLog.OutPutException(e); } finally { svc = null; } return(lstVo); }
/// <summary> /// 查找病人 /// </summary> /// <param name="cardNo">1 门诊卡号; 2 住院号</param> /// <param name="flag">1 门诊; 2 住院</param> /// <returns></returns> internal List <EntityPatientInfo> GetPatient(string cardNo, int flag) { string Sql = string.Empty; string Sql2 = string.Empty; List <EntityPatientInfo> lstPat = new List <EntityPatientInfo>(); SqlHelper svc = null; try { svc = new SqlHelper(EnumBiz.interfaceDB); IDataParameter[] parm = null; if (flag == 1) { Sql = @"select a.PID as pid, a.NAME as patname, a.SEX as sex, -- 性别 a.BIRTH as birthday, -- 出生日期 a.ID as idcard, -- 身份证号 a.CONT_TEL as contacttel, -- 联系电话 a.CONT_ADDR as contactaddr, -- 联系地址 a.CARD_NO as cardno, -- 诊疗卡号 null as ipNo, -- 住院号 null as ipTimes, -- 住院次数 null as inDate, -- 入院时间 b.DEPT_CODE as deptcode, -- 住院科室编码 c.DEPT_NAME as deptname, -- 住院科室名称 null as outDate, -- 出院时间 null as deptcode2, -- 出院科室编码 null as deptname2, -- 出院科室名称 null as bedNo, -- 床位号 b.DR_CODE as doctCode, -- 主治医生编码 d.OPER_NAME as doctName -- 主治医生姓名 from PATIENTINFO a, CL_REGISTER b, CODE_DEPARTMENT c, CODE_OPERATOR d where a.PID = b.PID and b.DEPT_CODE = c.DEPT_CODE and b.DR_CODE = d.OPER_CODE and a.CARD_NO = ? "; TimeSpan ts = new TimeSpan(30, 0, 0, 0); parm = svc.CreateParm(1); //parm[0].Value = DateTime.Now.Subtract(ts); parm[0].Value = cardNo; } else if (flag == 2) { Sql = @"select a.PID as pid, a.NAME as patname, a.SEX as sex, -- 性别 a.BIRTH as birthday, -- 出生日期 a.ID as idcard, -- 身份证号 a.CONT_TEL as contacttel, -- 联系电话 a.CONT_ADDR as contactaddr, -- 联系地址 a.CARD_NO as cardno, -- 诊疗卡号 b.IP_NO as ipNo, -- 住院号 b.IP_CNT as ipTimes, -- 住院次数 b.IP_DATE as inDate, -- 入院时间 b.IP_DEPT as deptcode, -- 住院科室编码 c.DEPT_NAME as deptname, -- 住院科室名称 b.OP_DATE as outDate, -- 出院时间 b.OP_DEPT as deptcode2, -- 出院科室编码 d.DEPT_NAME as deptname2, -- 出院科室名称 e.BED_CODE as bedNo, -- 床位号 e.MAN_DR as doctCode, -- 主治医生编码 f.OPER_NAME as doctName -- 主治医生姓名 from PATIENTINFO a inner join IP_REGISTER b on a.PID = b.PID left join CODE_DEPARTMENT c on b.IP_DEPT = c.DEPT_CODE left join CODE_DEPARTMENT d on b.OP_DEPT = d.DEPT_CODE left join IP_PATIENT e on b.REG_NO = e.REG_NO and e.CURR_FLAG = 'T' left join CODE_OPERATOR f on e.MAN_DR = f.OPER_CODE where b.IP_NO = ? "; parm = svc.CreateParm(1); parm[0].Value = cardNo; } DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { EntityPatientInfo pat = null; foreach (DataRow dr in dt.Rows) { pat = new EntityPatientInfo(); pat.pid = dr["pid"].ToString(); pat.cardNo = dr["cardno"].ToString(); pat.name = dr["patname"].ToString(); pat.sex = (dr["sex"].ToString() == "男" ? "1" : "2"); if (dr["birthday"] != DBNull.Value) { pat.birth = dr["birthday"].ToString(); } pat.ID = dr["idcard"].ToString(); pat.contAddr = dr["contactaddr"].ToString(); pat.contTel = dr["contacttel"].ToString(); if (dr["deptcode2"] != DBNull.Value) { pat.deptCode = dr["deptcode2"].ToString(); pat.deptName = dr["deptname2"].ToString(); } else { pat.deptCode = dr["deptcode"].ToString(); pat.deptName = dr["deptname"].ToString(); } pat.ipNo = dr["ipNo"].ToString(); pat.ipTimes = Function.Int(dr["ipTimes"]); pat.bedNo = dr["bedNo"].ToString(); if (dr["inDate"] != DBNull.Value) { pat.inDate = Function.Datetime(dr["inDate"]); } if (dr["outDate"] != DBNull.Value) { pat.outDate = Function.Datetime(dr["outDate"]); } pat.doctCode = dr["doctCode"].ToString(); pat.doctName = dr["doctName"].ToString(); lstPat.Add(pat); } } } catch (Exception e) { ExceptionLog.OutPutException(e); } finally { svc = null; } return(lstPat); }
/// <summary> /// 医嘱字典 /// </summary> /// <param name="orderType">1 长、临嘱; 2 草药; 3 检验、检查</param> /// <returns></returns> public List <EntityDicOrderInput> GetDicOrderInput(int orderType) { #region sql string SQL = string.Empty; string SqlSub = string.Empty; #region SQL2 SqlSub = @"select a.item_code, a.item_name as item_name, a.xtbm, a.xtmc, a.xmbm, a.xmmc, b.standard, b.small_unit, b.ret_price, a.gb_code, a.py_code, a.wb_code, a.la_code, a.gp_rate, a.ap_rate, a.item_cls, a.price_flag, a.big_flag, b.dose, b.dose_unit, b.dire_code, b.freq_code, b.big_unit, b.pack_rate, a.esp_flag, a.exp_flag, a.mc_flag, a.sp_flag, a.disable, a.loc_flag, a.old_code, c.dire_name, d.freq_name from code_item a inner join plus_item b on a.item_code = b.item_code left join code_direction c on b.dire_code = c.dire_code left join code_frequency d on b.freq_code = d.freq_code where (a.ip_flag = 'T' and b.type = '3') "; #endregion if (orderType == 1) { #region 长、临嘱 SQL = @"select a.item_code, a.xtbm, a.xtmc, a.xmbm, a.xmmc, a.item_name as item_name, b.standard, b.small_unit, b.ret_price, a.gb_code, a.py_code, a.wb_code, a.la_code, a.gp_rate, a.ap_rate, a.item_cls, a.price_flag, a.big_flag, b.dose, b.dose_unit, b.dire_code, b.freq_code, b.big_unit, b.pack_rate, a.esp_flag, a.exp_flag, a.mc_flag, a.sp_flag, a.disable, a.loc_flag, c.class, c.pack_code, a.ph_code, a.kss_flag, a.cls_flag, a.drug_cls, e.acct_rate, a.old_code, f.dire_name, g.freq_name from code_item a inner join plus_item b on a.item_code = b.item_code left join code_drugpack c on a.pack_code = c.pack_code left join def_item_ratio e on a.item_code = e.item_code and e.fee_code = '15' and e.scope = '2' left join code_direction f on b.dire_code = f.dire_code left join code_frequency g on b.freq_code = g.freq_code where (a.ip_flag = 'T' and b.type = '3' and (b.disable is null or b.disable = 'F')) and (a.disable = 'F') and (a.item_cls in ('1', '2', '4', '5', '6', '7', '8', '9')) union all select a.item_code, a.xtbm, a.xtmc, a.xmbm, a.xmmc, d.alias_name as item_name, b.standard, b.small_unit, b.ret_price, a.gb_code, d.py_code, d.wb_code, d.la_code, a.gp_rate, a.ap_rate, a.item_cls, a.price_flag, a.big_flag, b.dose, b.dose_unit, b.dire_code, b.freq_code, b.big_unit, b.pack_rate, a.esp_flag, a.exp_flag, a.mc_flag, a.sp_flag, a.disable, a.loc_flag, c.class, c.pack_code, a.ph_code, a.kss_flag, a.cls_flag, a.drug_cls, e.acct_rate, a.old_code, f.dire_name, g.freq_name from code_item a inner join plus_item b on a.item_code = b.item_code inner join alias_item d on a.item_code = d.item_code left join code_drugpack c on a.pack_code = c.pack_code left join def_item_ratio e on a.item_code = e.item_code and e.fee_code = '15' and e.scope = '2' left join code_direction f on b.dire_code = f.dire_code left join code_frequency g on b.freq_code = g.freq_code where (a.ip_flag = 'T' and b.type = '3' and (b.disable is null or b.disable = 'F')) and (a.disable = 'F') and (a.item_cls in ('1', '2', '4', '5', '6', '7', '8', '9'))"; #endregion } else if (orderType == 2) // 草药 { SQL = SqlSub + @" and (a.item_cls = '3')"; } else if (orderType == 3) // 检验、检查 { SQL = SqlSub + @" and (a.item_cls = '4' or a.item_cls = '5')"; } #endregion List <EntityDicOrderInput> data = new List <EntityDicOrderInput>(); SqlHelper svc = null; try { svc = new SqlHelper(EnumBiz.onlineDB); DataTable dt = svc.GetDataTable(SQL); if (dt != null && dt.Rows.Count > 0) { Dictionary <string, string> dicItemCls = new Dictionary <string, string>(); dicItemCls.Add("1", "西药"); dicItemCls.Add("2", "中成药"); dicItemCls.Add("3", "中草药"); dicItemCls.Add("4", "化验"); dicItemCls.Add("5", "检查"); dicItemCls.Add("6", "材料"); dicItemCls.Add("7", "治疗"); dicItemCls.Add("8", "医嘱"); dicItemCls.Add("9", "其它"); EntityDicOrderInput vo = null; foreach (DataRow dr in dt.Rows) { vo = new EntityDicOrderInput(); vo.itemCode = dr["item_code"].ToString(); vo.xtbm = (dr["xtbm"] == null ? string.Empty : dr["xtbm"].ToString().Trim()); vo.xtmc = (dr["xtmc"] == null ? string.Empty : dr["xtmc"].ToString().Trim()); vo.xmbm = (dr["xmbm"] == null ? string.Empty : dr["xmbm"].ToString().Trim()); vo.xmmc = (dr["xmmc"] == null ? string.Empty : dr["xmmc"].ToString().Trim()); vo.itemName = (dr["item_name"] == null ? string.Empty : dr["item_name"].ToString().Trim()); vo.standard = (dr["standard"] == null ? string.Empty : dr["standard"].ToString().Trim()); vo.smallUnit = dr["small_unit"].ToString(); vo.retPrice = Function.Dec(dr["ret_price"]).ToString("0.######"); vo.gbCode = dr["gb_code"].ToString(); vo.pyCode = dr["py_code"].ToString(); vo.wbCode = dr["wb_code"].ToString(); vo.laCode = dr["la_code"].ToString(); vo.gpRate = dr["gp_rate"].ToString(); vo.apRate = dr["ap_rate"].ToString(); vo.itemCls = dr["item_cls"].ToString(); if (!string.IsNullOrEmpty(vo.itemCls) && dicItemCls.ContainsKey(vo.itemCls)) { vo.itemClsName = dicItemCls[vo.itemCls]; } vo.priceFlag = dr["price_flag"].ToString(); vo.dose = (dr["dose"] == null ? string.Empty : Function.Dec(dr["dose"]).ToString("0.######")); vo.doseUnit = (dr["dose_unit"] == null ? string.Empty : dr["dose_unit"].ToString().Trim()); vo.direCode = dr["dire_code"].ToString(); vo.freqCode = dr["freq_code"].ToString(); vo.bigUnit = dr["big_unit"].ToString(); vo.packRate = dr["pack_rate"].ToString(); vo.espFlag = dr["esp_flag"].ToString(); vo.expFlag = dr["exp_flag"].ToString(); vo.mcFlag = dr["mc_flag"].ToString(); vo.spFlag = dr["sp_flag"].ToString(); vo.disable = dr["disable"].ToString(); vo.locFlag = dr["loc_flag"].ToString(); vo.oldCode = dr["old_code"].ToString(); vo.bigFlag = dr["big_flag"].ToString(); vo.direName = dr["dire_name"].ToString(); vo.freqName = dr["freq_name"].ToString(); if (orderType == 1) { vo.packClass = dr["class"].ToString(); vo.packCode = dr["pack_code"].ToString(); vo.phCode = dr["ph_code"].ToString(); vo.antiLevel = Function.Int(dr["kss_flag"]); vo.clsFlag = dr["cls_flag"].ToString(); vo.drugCls = dr["drug_cls"].ToString(); vo.acctRate = dr["acct_rate"].ToString(); } data.Add(vo); } } } catch (Exception ex) { ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message)); } finally { svc = null; } return(data); }
/// <summary> /// 常规问卷-保存 /// </summary> /// <param name="sfData"></param> /// <param name="sfId"></param> /// <returns></returns> public int SaveQnRecord(EntityQnRecord qnRecord, EntityQnData qnData, out decimal recId) { int affectRows = 0; recId = 0; string Sql = string.Empty; SqlHelper svc = null; try { List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); if (qnRecord.recId <= 0) { recId = svc.GetNextID("qnRecord", "recId"); qnRecord.recId = recId; qnRecord.recorder = "00"; qnRecord.recordDate = DateTime.Now; qnRecord.status = 0; qnData.recId = recId; lstParm.Add(svc.GetInsertParm(qnRecord)); lstParm.Add(svc.GetInsertParm(qnData)); } else { recId = qnRecord.recId; lstParm.Add(svc.GetUpdateParm(qnRecord, new List <string> { EntityQnRecord.Columns.clientNo, EntityQnRecord.Columns.qnType, EntityQnRecord.Columns.qnSource }, new List <string> { EntityQnRecord.Columns.recId })); lstParm.Add(svc.GetUpdateParm(qnData, new List <string> { EntityQnData.Columns.xmlData }, new List <string> { EntityQnData.Columns.recId })); } if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
public void m_mthLoadDWReport(DataStore p_dsReport, string dwObject, string p_strParmValue) { DataTable dataTable = new DataTable(); DataTable table = new DataTable(); dataTable = this.m_objPrintInfo.m_dtbBaseInfo; table = this.m_objPrintInfo.m_dtbResult; this.dsReport.LibraryList = Application.StartupPath + "\\pb_lis.pbl"; this.dsReport.DataWindowObject = dwObject; this.dsReport.InsertRow(0); string text = dataTable.Rows[0]["patient_type_chr"].ToString().Trim(); string text2 = text; if (text2 != null) { if (text2 == "2") { this.dsReport.Modify("t_4_2.visible=true"); this.dsReport.Modify("t_4_1.visible=false"); this.dsReport.Modify("t_4_3.visible=false"); this.dsReport.Modify("st_bihno.text = '" + dataTable.Rows[0]["patientcardid_chr"].ToString().Trim() + "'"); } if (text2 == "3") { this.dsReport.Modify("t_4_3.visible=true"); this.dsReport.Modify("t_4_2.visible=false"); this.dsReport.Modify("t_4_1.visible=false"); this.dsReport.Modify("st_bihno.text = '" + dataTable.Rows[0]["patient_inhospitalno_chr"].ToString().Trim() + "'"); } } else { this.dsReport.Modify("t_4_1.visible=true"); this.dsReport.Modify("t_4_2.visible=false"); this.dsReport.Modify("t_4_3.visible=false"); this.dsReport.Modify("st_bihno.text = '" + dataTable.Rows[0]["patient_inhospitalno_chr"].ToString().Trim() + "'"); } this.dsReport.Modify("p_1.filename = '" + Application.StartupPath + "\\Picture\\东莞茶山医院图标.jpg'"); this.dsReport.Modify("st_name.text = '" + dataTable.Rows[0]["patient_name_vchr"].ToString().Trim() + "'"); this.dsReport.Modify("st_sex.text = '" + dataTable.Rows[0]["sex_chr"].ToString().Trim() + "'"); this.dsReport.Modify("st_age.text = '" + dataTable.Rows[0]["age_chr"].ToString().Trim() + "'"); this.dsReport.Modify("st_checkno.text = '" + dataTable.Rows[0]["check_no_chr"].ToString().Trim() + "'"); this.dsReport.Modify("st_dept.text = '" + dataTable.Rows[0]["deptname_vchr"].ToString().Trim() + "'"); this.dsReport.Modify("st_bedno.text = '" + dataTable.Rows[0]["bedno_chr"].ToString().Trim() + "'"); this.dsReport.Modify("st_sample.text = '" + dataTable.Rows[0]["sample_type_desc_vchr"].ToString().Trim() + "'"); DataView dataView = new DataView(table); dataView.RowFilter = "is_graph_result_num = 0"; dataView.Sort = "sample_print_seq_int asc"; int num = 21; int num2 = 0; while (num2 < dataView.Count && num < 221) { DataRowView dataRowView = dataView[num2]; this.dsReport.Modify("t_" + Convert.ToString(num++) + ".text = '" + dataRowView["device_check_item_name_vchr"].ToString().Trim() + "'"); this.dsReport.Modify("t_" + Convert.ToString(num++) + ".text = '" + dataRowView["rptno_chr"].ToString().Trim() + "'"); string text3 = dataRowView["result_vchr"].ToString().Trim(); string text4 = dataRowView["min_val_dec"].ToString().Trim(); string text5 = dataRowView["max_val_dec"].ToString().Trim(); if (!string.IsNullOrEmpty(text4) && !string.IsNullOrEmpty(text5)) { if (decimal.Parse(text3) > decimal.Parse(text5)) { text3 = text3.PadRight(6, ' ') + "↑"; } else { if (decimal.Parse(text3) < decimal.Parse(text4)) { if (text3.Contains(">") || text3.Contains("<")) { text3 = text3.PadRight(6, ' ') + "↑"; } else { text3 = text3.PadRight(6, ' ') + "↓"; } } } } this.dsReport.Modify("t_" + Convert.ToString(num++) + ".text = '" + text3 + "'"); this.dsReport.Modify("t_" + Convert.ToString(num++) + ".text = '" + dataRowView["refrange_vchr"].ToString().Trim() + "'"); this.dsReport.Modify("t_" + Convert.ToString(num++) + ".text = '" + dataRowView["unit_vchr"].ToString().Trim() + "'"); num2++; } dataView.RowFilter = "is_graph_result_num = 1"; dataView.Sort = "sample_print_seq_int asc"; MemoryStream memoryStream = null; for (int i = 0; i < dataView.Count; i++) { DataRowView dataRowView = dataView[i]; if (!(dataRowView["graph_img"] is DBNull)) { try { memoryStream = new MemoryStream(dataRowView["graph_img"] as byte[]); Image image = Image.FromStream(memoryStream, true); image.Save("D:\\\\code\\\\0001.jpg", ImageFormat.Jpeg); image.Dispose(); this.dsReport.Modify("p_img.filename = 'D:\\code\\0001.jpg'"); break; } catch (Exception ex) { //MessageBox.Show(ex.ToString()); ExceptionLog.OutPutException("m_mthLoadDWReport-->" + ex); } finally { if (memoryStream != null) { memoryStream.Close(); } } } } this.dsReport.Modify("t_confirmdate.text = '" + DateTime.Parse(dataTable.Rows[0]["confirm_dat"].ToString().Trim()).ToString("yyyy-MM-dd") + "'"); this.dsReport.Modify("t_reportor.text = '" + dataTable.Rows[0]["reportor"].ToString().Trim() + "'"); this.dsReport.Modify("t_confirmer.text = '" + dataTable.Rows[0]["confirmer"].ToString().Trim() + "'"); }
internal List <EntityPre> GetPreInfo() { string Sql = string.Empty; SqlHelper svc = null; List <EntityPre> data = new List <EntityPre>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select a.putmeddetailid_chr, ord.orderid_chr, e.lastname_vchr, d.inpatientid_chr, c.code_vchr, c.deptname_vchr, a.medid_chr, a.pubdate_dat, b.assistcode_chr, b.medicinename_vchr, b.medspec_vchr, a.unitprice_mny, a.unit_vchr, a.get_dec, nvl(a.get_dec / 2, 0) as premedamount from t_bih_opr_putmeddetail a, t_bse_medicine b, t_bse_deptdesc c, t_opr_bih_register d, t_opr_bih_registerdetail e, t_bse_patientcard card, t_opr_bih_order ord where (a.areaid_chr = c.deptid_chr) and (a.medid_chr = b.medicineid_chr) and (a.registerid_chr = d.registerid_chr) and (d.registerid_chr = e.registerid_chr) and (a.paientid_chr = card.patientid_chr) and (a.orderid_chr = ord.orderid_chr(+)) and a.status_int = 0 and a.pretestdays > 0 order by c.deptname_vchr ,b.medicinename_vchr "; DataTable dt = svc.GetDataTable(Sql); if (dt != null && dt.Rows.Count > 0) { string deptNmae = string.Empty; string assistCode = string.Empty; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { deptNmae = dr["deptname_vchr"].ToString(); assistCode = dr["assistcode_chr"].ToString(); if (data.Any(t => t.deptName == deptNmae && t.assistCode == assistCode)) { #region 累计 EntityPre voClone = data.FirstOrDefault(t => t.deptName == deptNmae && t.assistCode == assistCode); voClone.premedamount += Function.Dec(dr["premedamount"]); #endregion } else { #region vo EntityPre vo = new EntityPre(); vo.deptName = deptNmae; vo.assistCode = assistCode; vo.medicineName = dr["medicinename_vchr"].ToString(); vo.medSpec = dr["medspec_vchr"].ToString(); vo.premedamount = Function.Dec(dr["premedamount"]); #endregion data.Add(vo); } } } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } return(data); }
/// <summary> /// 账号信息 /// </summary> /// <param name="dtResult"></param> /// <returns></returns> public List <EntityAccount> GetAccount() { string SQL = string.Empty; List <EntityAccount> lstAccount = new List <EntityAccount>(); SqlHelper objSvc = new SqlHelper(EnumBiz.onlineDB); try { SQL = @"select distinct a.oper_code as empno, a.pwd, null as signdigital, 1 as acctstatus, d.funcid, d.funccode, d.funcname, d.functype, d.funcfile, d.opername, d.parentid, d.leafflag, d.sortno, d.imagesource from code_operator a inner join def_operator_role b on a.oper_code = b.oper_code inner join defrolefunction c on b.role_code = c.rolecode inner join sysfunction d on c.funcid = d.funcid where a.disable = 'F' and d.functype in (0, 1, 3) order by d.sortno"; DataTable dtResult = objSvc.GetDataTable(SQL); EntityAccount vo = null; foreach (DataRow dr in dtResult.Rows) { vo = new EntityAccount(); vo.AcctStatus = Function.Int(dr["acctstatus"]); //vo.EmpId = Function.Int(dr["empid"]); vo.EmpNo = dr["empno"].ToString(); if (dr["pwd"] == DBNull.Value || string.IsNullOrEmpty(dr["pwd"].ToString())) { vo.Pwd = string.Empty; } else { vo.Pwd = dr["pwd"].ToString(); //ESCryptography.Decrypt(dr["pwd"].ToString()); } vo.SignDigital = dr["signdigital"].ToString(); vo.FuncId = Function.Int(dr["funcid"]); vo.FuncCode = dr["funccode"].ToString(); vo.FuncName = dr["funcname"].ToString(); vo.FuncType = Function.Int(dr["functype"]); vo.FuncFile = dr["funcfile"].ToString(); vo.OperName = dr["opername"].ToString(); vo.ParentCode = dr["parentid"].ToString(); vo.IsLeaf = (dr["leafflag"] != DBNull.Value && dr["leafflag"].ToString() == "1" ? true : false); vo.ImageSource = dr["imagesource"].ToString(); lstAccount.Add(vo); } } catch (Exception e) { ExceptionLog.OutPutException(e); } finally { objSvc = null; } return(lstAccount); }
internal List <EntityBihRegSate> GetBihRegState(string dteStart, string dteEnd, int flg) { string Sql = string.Empty; SqlHelper svc = null; List <EntityBihRegSate> data = new List <EntityBihRegSate>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select a.registerid_chr,b.lastname_vchr, a.inpatientid_chr,a.modify_dat from t_opr_bih_register a left join t_bse_patient b on a.patientid_chr = b.patientid_chr where a.status_int=1 and a.modify_dat between to_date(?, 'yyyy-mm-dd hh24:mi:ss') and to_date(?, 'yyyy-mm-dd hh24:mi:ss')"; IDataParameter[] parm = svc.CreateParm(2); parm[0].Value = dteStart + " 00:00:00"; parm[1].Value = dteEnd + " 23:59:59";; DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { int n = 0; TimeSpan tStart1 = DateTime.Parse("08:00:00").TimeOfDay; TimeSpan tEnd1 = DateTime.Parse("16:00:00").TimeOfDay; TimeSpan tStart2 = DateTime.Parse("16:00:01").TimeOfDay; TimeSpan tEnd2 = DateTime.Parse("23:59:59").TimeOfDay; TimeSpan tStart3 = DateTime.Parse("00:00:00").TimeOfDay; TimeSpan tEnd3 = DateTime.Parse("08:00:01").TimeOfDay; foreach (DataRow dr in dt.Rows) { EntityBihRegSate vo = new EntityBihRegSate(); vo.registerid = dr["registerid_chr"].ToString(); vo.inpatientid = dr["inpatientid_chr"].ToString(); vo.modifyDate = dr["modify_dat"].ToString(); vo.name = dr["lastname_vchr"].ToString(); string modity = Function.Datetime(dr["modify_dat"].ToString()).ToString("HH:mm:ss"); TimeSpan tModity = DateTime.Parse(modity).TimeOfDay; if (flg == 1) { #region //白班 if (tModity > tStart1 && tModity < tEnd1) { //vo.F1++; vo.n = ++n; } else { continue; } #endregion } else if (flg == 2) { #region //夜班 if ((tModity > tStart2 && tModity < tEnd2) || (tModity > tStart3 && tModity < tEnd3)) { //vo.F2++; vo.n = ++n; } else { continue; } #endregion } data.Add(vo); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } return(data); }
/// <summary> /// GetAccountInfo /// </summary> /// <param name="empNo"></param> /// <param name="parentID"></param> /// <param name="typeID">1 菜单(窗体) 2 按钮</param> /// <returns></returns> public List <EntitySysModule> GetAccount(string empNo, int parentID, int typeID) { string SQL = string.Empty; SqlHelper objSvc = new SqlHelper(EnumBiz.onlineDB); List <EntitySysModule> lstSysModule = new List <EntitySysModule>(); try { string strSub = string.Empty; if (typeID == 1) { strSub = @" (d.functype = 1 or d.functype = 3) "; } else if (typeID == 2) { strSub = @" d.functype = 5 "; } SQL = @"select distinct d.funcid, d.funccode, d.funcname, d.funcfile, d.functype, d.opername, d.parentid, d.leafflag, d.imagesource, d.sortno from def_operator_role b inner join defRolefunction c on b.role_code = c.rolecode inner join sysFunction d on c.funcid = d.funcid where " + strSub + @" and a.oper_code = ? order by d.sortno"; DataTable dt = null; IDataParameter[] objParamArr = objSvc.CreateParm(1); objParamArr[0].Value = empNo; dt = objSvc.GetDataTable(SQL, objParamArr); if (dt != null && dt.Rows.Count > 0) { lstFuncID = new List <int>(); GetFuncID(parentID, dt); int intFuncID = 0; foreach (DataRow dr in dt.Rows) { intFuncID = Function.Int(dr["funcid"]); if (lstFuncID.IndexOf(intFuncID) < 0) { continue; } lstSysModule.Add(GetSysModule(dr)); } } } catch (Exception e) { ExceptionLog.OutPutException(e); } finally { objSvc = null; } return(lstSysModule); }
internal List <EntityLisSample> GetLisSambleAccept(string dteStart, string dteEnd, int flg) { string Sql = string.Empty; SqlHelper svc = null; List <EntityLisSample> data = new List <EntityLisSample>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select distinct t.barcode_vchr as barcode,--条码号 t.patientcardid_chr as patcardno,--门诊号 t.patient_inhospitalno_chr as peno,--住院号/体检号 e.dictname_vchr as pattype, --病人类型 t.patient_name_vchr as patname, --病人姓名 t.sampletype_vchr as sampletype,--标本类型 --f.itemname as checkcontent, --检验内容 j.check_content_vchr as checkcontent, c.lastname_vchr as applyername,--申请人 d.DEPTNAME_VCHR as deptname,--申请科室 a.recorderid,--打包人id a.recorddate , a.packdate as packtime, --打包时间 g.lastname_vchr as packname,--打包人 t.accept_dat as checktime, --核收时间 h.lastname_vchr as checkname,--核收人 k.feedback_date_date as rechecktime,--拒收时间 k.sample_back_reason_vchr as recheckreason,--拒收原因 t.appl_dat from t_opr_lis_sample t left join t_samplepack a on t.barcode_vchr = a.barcode left join t_samplepack_detail f on t.barcode_vchr = f.barcode left join (select d.dictid_chr, d.dictname_vchr from t_aid_dict d where trim(d.dictid_chr) <> 0 and dictkind_chr = '61') e on t.patient_type_chr = e.dictid_chr left join t_bse_employee c on t.appl_empid_chr = c.empid_chr left join t_bse_deptdesc d on t.appl_deptid_chr = d.DEPTID_CHR left join t_bse_employee g on a.recorderid = g.empid_chr left join t_bse_employee h on t.acceptor_id_chr =h.empid_chr left join t_opr_lis_application j on t.application_id_chr = j.application_id_chr left join t_opr_lis_sample_feedback k on t.sample_id_chr = k.sample_id_chr where t.appl_deptid_chr is not null and (t.accept_dat between to_date(?, 'yyyy-mm-dd hh24:mi:ss') and to_date(?, 'yyyy-mm-dd hh24:mi:ss')) and t.status_int >= 2 and t.status_int < 7 order by t.patientcardid_chr, d.DEPTNAME_VCHR "; IDataParameter[] parm = svc.CreateParm(2); parm[0].Value = dteStart + " 00:00:00"; parm[1].Value = dteEnd + " 23:59:59";; DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { int n = 0; TimeSpan tStart1 = DateTime.Parse("17:30:00").TimeOfDay; TimeSpan tEnd1 = DateTime.Parse("23:59:59").TimeOfDay; TimeSpan tStart2 = DateTime.Parse("00:00:00").TimeOfDay; TimeSpan tEnd2 = DateTime.Parse("05:00:01").TimeOfDay; foreach (DataRow dr in dt.Rows) { EntityLisSample vo = new EntityLisSample(); vo.barcode = dr["barcode"].ToString(); vo.patcardno = dr["patcardno"].ToString(); vo.inpatno = dr["peno"].ToString(); vo.pattype = dr["pattype"].ToString(); vo.patname = dr["patname"].ToString(); vo.sampletype = dr["sampletype"].ToString(); vo.checkcontent = dr["checkcontent"].ToString(); vo.applyername = dr["applyername"].ToString(); vo.deptname = dr["deptname"].ToString(); vo.packtime = dr["packtime"].ToString(); vo.packname = dr["packname"].ToString(); vo.checktime = dr["checktime"].ToString(); vo.checkname = dr["checkname"].ToString(); vo.rechecktime = dr["rechecktime"].ToString(); vo.recheckreason = dr["recheckreason"].ToString(); //string modity = Function.Datetime(dr["checktime"].ToString()).ToString("HH:mm:ss"); //TimeSpan tModity = DateTime.Parse(modity).TimeOfDay; vo.n = ++n; //if (tModity >= tStart1 && tModity <= tEnd1) //{ // vo.n = ++n; //} //else if (tModity >= tStart2 && tModity <= tEnd2) //{ // vo.n = ++n; //} //else // continue; data.Add(vo); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } return(data); }
/// <summary> /// 获取登录者信息 /// </summary> /// <param name="strEmpNo"></param> /// <param name="loginVo"></param> /// <param name="hospitalVo"></param> /// <returns></returns> public void GetLoginInfo(string strEmpNo, ref EntityLogin loginVo, ref EntityHospital hospitalVo) { string SQL = string.Empty; string strValue = string.Empty; DataTable dtResult = null; loginVo = new EntityLogin(); hospitalVo = new EntityHospital(); SqlHelper svc = new SqlHelper(EnumBiz.onlineDB); IDataParameter[] objParamArr = null; try { EntityCodeOperator voEmp = new EntityCodeOperator(); voEmp.disable = "F"; voEmp.operCode = strEmpNo; List <EntityCodeOperator> lstEmployee = EntityTools.ConvertToEntityList <EntityCodeOperator>(svc.Select(voEmp, new List <string> { EntityCodeOperator.Columns.disable, EntityCodeOperator.Columns.operCode })); if (lstEmployee != null && lstEmployee.Count == 1) { voEmp = lstEmployee[0]; EntityPlusOperator voEmpPlus = new EntityPlusOperator(); voEmpPlus.operCode = strEmpNo; List <EntityPlusOperator> lstEmpPlus = EntityTools.ConvertToEntityList <EntityPlusOperator>(svc.Select(voEmpPlus, new List <string> { EntityPlusOperator.Columns.operCode })); if (lstEmpPlus != null && lstEmpPlus.Count > 0) { voEmpPlus = lstEmpPlus[0]; } bool blnLock = false; if (voEmp.acctStatus.ToString() == "1") { blnLock = true; if (voEmp.acctLockDate != null) { strValue = SysParameter(72); int intTemp = 24;//默认24小时后自动解锁 if (!string.IsNullOrEmpty(strValue)) { intTemp = Function.Int(strValue); } if (intTemp != 0) { DateTime dtmLock = voEmp.acctLockDate.Value; DateTime dtmNow = DateTime.Now; if (dtmNow.Subtract(dtmLock).TotalHours >= intTemp) { blnLock = false; Dictionary <string, object> dicSet = new Dictionary <string, object>(); dicSet.Add(EntityCodeOperator.Columns.acctStatus, 0); dicSet.Add(EntityCodeOperator.Columns.acctLockDate, null); Dictionary <string, object> dicWhere = new Dictionary <string, object>(); dicWhere.Add(EntityCodeOperator.Columns.operCode, strEmpNo); svc.Commit(svc.GetUpdateParm(voEmp, dicSet, dicWhere)); } } } } //loginVo.EmpId = voEmp.Empid.ToString(); loginVo.EmpNo = voEmp.operCode; loginVo.EmpName = voEmp.operName; //loginVo.Sex = voEmpPlus.Sex; loginVo.Birthday = voEmpPlus.birth; //loginVo.IdCard = voEmpPlus.Idcard; loginVo.Tel = voEmpPlus.tel; loginVo.Addr = voEmpPlus.addr; //loginVo.IdentityFlag = voEmp.Identity; loginVo.AdminlevelCode = voEmpPlus.dutyCode; loginVo.TechLevelCode = voEmpPlus.rankCode; //loginVo.SignKeyID = voEmp.Signdigital; if (!string.IsNullOrEmpty(voEmp.pwd)) { loginVo.Pwd = voEmp.pwd; //ESCryptography.Decrypt(voEmp.pwd); } else { loginVo.Pwd = string.Empty; } loginVo.LoginTime = svc.ServerTime().ToString("yyyy-MM-dd HH:mm:ss"); if (!string.IsNullOrEmpty(voEmpPlus.clsCode) && voEmpPlus.clsCode.Trim() == "01") { loginVo.EmpFlag = 1; } else if (!string.IsNullOrEmpty(voEmpPlus.clsCode) && voEmpPlus.clsCode.Trim() == "02") { loginVo.EmpFlag = 2; } else { loginVo.EmpFlag = 3; } loginVo.clsCode = voEmpPlus.clsCode.Trim(); // 是否管理员 if (loginVo.EmpNo.Trim() == "00") { loginVo.IsAdmin = true; } //if (voEmp.Pwdusedate == null) // loginVo.PwdUseDate = null; //else // loginVo.PwdUseDate = Convert.ToDateTime(voEmp.Pwdusedate.Value); loginVo.AcctLock = blnLock; #region 职称改从code_rank取值 //EntityCommonDic voComm = new EntityCommonDic(); //voComm.Status = 1; //voComm.Classid = 1; //voComm.Itemcode = loginVo.TechLevelCode; //List<EntityCommonDic> lstComm = EntityTools.ConvertToEntityList<EntityCommonDic>(svc.Select(voComm, new List<string> { EntityCommonDic.Columns.Status, EntityCommonDic.Columns.Classid, EntityCommonDic.Columns.Itemcode })); //if (lstComm.Count > 0) //{ // loginVo.TechLevelName = lstComm[0].Itemname; //} EntityCodeRank rankVo = new EntityCodeRank(); rankVo.rankCode = loginVo.TechLevelCode; List <EntityCodeRank> lstRank = EntityTools.ConvertToEntityList <EntityCodeRank>(svc.Select(rankVo, new List <string> { EntityCodeRank.Columns.rankCode })); if (lstRank.Count > 0) { loginVo.TechLevelName = lstRank[0].rankName; } #endregion string strIDArr = string.Empty; //DataTable dtTemp = null; //if (loginVo.EmpFlag == 1 || loginVo.EmpFlag == 3) //{ SQL = @"select b.defaultflag as defaultflag, null as deptid, a.dept_code as deptcode, a.dept_name as deptname, a.py_code as pycode, a.wb_code as wbcode from code_department a inner join defDeptemployee b on a.dept_code = b.deptcode where b.opercode = ?"; objParamArr = svc.CreateParm(1); objParamArr[0].Value = loginVo.EmpNo; dtResult = svc.GetDataTable(SQL, objParamArr); if (dtResult.Rows.Count > 0) { EntityCodeDepartment deptVo = null; loginVo.lstDept = new List <EntityCodeDepartment>(); foreach (DataRow dr in dtResult.Rows) { deptVo = new EntityCodeDepartment(); //deptVo.Deptid = Function.Int(dr["deptid"]); deptVo.deptCode = dr["deptcode"].ToString(); deptVo.deptName = dr["deptname"].ToString(); deptVo.pyCode = dr["pycode"].ToString().ToUpper(); deptVo.wbCode = dr["wbcode"].ToString().ToUpper(); loginVo.lstDept.Add(deptVo); if (Function.Int(dr["defaultflag"]) == 1) { //loginVo.DeptID = Function.Int(deptVo.Deptid); loginVo.DeptName = deptVo.deptName; loginVo.DeptCode = dr["deptcode"].ToString(); // SQL = @"select b.areaid, // b.areaname, // b.pycode, // b.wbcode, // '' as c_code // from defDeptarea a // left join dicArea b // on a.areaid = b.areaid // where a.deptid = ?"; // objParamArr = svc.CreateParm(1); // objParamArr[0].Value = deptVo.Deptid; // dtTemp = svc.GetDataTable(SQL, objParamArr); // if (dtTemp != null && dtTemp.Rows.Count > 0) // { // loginVo.AreaID = Function.Int(dtTemp.Rows[0]["areaid"]); // loginVo.AreaName = dtTemp.Rows[0]["areaname"].ToString(); // loginVo.DeptCode_zy = dtTemp.Rows[0]["c_code"].ToString(); // } } //strIDArr += dr["deptid"].ToString() + ","; } // SQL = @"select distinct b.areaid, b.areaname, b.pycode, b.wbcode // from defDeptarea a, dicArea b // where a.areaid = b.areaid // and a.deptid in (" + strIDArr.Substring(0, strIDArr.Length - 1) + ")"; // dtResult = svc.GetDataTable(SQL); // if (dtResult.Rows.Count > 0) // { // EntityArea dcAreaInfo = null; // loginVo.lstArea = new List<EntityArea>(); // foreach (DataRow dr in dtResult.Rows) // { // dcAreaInfo = new EntityArea(); // dcAreaInfo.Areaid = Function.Int(dr["areaid"]); // dcAreaInfo.Areaname = dr["areaname"].ToString(); // dcAreaInfo.Pycode = dr["pycode"].ToString(); // dcAreaInfo.Wbcode = dr["wbcode"].ToString(); // loginVo.lstArea.Add(dcAreaInfo); // } // } // } // } // else if (loginVo.EmpFlag == 2) // { // SQL = @"select a.defaultflag, b.areaid, b.areaname, b.pycode, b.wbcode // from defDeptemployee a, dicArea b // where a.deptid = b.areaid // and a.attrflag = 2 // and a.empid = ?"; // objParamArr = svc.CreateParm(1); // objParamArr[0].Value = loginVo.EmpId; // dtResult = svc.GetDataTable(SQL, objParamArr); // if (dtResult.Rows.Count > 0) // { // EntityArea dcAreaInfo = null; // loginVo.lstArea = new List<EntityArea>(); // foreach (DataRow dr in dtResult.Rows) // { // dcAreaInfo = new EntityArea(); // dcAreaInfo.Areaid = Function.Int(dr["areaid"]); // dcAreaInfo.Areaname = dr["areaname"].ToString(); // dcAreaInfo.Pycode = dr["pycode"].ToString(); // dcAreaInfo.Wbcode = dr["wbcode"].ToString(); // loginVo.lstArea.Add(dcAreaInfo); // if (Function.Int(dr["defaultflag"]) == 1) // { // loginVo.AreaID = Function.Int(dcAreaInfo.Areaid); // loginVo.AreaName = dcAreaInfo.Areaname; // SQL = @"select b.deptid, b.deptname, b.deptcode, b.pycode, b.wbcode // from defDeptarea a, dicDepartment b // where a.deptid = b.deptid // and a.areaid = ?"; // objParamArr = svc.CreateParm(1); // objParamArr[0].Value = dcAreaInfo.Areaid; // dtTemp = svc.GetDataTable(SQL, objParamArr); // if (dtTemp != null && dtTemp.Rows.Count > 0) // { // loginVo.DeptID = Function.Int(dtTemp.Rows[0]["deptid"]); // loginVo.DeptName = dtTemp.Rows[0]["deptname"].ToString(); // loginVo.DeptCode = dtTemp.Rows[0]["deptcode"].ToString(); // } // } // strIDArr += dr["areaid"].ToString() + ","; // } // SQL = @"select distinct b.deptid, b.deptcode, b.deptname, b.pycode, b.wbcode // from defDeptarea a, dicDepartment b // where a.deptid = b.deptid // and a.areaid in (" + strIDArr.Substring(0, strIDArr.Length - 1) + ")"; // dtResult = svc.GetDataTable(SQL); // if (dtResult.Rows.Count > 0) // { // EntityDepartment dcDeptInfo = null; // loginVo.lstDept = new List<EntityDepartment>(); // foreach (DataRow dr in dtResult.Rows) // { // dcDeptInfo = new EntityDepartment(); // dcDeptInfo.Deptid = Function.Int(dr["deptid"]); // dcDeptInfo.Deptcode = dr["deptcode"].ToString(); // dcDeptInfo.Deptname = dr["deptname"].ToString(); // dcDeptInfo.Pycode = dr["pycode"].ToString(); // dcDeptInfo.Wbcode = dr["wbcode"].ToString(); // loginVo.lstDept.Add(dcDeptInfo); // } // } } //} if (loginVo != null) { EntityDefOperatorRole voRoleEmp = new EntityDefOperatorRole(); voRoleEmp.operCode = loginVo.EmpNo; List <EntityDefOperatorRole> lstRoleEmp = EntityTools.ConvertToEntityList <EntityDefOperatorRole>(svc.Select(voRoleEmp, new List <string> { EntityDefOperatorRole.Columns.operCode })); if (lstRoleEmp.Count > 0) { loginVo.lstRoleID = new List <string>(); foreach (EntityDefOperatorRole vo in lstRoleEmp) { loginVo.lstRoleID.Add(vo.roleCode); } } } EntityHospital voHospital = new EntityHospital(); List <EntityHospital> lstHospital = EntityTools.ConvertToEntityList <EntityHospital>(svc.Select(voHospital)); if (lstHospital.Count > 0) { hospitalVo = lstHospital[0]; GlobalHospital.HospitalName = hospitalVo.Hospitalname; } //密码有效期 loginVo.PwdValidDays = Function.Int(SysParameter(2)); } dtResult = null; } catch (Exception e) { ExceptionLog.OutPutException(e); } finally { svc = null; } }
/// <summary> /// /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="ipNo"></param> /// <returns></returns> public List <entityLisInfo> QueryAreaReport(string startDate, string endDate, string ipNo) { string Sql = string.Empty; DataTable dt = null; SqlHelper svc = null; List <entityLisInfo> data = new List <entityLisInfo>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select distinct a.name_vchr, c.application_id_chr, c.appl_dat, c.patient_name_vchr, c.sex_chr, c.age_chr, c.patient_inhospitalno_chr, c.bedno_chr, c.barcode_vchr, d.report_group_id_chr, d.report_print_chr, d.report_dat, d.confirm_dat from t_opr_bih_order a inner join t_opr_attachrelation b on a.orderid_chr = b.sourceitemid_vchr inner join t_opr_lis_sample c on b.attachid_vchr = c.application_id_chr inner join t_opr_lis_app_report d on c.application_id_chr = d.application_id_chr where {0} (c.appl_dat between ? and ?) and d.report_dat is not null {1} order by c.appl_dat, c.patient_inhospitalno_chr "; IDataParameter[] param = null; DateTime dateTime = Convert.ToDateTime(startDate + " 00:00:00"); DateTime dateTime2 = Convert.ToDateTime(endDate + " 23:59:59"); if (!string.IsNullOrEmpty(ipNo)) { Sql = string.Format(Sql, "", "and trim(c.patient_inhospitalno_chr) = ?"); param = svc.CreateParm(3); param[0].Value = dateTime; param[1].Value = dateTime2; param[2].Value = ipNo; } dt = svc.GetDataTable(Sql, param); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { entityLisInfo vo = new entityLisInfo(); vo.cardNo = dr["patient_inhospitalno_chr"].ToString(); vo.barCode = dr["barcode_vchr"].ToString(); vo.patName = dr["patient_name_vchr"].ToString(); vo.sex = dr["sex_chr"].ToString(); vo.age = dr["age_chr"].ToString(); vo.name = dr["name_vchr"].ToString(); vo.appDate = Function.Datetime(dr["appl_dat"]).ToString("yyyy-MM-dd HH:mm"); vo.rptDate = Function.Datetime(dr["report_dat"]).ToString("yyyy-MM-dd HH:mm"); vo.rptGroupId = dr["report_group_id_chr"].ToString(); vo.applicationId = dr["application_id_chr"].ToString(); vo.n = 0; if (data.Any(t => t.applicationId == vo.applicationId && t.rptGroupId == vo.rptGroupId)) { int i = data.FindIndex(t => t.applicationId == vo.applicationId && t.rptGroupId == vo.rptGroupId); data[i].name = data[i].name + "," + vo.name; } else { data.Add(vo); for (int i = 0; i < data.FindAll(t => t.cardNo == vo.cardNo).Count; i++) { int j = data.FindIndex(t => t.cardNo == vo.cardNo) + i; data[j].n++; } } } } } catch (Exception objEx) { ExceptionLog.OutPutException("QueryAreaReport-->" + objEx); } return(data); }
/// <summary> /// /// </summary> /// <param name="promotionPlans"></param> /// <returns></returns> public int SavePromotionPan(List <EntityPromotionPlan> promotionPlans) { int affect = -1; SqlHelper svc = null; try { if (promotionPlans != null) { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); foreach (var plans in promotionPlans) { if (string.IsNullOrEmpty(plans.id)) { plans.id = DateTime.Now.ToString("yyyyMMddHHss") + svc.GetNextID("promotionPlan", "id").ToString().PadLeft(4, '0'); plans.createDate = DateTime.Now; plans.createId = "00"; lstParm.Add(svc.GetInsertParm(plans)); } else { plans.modifyDate = DateTime.Now; lstParm.Add(svc.GetUpdateParm(plans, new List <string>() { EntityPromotionPlan.Columns.clientId, EntityPromotionPlan.Columns.planType, EntityPromotionPlan.Columns.planDate, EntityPromotionPlan.Columns.planState, EntityPromotionPlan.Columns.planWay, EntityPromotionPlan.Columns.planContent, EntityPromotionPlan.Columns.planRemind, EntityPromotionPlan.Columns.recordWay, EntityPromotionPlan.Columns.recordContent, EntityPromotionPlan.Columns.ignorPlan, EntityPromotionPlan.Columns.planSource, EntityPromotionPlan.Columns.planTemplateName, EntityPromotionPlan.Columns.modifyId, EntityPromotionPlan.Columns.modifyDate }, new List <string>() { EntityPromotionPlan.Columns.id })); } } if (lstParm.Count > 0) { affect = svc.Commit(lstParm); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); affect = -1; } finally { svc = null; } return(affect); }
/// <summary> /// 评估记录-保存 /// </summary> /// <param name="pgData"></param> /// <param name="pgId"></param> /// <returns></returns> public int SaveGxyPgRecord(EntityGxyRecord gxyRecord, EntityGxyPg gxyPg, EntityGxyPgData pgData, out decimal pgId) { int affectRows = 0; pgId = 0; string Sql = string.Empty; SqlHelper svc = null; decimal id = 0; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); if (gxyPg.pgId <= 0) { id = svc.GetNextID("gxyPg", "pgId"); gxyPg.status = 1; gxyPg.pgId = id; gxyPg.recordDate = DateTime.Now; gxyRecord.pgTimes += 1; lstParm.Add(svc.GetInsertParm(gxyPg)); //高血压下次随访数据 string sql = @"update gxyRecord set pgTimes = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(2); param[0].Value = gxyRecord.pgTimes; param[1].Value = gxyRecord.recId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } else { id = gxyPg.pgId; lstParm.Add(svc.GetUpdateParm(gxyPg, new List <string> { EntityGxyPg.Columns.bloodPressLevel, EntityGxyPg.Columns.dangerLevel, EntityGxyPg.Columns.manageLevel, EntityGxyPg.Columns.evaDate, }, new List <string> { EntityGxyPg.Columns.pgId })); } pgData.pgId = id; //评估数据 lstParm.Add(svc.GetDelParm(pgData, EntityGxyPgData.Columns.pgId)); lstParm.Add(svc.GetInsertParm(pgData)); if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } pgId = id; } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// 保存.电子申请单 /// </summary> /// <param name="formVo"></param> /// <param name="formId"></param> /// <returns></returns> public int SaveForm(EntityFormDesign formVo, out int formId) { int affectRows = 0; string Sql = string.Empty; SqlHelper svc = null; formId = 0; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstPara = new List <DacParm>(); bool isExsit = true; if (formVo.Formid <= 0) { isExsit = false; formVo.Formid = svc.GetNextID(EntityTools.GetTableName(formVo), EntityTools.GetFieldName(formVo, EntityFormDesign.Columns.Formid)); } lstPara.Add(svc.GetInsertParm(formVo)); if (Function.Int(formVo.Formtype) < 3) { if (isExsit == false) { string tbName = "emrFormRtf" + formVo.Formid.ToString(); // 自动生成 EntityEmrBasicInfo vo = new EntityEmrBasicInfo(); vo.typeId = 1; vo.formId = formVo.Formid; vo.caseName = formVo.Formname; vo.caseCode = formVo.Formid.ToString(); vo.pyCode = SpellCodeHelper.GetPyCode(formVo.Formname); vo.wbCode = SpellCodeHelper.GetWbCode(formVo.Formname); vo.tableName = tbName; vo.attribute = 0; vo.showType = 0; vo.caseStyle = 0; vo.catalogId = 23; // 其他类 vo.fieldXml = EmrTool.GetBasicFieldXml(formVo.Layout); vo.status = 1; lstPara.Add(svc.GetInsertParm(vo)); if (svc.enumDBMS == EnumDBMS.Oracle) { } else { Sql = @"if exists (select 1 from sysobjects where id = object_id('{0}') and type = 'U') drop table {1}"; lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName))); Sql = @"create table {0} ( registerid varchar(20) not null, recorddate datetime not null, fieldname varchar(50) not null, rowindex numeric(10,0) not null, tablecode varchar(100) null, contentrtf image null, printrtf image null, isprint numeric(1,0) not null, constraint pk_{0} primary key (registerid, recorddate, fieldname, rowindex) )"; } lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName))); } else { EntityEmrBasicInfo vo = new EntityEmrBasicInfo(); vo.formId = formVo.Formid; vo.caseName = formVo.Formname; vo.pyCode = SpellCodeHelper.GetPyCode(formVo.Formname); vo.wbCode = SpellCodeHelper.GetWbCode(formVo.Formname); vo.fieldXml = EmrTool.GetBasicFieldXml(formVo.Layout); DataTable dt = svc.Select(vo, new List <string>() { EntityEmrBasicInfo.Columns.formId }); if (dt != null && dt.Rows.Count > 0) { //lstPara.Add(svc.GetUpdateParm(vo, new List<string>() { EntityEmrBasicInfo.Columns.caseName, EntityEmrBasicInfo.Columns.pyCode, // EntityEmrBasicInfo.Columns.wbCode, EntityEmrBasicInfo.Columns.fieldXml }, // new List<string>() { EntityEmrBasicInfo.Columns.formId })); Sql = @"update emrBasicInfo set caseName = ?, pyCode = ?, wbCode = ?, fieldXml = ? where formId = ?"; IDataParameter[] parms = svc.CreateParm(5); parms[0].Value = vo.caseName; parms[1].Value = vo.pyCode; parms[2].Value = vo.wbCode; parms[3].Value = vo.fieldXml; if (!string.IsNullOrEmpty(vo.fieldXml) && vo.fieldXml.Trim() != null) { parms[3].ParameterName = "xmltype"; } parms[4].Value = vo.formId; lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, Sql, parms)); } } } if (formVo.Formid > 0) { using (TransactionScope scope = svc.TransactionScope) { if (DelForm((int)formVo.Formid, (int)formVo.Version) < 0) { return(-1); } affectRows = svc.Commit(lstPara); scope.Complete(); } } else { affectRows = svc.Commit(lstPara); } formId = (int)formVo.Formid; if (formId > 0 && affectRows <= 0) { affectRows = 1; } } catch (Exception ex) { ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message)); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// 随访记录-保存 /// </summary> /// <param name="sfData"></param> /// <param name="sfId"></param> /// <returns></returns> public int SaveTnbSfRecord(EntityTnbRecord tnbRecord, EntityTnbSf tnbSf, EntityTnbSfData sfData, out decimal sfId) { int affectRows = 0; sfId = 0; string Sql = string.Empty; SqlHelper svc = null; decimal id = 0; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); if (tnbSf.sfId <= 0) { id = svc.GetNextID("tnbSf", "sfId"); tnbSf.sfId = id; tnbSf.sfStatus = 1; tnbSf.recordDate = DateTime.Now; tnbRecord.sfId = id; tnbRecord.sfTimes += 1; sfData.sfId = id; lstParm.Add(svc.GetInsertParm(tnbSf)); } else { id = tnbSf.sfId; lstParm.Add(svc.GetUpdateParm(tnbSf, new List <string> { EntityTnbSf.Columns.sfMethod, EntityTnbSf.Columns.sfClass, EntityTnbSf.Columns.sfDate }, new List <string> { EntityTnbSf.Columns.sfId })); } //随访数据 lstParm.Add(svc.GetDelParm(sfData, EntityTnbSfData.Columns.sfId)); lstParm.Add(svc.GetInsertParm(sfData)); if (tnbRecord.sfTimes > 0) { //高血压下次随访数据 string sql = @"update tnbRecord set manageLevel = ?, nextSfDate = ?, sfId = ?,sfTimes = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(5); param[0].Value = tnbRecord.manageLevel; param[1].Value = tnbRecord.nextSfDate; param[2].Value = tnbRecord.sfId; param[3].Value = tnbRecord.sfTimes; param[4].Value = tnbRecord.recId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } else { //高血压下次随访数据 string sql = @"update tnbRecord set manageLevel = ?, nextSfDate = ?, sfId = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(4); param[0].Value = tnbRecord.manageLevel; param[1].Value = tnbRecord.nextSfDate; param[2].Value = tnbRecord.sfId; param[3].Value = tnbRecord.recId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } sfId = id; } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// GetForm /// </summary> /// <param name="formId"></param> /// <returns></returns> public List <EntityFormDesign> GetForm(int formId, bool isShowLayout) { string SQL = string.Empty; List <EntityFormDesign> lstForm = new List <EntityFormDesign>(); EntityFormDesign vo = new EntityFormDesign(); DataTable dt = null; SqlHelper svc = new SqlHelper(EnumBiz.onlineDB); IDataParameter[] paramArr = null; try { SQL = @"select t.formid, t.formcode, t.formname, t.formtype, t.version, t.pycode, t.wbcode, t.panelsize, {0} t.printtemplateid, t.recorderid, t.recorddate, t.status, b.oper_name as empname from emrFormDesign t left join code_operator b on t.recorderid = b.oper_code "; if (isShowLayout) { SQL = string.Format(SQL, "t.layout,"); } else { SQL = string.Format(SQL, ""); } if (formId <= 0) { SQL += @"order by t.version asc"; dt = svc.GetDataTable(SQL); } else { SQL += @" where t.formid = ? order by t.version asc"; paramArr = svc.CreateParm(1); paramArr[0].Value = formId; dt = svc.GetDataTable(SQL, paramArr); } if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { vo = new EntityFormDesign(); vo.Formid = Function.Int(dr["formid"]); vo.Formcode = dr["formcode"].ToString(); vo.Formname = dr["formname"].ToString(); vo.Formtype = Function.Int(dr["formtype"].ToString()); vo.Version = Function.Int(dr["version"]); vo.Pycode = dr["pycode"].ToString().ToUpper(); vo.Wbcode = dr["wbcode"].ToString().ToUpper(); vo.Panelsize = dr["panelsize"].ToString(); if (isShowLayout) { vo.Layout = dr["layout"].ToString(); } vo.Printtemplateid = Function.Int(dr["printtemplateid"].ToString()); vo.Recorderid = dr["recorderid"].ToString(); vo.RecorderName = dr["empname"].ToString(); vo.Recorddate = Convert.ToDateTime(dr["recorddate"].ToString()); vo.Status = Function.Int(dr["status"]); vo.StatusName = (vo.Status == 1 ? "启用" : "停用"); lstForm.Add(vo); } } } catch (Exception ex) { ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message)); } finally { svc = null; paramArr = null; } return(lstForm); }
/// <summary> /// SaveQnTopic /// </summary> /// <param name="mainVo"></param> /// <param name="lstSub"></param> /// <param name="fieldId"></param> /// <returns></returns> public int SaveQnTopic(EntityDicQnSummary mainVo, List <EntityDicQnSummary> lstSub, out string fieldId) { int affectRows = 0; SqlHelper svc = null; fieldId = string.Empty; try { fieldId = mainVo.fieldId; svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); int num = 0; if (string.IsNullOrEmpty(fieldId)) { int nextId = svc.GetNextID("dicQnSummary", "fieldId"); fieldId = "T" + nextId.ToString().PadLeft(6, '0'); mainVo.fieldId = fieldId; if (mainVo.sortNo == 0) { mainVo.sortNo = nextId; } if (lstSub != null) { foreach (EntityDicQnSummary item in lstSub) { item.fieldId = fieldId + Convert.ToString(++num).PadLeft(2, '0'); } } } else { EntityDicQnSummary vo = new EntityDicQnSummary(); vo.fieldId = fieldId; vo.parentFieldId = fieldId; lstParm.Add(svc.GetDelParm(vo, EntityDicQnSummary.Columns.fieldId)); lstParm.Add(svc.GetDelParm(vo, EntityDicQnSummary.Columns.parentFieldId)); } if (lstSub != null) { num = 0; foreach (EntityDicQnSummary item in lstSub) { item.qnClassId = mainVo.qnClassId; item.typeId = mainVo.typeId; item.fieldId = fieldId + num; item.parentFieldId = fieldId; item.isEssential = mainVo.isEssential; item.isParent = 0; item.status = mainVo.status; item.sortNo = ++num; item.fieldId = fieldId + num.ToString().PadLeft(3, '0'); } } lstParm.Add(svc.GetInsertParm(mainVo)); if (lstSub != null && lstSub.Count > 0) { lstParm.Add(svc.GetInsertParm(lstSub.ToArray())); } affectRows = svc.Commit(lstParm); } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
internal List <EntityLxh> GetLxhInfo(string dteStart, string dteEnd) { string Sql = string.Empty; SqlHelper svc = null; List <EntityLxh> data = new List <EntityLxh>(); try { svc = new SqlHelper(EnumBiz.onlineDB); Sql = @"select b.patient_inhospitalno_chr, a.patient_name_vchr, a.sex_chr, a.age_chr, d.homephone_vchr, e.result_vchr, e.check_item_name_vchr from t_opr_lis_application a, t_opr_lis_sample b, t_bse_patientcard c, t_bse_patient d, t_opr_lis_check_result e where a.application_id_chr = b.application_id_chr and a.patientid_chr = c.patientcardid_chr and c.patientid_chr = d.patientid_chr and b.sample_id_chr = e.sample_id_chr and e.check_item_id_chr in ('000412', '001146', '001152', '001168', '001170', '000413', '001142', '001148', '001167', '001169', '000408', '001172', '000409', '001171', '000422', '001125', '000421', '001126', '001420', '000406', '001122', '001526', '000066', '000443', '001221', '001156', '001109', '000064', '000734', '001158', '001223', '000063', '001488', '001617', '000620', '001508', '002027', '002002') and a.patient_type_id_chr = 3 and a.pstatus_int = 2 and b.status_int = 6 and a.application_dat between to_date(?, 'yyyy-mm-dd hh24:mi:ss') and to_date(?, 'yyyy-mm-dd hh24:mi:ss') "; IDataParameter[] parm = svc.CreateParm(2); parm[0].Value = dteStart + " 00:00:00"; parm[1].Value = dteEnd + " 23:59:59";; DataTable dt = svc.GetDataTable(Sql, parm); if (dt != null && dt.Rows.Count > 0) { string inhospitalno = string.Empty; string name = string.Empty; string itemname = string.Empty; string result = string.Empty; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { inhospitalno = dr["patient_inhospitalno_chr"].ToString(); name = dr["patient_name_vchr"].ToString(); itemname = dr["check_item_name_vchr"].ToString(); if (data.Any(t => t.inhospitalno == inhospitalno && t.name == name)) { #region EntityLxh voClone = data.FirstOrDefault(t => t.inhospitalno == inhospitalno && t.name == name); if (itemname.Contains("总胆固醇")) { voClone.F1 = result.Trim(); } if (itemname.Contains("甘油")) { voClone.F2 = result.Trim(); } if (itemname.Contains("高密度脂蛋白胆固醇")) { voClone.F3 = result.Trim(); } if (itemname.Contains("低密度脂蛋白胆固醇")) { voClone.F4 = result.Trim(); } if (itemname.Contains("抗链球菌O溶血素")) { voClone.F5 = result.Trim(); } if (itemname.Contains("类风湿因子")) { voClone.F6 = result.Trim(); } if (itemname.Contains("C反应蛋白")) { voClone.F7 = result.Trim(); } if (itemname.Contains("肌酐")) { voClone.F8 = result.Trim(); } if (itemname.Contains("尿酸")) { voClone.F9 = result.Trim(); } if (itemname.Contains("血糖")) { voClone.F10 = result.Trim(); } if (itemname.Contains("25羟维生素D测定")) { voClone.F11 = result.Trim(); } if (itemname.Contains("抗环瓜氨酸肽抗体测定")) { voClone.F12 = result.Trim(); } if (itemname.Contains("血清铁蛋白")) { voClone.F13 = result.Trim(); } if (itemname.Contains("抗核抗体")) { voClone.F14 = result.Trim(); } if (itemname.Contains("尿素")) { voClone.F15 = result.Trim(); } #endregion } else { #region vo EntityLxh vo = new EntityLxh(); vo.inhospitalno = inhospitalno; vo.name = name; vo.sex = dr["sex_chr"].ToString(); vo.age = dr["sex_chr"].ToString(); vo.homephone = dr["homephone_vchr"].ToString(); if (itemname.Contains("总胆固醇")) { vo.F1 = result.Trim(); } if (itemname.Contains("甘油")) { vo.F2 = result.Trim(); } if (itemname.Contains("高密度脂蛋白胆固醇")) { vo.F3 = result.Trim(); } if (itemname.Contains("低密度脂蛋白胆固醇")) { vo.F4 = result.Trim(); } if (itemname.Contains("抗链球菌O溶血素")) { vo.F5 = result.Trim(); } if (itemname.Contains("类风湿因子")) { vo.F6 = result.Trim(); } if (itemname.Contains("C反应蛋白")) { vo.F7 = result.Trim(); } if (itemname.Contains("肌酐")) { vo.F8 = result.Trim(); } if (itemname.Contains("尿酸")) { vo.F9 = result.Trim(); } if (itemname.Contains("血糖")) { vo.F10 = result.Trim(); } if (itemname.Contains("25羟维生素D测定")) { vo.F11 = result.Trim(); } if (itemname.Contains("抗环瓜氨酸肽抗体测定")) { vo.F12 = result.Trim(); } if (itemname.Contains("血清铁蛋白")) { vo.F13 = result.Trim(); } if (itemname.Contains("抗核抗体")) { vo.F14 = result.Trim(); } if (itemname.Contains("尿素")) { vo.F15 = result.Trim(); } #endregion data.Add(vo); } } } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } return(data); }
public long m_lngGetReportInfoByReportGroupIDAndApplicationID(IPrincipal p_objPrincipal, string p_strReportGroupID, string p_strApplID, bool p_blnConfirmed, out DataTable p_dtbReportInfo) { p_dtbReportInfo = null; long result = -1; SqlHelper svc = null; svc = new SqlHelper(EnumBiz.onlineDB); string str = ""; if (p_blnConfirmed) { str = " AND t2.status_int = 2"; } else { str = " AND t2.status_int > 0"; } string Sql = @"SELECT t1.*, t2.*, t4.deptname_vchr, t5.lastname_vchr AS reportor, t6.lastname_vchr AS confirmer, t7.lastname_vchr AS applyer, t8.sample_type_desc_vchr, t9.application_form_no_chr AS check_no_chr, t10.print_title_vchr, t9.SUMMARY_VCHR AS application_summary, t21.sign_grp as reportorsign, t22.sign_grp as confirmersign, t23.sign_grp as applyersign FROM t_opr_lis_sample t1, t_opr_lis_app_report t2, t_opr_lis_app_sample t3, T_BSE_DEPTDESC t4, t_bse_employee t5, t_bse_employee t6, t_bse_employee t7, t_aid_lis_sampletype t8, t_opr_lis_application t9, t_aid_lis_report_group t10, t_bse_empsign t21, t_bse_empsign t22, t_bse_empsign t23 WHERE t2.application_id_chr = ? AND t2.report_group_id_chr = ? AND t2.report_group_id_chr = t3.report_group_id_chr AND t2.application_id_chr = t3.application_id_chr AND t3.sample_id_chr = t1.sample_id_chr AND t2.reportor_id_chr = t5.empid_chr(+) AND t2.confirmer_id_chr = t6.empid_chr(+) AND t9.appl_empid_chr = t7.empid_chr(+) AND t9.appl_deptid_chr = t4.deptid_chr(+) AND t1.sample_type_id_chr = t8.sample_type_id_chr(+) AND t2.application_id_chr = t9.application_id_chr AND t2.report_group_id_chr = t10.report_group_id_chr and t5.empid_chr = t21.empid_chr(+) and t6.empid_chr = t22.empid_chr(+) and t7.empid_chr = t23.empid_chr(+) AND t9.pstatus_int > 0 AND t1.status_int > 0 AND t2.status_int > 0"; Sql += str; try { IDataParameter[] param = null; param = svc.CreateParm(2); param[0].Value = p_strApplID; param[1].Value = p_strReportGroupID; p_dtbReportInfo = svc.GetDataTable(Sql, param); } catch (Exception objEx) { ExceptionLog.OutPutException("m_lngGetReportInfoByReportGroupIDAndApplicationID-->" + objEx); } if (p_dtbReportInfo != null && p_dtbReportInfo.Rows.Count > 0) { result = 1; } return(result); }
/// <summary> /// AddQuestCtrl /// </summary> void AddQuestCtrl(EntityQnRecord qnRecord) { try { if (qnRecord != null) { if (!string.IsNullOrEmpty(qnRecord.xmlData)) { XmlDocument document = new XmlDocument(); document.LoadXml(qnRecord.xmlData); XmlNodeList list = document["FormData"].ChildNodes; xmlData = list[1].OuterXml; dicData = Function.ReadXML(xmlData); } } using (Biz202 biz = new Biz202()) { lstCtrlLocation = biz.GetQnCtrlLocation(lstQuest[1]); } using (Biz209 biz = new Biz209()) { lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); biz.GetQnCustom(1, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; int F35Count = 0; int F35Row = (lstTopic.FindAll(r => r.fieldId.Contains("F035")).Count) / 6; int F35Y = 0; List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[1]) { if (item.fieldId.Contains("F035")) { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); chkAns.Text = item.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = item.fieldId; EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.name.Contains("F035"))[F35Count]; locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; F35Y += locationY; chkAns.Width = ctrLocat.width; chkAns.Height = ctrLocat.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(item.fieldId)) { string value = dicData[item.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); F35Count++; } } } F35Y -= 80; for (int i2 = 0; i2 < lstTopic.Count; i2++) { EntityDicQnSetting itemVo = lstTopic[i2]; if (itemVo.questName == lstQuest[1]) { if (string.IsNullOrEmpty(itemVo.parentFieldId) && !itemVo.fieldId.Contains("F035")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = itemVo.fieldId; lblTopic.Text = itemVo.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == itemVo.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY - F35Y; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == itemVo.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY - F35Y; chkAns.Width = ctrLocatChild.width; chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); } } } } } } if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); locationX = clVo.locationX; if (clVo.name == "FM0201") { locationY = clVo.locationY; } else if (clVo.name.Contains("FM")) { locationY = clVo.locationY - F35Y; } else { continue; } lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } finally { } }