123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Forms;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PTMedicalInsurance.Business.Local
- {
- /// <summary>
- /// 查询是否工伤人员及信息
- /// </summary>
- class InjuryQueryProcess : AbstractProcess
- {
- public override CallResult Process(JObject input)
- {
- string patInfo = "";
- ChooseCard cc = new ChooseCard();
- cc.NameMustBeNotNull = true;
- IntPtr hWind = WinApi.GetWindowHandle("prBrowser");
- DialogResult dialog = DialogResult.None;
- if (hWind != IntPtr.Zero)
- {
- dialog = cc.ShowDialog(new WindowWrapper(hWind));
- }
- else
- {
- dialog = cc.ShowDialog();
- }
- if (dialog == DialogResult.OK)
- {
- //身份证
- if (cc.cardType == "02")
- {
- Global.pat.mdtrtcertType = "02";
- Global.pat.mdtrtcertNO = cc.ID;
- var ret = InjuryQuery();
- if (ret.code != 0)
- {
- return Exception("查询工伤信息失败", ret.data);
- }
- patInfo = ret.data;
- }
- else {
- return Exception(-1, "查询工伤信息只能用身份证+姓名", outParam);
- }
- }
- // 返回:data、mdtrtinfo、diseinfo、settlement
- if (hBus.showOutPatRegisterForm(patInfo, out outParam) != 0)
- {
- return Exception(-1, "显示登记面板", outParam);
- }
- //用于没有返回病人信息时增加
- JObject joInput = JObject.Parse(outParam);
- JObject joPatInfo = JObject.Parse(patInfo);
- joInput["patInfo"] = joPatInfo;
- outParam = joInput.ToString();
- return Success();
- }
- // 查询工伤信息并展示
- private (int code,string data) InjuryQuery()
- {
- string outParam = "";
- int code = 0;
- if (tradeGS001(out outParam) != 0)
- {
- string patInfo = outParam;
- code = showPatInfo(patInfo, out outParam);
- }
- return (code, outParam);
- }
- // 查询工伤接口
- public int tradeGS001(out string outParam)
- {
- outParam = "";
- string errorMsg = "";
- JObject joInput = new JObject();
- joInput.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
- joInput.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService(TradeEnum.PatientInjuryInfo, joInput);
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- outParam = "获取工伤信息失败:" + errorMsg;
- return -1;
- }
- else
- {
- outParam = joRtn.ToString();
- return 0;
- }
- }
- public int showPatInfo(String patInfo, out string outparam)
- {
- outparam = "";
- //展示信息界面
- JObject joOutparam = JObject.Parse(patInfo);
- JObject joOutput = JObject.Parse(JsonHelper.getDestValue(joOutparam, "output"));
- PatientInjuryForm frmPatientInfo = new PatientInjuryForm();
- //相关信息转换到登记面板
- try
- {
- frmPatientInfo.SetInjuryInfo(joOutput);
- if (frmPatientInfo.ShowDialog() == DialogResult.OK)
- {
- //现在用转换之前的
- JArray jaInsuInfo = JArray.Parse(JsonHelper.getDestValue(joOutput, "insuinfo"));
- JObject joSelectedInsuInfo = (JObject)jaInsuInfo[frmPatientInfo.insuInfoIndex];
- joOutparam.Property("output").AddBeforeSelf(new JProperty("selectedInsuInfo", joSelectedInsuInfo));
- outparam = joOutparam.ToString();
- return 0;
- }
- else
- {
- outparam = JsonHelper.setExceptionJson(-1, "门诊读卡", "收款员取消读卡").ToString();
- return -1;
- }
- }
- catch (Exception e)
- {
- outparam = JsonHelper.setExceptionJson(-1, "患者参保信息展示", e.Message).ToString();
- return -1;
- }
- }
- }
- }
|