/// <summary> /// 异步开始调用服务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _bgWork_DoWork(object sender, DoWorkEventArgs e) { YunZhiService service = null; try { service = new YunZhiService(); if (e.Argument != null) { string method = e.Argument.ToString(); switch (method.ToLower()) { case "getrecordlist": e.Result = new object[] { method.ToLower(), service.GetHealthy_RecordListByDocId(SourceHelper.EmployeeInfo.EmpID) }; break; case "getpatientinfo": if (string.IsNullOrEmpty(this._patientID)) { e.Result = null; } else { e.Result = new object[] { method.ToLower(), service.GetZhenLiaoListByPTID(this._patientID, SourceHelper.EmployeeInfo.HID, this._hrid) }; } break; } } } catch (Exception ex) { Logger.Log.Error("获取诊疗记录异常:" + ex.Message, ex); } finally { if (service != null) { service.Abort(); } } }
void _MainWork_DoWork(object sender, DoWorkEventArgs e) { YunZhiService service = null; try { service = new YunZhiService(); e.Result = service.GetZhenLiaoListByPTID(this._PID, this._HID, this._HRID); } catch (Exception ex) { Logger.Log.Error("获取诊疗详情错误:" + ex.Message, ex); } finally { if (service != null) { service.Abort(); } } }
private void btnPrint_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this._hrid) == true) { MessageBox.Show("请选择患者!"); return; } YunZhiService service = new YunZhiService(); try { if (System.IO.File.Exists(GetPath() + "chufang.frx") == false) { MessageBox.Show("未找到处方打印模板!"); return; } YunZhiResult res = service.GetZhenLiaoListByPTID(this._patientID, SourceHelper.EmployeeInfo.HID, this._hrid); if (res.Result == 0) { MessageBox.Show(res.Msg); return; } DataTable[] sourceList = res.DataList; //获取当前信息,然后打印 if (sourceList == null || sourceList.Length == 0) { return; } List <PrintModel> printList = new List <PrintModel>(); PrintModel model = new PrintModel(); DataTable source = sourceList[0]; List <YZ_Patients> patientList = new ModelHandler <YZ_Patients>().TableToList(source); if (patientList != null && patientList.Count > 0) { YZ_Patients patinetModel = patientList[0]; model.PTName = patinetModel.PTName; if (string.IsNullOrEmpty(patinetModel.PTBrithday) == false) { DateTime curTime = Convert.ToDateTime(patinetModel.PTBrithday); DateTime now = DateTime.Today; int age = now.Year - curTime.Year; if (curTime > now.AddYears(-age)) { age--; } model.PTNianLing = age.ToString(); } model.PTSex = patinetModel.PTSex == "0" ? "男" : "女"; } DataTable projectSource = sourceList[1]; List <YZ_Project> projectList = new ModelHandler <YZ_Project>().TableToList(projectSource); this.SetKuaiJianResult(projectList); List <YZ_Health_Record> recordList = new ModelHandler <YZ_Health_Record>().TableToList(sourceList[2]); if (recordList != null && recordList.Count > 0) { model.ZhenDuan = recordList[0].Data05; model.ZhuShu = recordList[0].Data04; } model.HosName = this.curHosName; if (sourceList[3] != null && sourceList[3].Rows != null && sourceList[3].Rows.Count > 0) { foreach (DataRow row in sourceList[3].Rows) { model.YaoPinList.Add(new YaoPinModel() { YaoPinName = row["DrugName"].ToString(), YongFa = row["DrugYF"].ToString(), YongLiang = row["DrugYL"].ToString() }); } printList.Add(model); } Report report = new Report(); report.Load(GetPath() + "chufang.frx"); report.RegisterData(printList, "CFDS"); report.Prepare(); report.ShowPrepared(); report.Dispose(); } catch (Exception ex) { Logger.Log.Error("SetJiBenAndProjectInfo异常:" + ex.Message, ex); MessageBox.Show(ex.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }