/// <summary> /// GetPatient /// </summary> internal void GetPatient() { string cardNo = Viewer.txtCardNo.Text.Trim(); if (cardNo != string.Empty) { List <EntityPatientInfo> lstPat = null; List <EntityAidsCheck> lstPatLis = null; using (ProxyContagion proxy = new ProxyContagion()) { lstPat = proxy.Service.GetPatient(cardNo, Viewer.rdoFlag.SelectedIndex + 1); lstPatLis = proxy.Service.GetPatLisInfo(cardNo, Viewer.rdoFlag.SelectedIndex + 1, this.formId); } if (lstPat == null || lstPat.Count == 0) { DialogBox.Msg("查无此人."); return; } if (lstPat.Count == 1) { SetPatValue(lstPat[0]); } else if (lstPat.Count > 1) { SetPatValue(lstPat[0]); } if (lstPatLis != null && lstPatLis.Count > 0) { lstPat[0].clNo = lstPatLis[0].REQNO; SetLisValue(lstPatLis[0]); } } }
/// <summary> /// Init /// </summary> internal void Init() { try { Viewer.Location = new Point(Viewer.Location.X, 0); Viewer.Height = Screen.PrimaryScreen.WorkingArea.Height; uiHelper.BeginLoading(Viewer); #region 参数 using (ProxyEntityFactory proxy = new ProxyEntityFactory()) { ContagionParmData = EntityTools.ConvertToEntityList <EntityRptContagionParm>(proxy.Service.SelectFullTable(new EntityRptContagionParm())); } #endregion // 传染病报表 if (ContagionParmData != null) { if (ContagionParmData.Any(t => t.reportId == this.ContagionDisplayVo.reportId && t.keyId == "templateId")) { this.formId = Function.Dec(ContagionParmData.FirstOrDefault(t => t.reportId == this.ContagionDisplayVo.reportId && t.keyId == "templateId").keyValue); } } if (this.formId > 0) { using (ProxyFormDesign proxy = new ProxyFormDesign()) { proxy.Service.GetForm((int)this.formId, out FormDesignVo); } } if (FormDesignVo == null) { FormDesignVo = new EntityFormDesign(); } if (Function.Dec(this.ContagionDisplayVo.rptId) > 0) { using (ProxyContagion proxy = new ProxyContagion()) { EntityRptContagion vo = proxy.Service.GetContagion(Function.Dec(this.ContagionDisplayVo.rptId)); #region patientInfo Viewer.rdoFlag.SelectedIndex = vo.patType - 1; Viewer.rdoFlag.Properties.ReadOnly = true; Viewer.txtCardNo.Text = vo.patNo; #endregion LoadForm(FormDesignVo.Layout, vo.xmlData); GetPatient(); } } else { LoadForm(FormDesignVo.Layout, null); } } finally { uiHelper.CloseLoading(Viewer); } }
/// <summary> /// GetXR /// </summary> /// <returns></returns> XtraReport GetXR(decimal rptId) { EntityRptContagion contagionVo = null; using (ProxyContagion proxy = new ProxyContagion()) { contagionVo = proxy.Service.GetContagion(rptId); } EntityFormDesign formVo = null; EntityEmrPrintTemplate printVo = null; using (ProxyFormDesign proxy = new ProxyFormDesign()) { proxy.Service.GetForm((int)contagionVo.formId, out formVo); if (formVo == null) { return(null); } printVo = proxy.Service.GetFormPrintTemplate(1, formVo.Printtemplateid.ToString()); } DataTable printDataSource = FormTool.GetPrintDataTable(formVo.Layout, contagionVo.xmlData); if (printVo.templateFile != null && printVo.templateFile.Length > 0) { XtraReport xr = new XtraReport(); MemoryStream stream = new MemoryStream(printVo.templateFile); xr.LoadLayout(stream); xr.DataSource = printDataSource; return(xr); } else { return(null); } }
/// <summary> /// PopupForm /// </summary> /// <param name="vo"></param> void PopupForm(EntityContagionDisplay vo) { if (vo == null) { vo = new EntityContagionDisplay(); vo.isNew = true; } vo.reportId = Viewer.ReportId; frmContagionEdit frm = new frmContagionEdit(vo); frm.Text = Viewer.Text; using (ProxyContagion proxy = new ProxyContagion()) { if (Function.Int(vo.rptId) > 0) { string Role = proxy.Service.GetContagionRole(GlobalLogin.objLogin.EmpNo); frm.blbiSave.Enabled = false; if (Role != string.Empty || vo.SHR == null) { frm.blbiSave.Enabled = true; } } } frm.ShowDialog(); if (frm.IsSave) { this.Query(); } }
/// <summary> /// Query /// </summary> internal void Query() { List <EntityParm> dicParm = new List <EntityParm>(); string beginDate = Viewer.dteDateStart.Text.Trim(); string endDate = Viewer.dteDateEnd.Text.Trim(); if (beginDate != string.Empty && endDate != string.Empty) { if (Function.Datetime(beginDate + " 00:00:00") > Function.Datetime(endDate + " 00:00:00")) { DialogBox.Msg("开始时间不能大于结束时间。"); return; } dicParm.Add(Function.GetParm("reportDate", beginDate + "|" + endDate)); } if (Viewer.ucDept.DeptVo != null && !string.IsNullOrEmpty(Viewer.ucDept.DeptVo.deptCode)) { dicParm.Add(Function.GetParm("deptCode", Viewer.ucDept.DeptVo.deptCode)); } if (Viewer.txtCardNo.Text.Trim() != string.Empty) { dicParm.Add(Function.GetParm("cardNo", Viewer.txtCardNo.Text.Trim())); } if (Viewer.txtPatName.Text.Trim() != string.Empty) { dicParm.Add(Function.GetParm("patName", Viewer.txtPatName.Text.Trim())); } try { uiHelper.BeginLoading(Viewer); if (dicParm.Count > 0) { dicParm.Add(Function.GetParm("reportId", Viewer.ReportId)); using (ProxyContagion proxy = new ProxyContagion()) { List <EntityContagionDisplay> dataSource = proxy.Service.GetContagionList(dicParm); Viewer.gcReport.DataSource = dataSource; } } else { DialogBox.Msg("请输入查询条件。"); } } finally { uiHelper.CloseLoading(Viewer); } }
/// <summary> /// DelReport /// </summary> internal void DelReport() { EntityContagionDisplay vo = GetRowObject(); if (vo != null && Function.Dec(vo.rptId) > 0) { if (DialogBox.Msg("确定是否删除当前记录??", MessageBoxIcon.Question) == DialogResult.Yes) { using (ProxyContagion proxy = new ProxyContagion()) { if (proxy.Service.DelContagion(Function.Dec(vo.rptId)) > 0) { DialogBox.Msg("删除传染病记录成功!"); this.Query(); } else { DialogBox.Msg("删除传染病记录失败。"); } } } } }
/// <summary> /// Save /// </summary> internal void Save() { if (Viewer.txtPatName.Tag == null) { DialogBox.Msg("请先调出患者信息。"); return; } EntityPatientInfo patVo = Viewer.txtPatName.Tag as EntityPatientInfo; try { uiHelper.BeginLoading(Viewer); string fieldName = string.Empty; DateTime dtmNow = Utils.ServerTime(); EntityRptContagion vo = new EntityRptContagion(); vo.xmlData = Viewer.showPanelForm.XmlData(); if (Viewer.showPanelForm.IsAllowSave == false) { DialogBox.Msg("存在必填项目没有处理,请检查。项目:" + Viewer.showPanelForm.HintInfo); return; } vo.rptId = Function.Dec(this.ContagionDisplayVo.rptId); vo.reportId = this.ContagionDisplayVo.reportId; // 报告时间 if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "reportTime")) { fieldName = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "reportTime").keyValue; vo.reportTime = Viewer.showPanelForm.GetItemInfo(fieldName); if (vo.reportTime.Trim() == string.Empty) { vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss"); } } else { vo.reportTime = dtmNow.ToString("yyyy-MM-dd HH:mm:ss"); } // 上报科室 if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "deptCode")) { fieldName = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "deptCode").keyValue; string deptName = Viewer.showPanelForm.GetItemInfo(fieldName); } else { string deptName = GlobalLogin.objLogin.DeptName; } // 报告人 if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "operCode")) { fieldName = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "operCode").keyValue; vo.reportOperName = Viewer.showPanelForm.GetItemInfo(fieldName); if (GlobalDic.DataSourceEmployee.Any(t => t.operName == vo.reportOperName)) { vo.reportOperCode = GlobalDic.DataSourceEmployee.FirstOrDefault(t => t.operName == vo.reportOperName).operCode; } } else { vo.reportOperCode = GlobalLogin.objLogin.EmpNo; vo.reportOperName = GlobalLogin.objLogin.EmpName; } // 报告编号 if (ContagionParmData.Any(t => t.reportId == vo.reportId && t.keyId == "regCode")) { EntityRptContagionParm parm = ContagionParmData.FirstOrDefault(t => t.reportId == vo.reportId && t.keyId == "regCode"); // 计算类 if (parm.flag == 1) { string[] fieldNames = parm.keyValue.Split('+'); foreach (string fieldSub in fieldNames) { vo.registerCode += Viewer.showPanelForm.GetItemInfo(fieldSub); } } else { fieldName = parm.keyValue; vo.registerCode = Viewer.showPanelForm.GetItemInfo(fieldName); } } if (!string.IsNullOrEmpty(patVo.ipNo) && patVo.ipTimes > 0) { vo.patNo = patVo.ipNo; } else { vo.patNo = patVo.cardNo; } vo.patName = patVo.name; vo.patSex = patVo.sex; if (!string.IsNullOrEmpty(patVo.birth)) { vo.birthday = Function.Datetime(patVo.birth); } vo.contactTel = patVo.contTel; vo.deptCode = patVo.deptCode; vo.xmlData = Viewer.showPanelForm.XmlData(); vo.formId = this.formId; vo.operCode = GlobalLogin.objLogin.EmpNo; vo.recordDate = dtmNow; vo.status = 1; vo.patType = Viewer.rdoFlag.SelectedIndex + 1; string reqNo = patVo.clNo; using (ProxyContagion proxy = new ProxyContagion()) { decimal rptId = 0; if (proxy.Service.SaveContagion(vo, reqNo, out rptId) > 0) { Viewer.IsSave = true; if (this.ContagionDisplayVo.isNew) { this.ContagionDisplayVo.rptId = rptId.ToString(); } Viewer.txtCardNo.Properties.ReadOnly = true; DialogBox.Msg("数据保存成功!"); } else { DialogBox.Msg("数据保存失败。"); } } } finally { uiHelper.CloseLoading(Viewer); } }