Bläddra i källkod

pref: 住院流程通过

zhengjie 1 år sedan
förälder
incheckning
a68a2d8f9b

+ 4 - 3
Business/Basic/IPSettlementService.cs

@@ -22,11 +22,12 @@ namespace PTMedicalInsurance.Business
             Global.pat.RYorCY = "2";
 
             ProcessManager pManager = new ProcessManager()
-            .Add(new ReadPatientProcess())
             // 预结算
             .Add(new IPPreSettlementProcess())
+            // 出院
+            .Add(new IPExitProcess())
             // 结算
-            .Add(new IPSettlementProcess());
+            .Add(new IPSettlementProcess(joInput));
             // 执行
             return pManager.Run(joInput);
         }
@@ -37,7 +38,7 @@ namespace PTMedicalInsurance.Business
                // 查询结算信息
                .Add(new IPQuerySettlementProcess())
                // 结算撤销 
-               .Add(new IPSettlementCancelProcess());
+               .Add(new IPSettlementCancelProcess(joParam));
 
             // 执行
             return pManager.Run(joParam);

+ 3 - 214
Business/Basic/PatientService.cs

@@ -26,224 +26,13 @@ namespace PTMedicalInsurance.Business
         /// <returns></returns>
         public int readCard(out string outParam)
         {
-            outParam = "";
-            JObject joCardInfo = new JObject();
-            ChooseCard cc = new ChooseCard();
-            JObject joRtn = new JObject();
-            JObject joInput = new JObject();
-
-            try
-            {
-                if (cc.ShowDialog() == DialogResult.OK)
-                {
-                    Global.businessType = "";
-                    Utils.GetInsuCode();
-                    Global.pat.certType = "01";
-
-                    //电子凭证
-                    if (cc.cardType == "01")
-                    {
-
-                        Global.pat.mdtrtcertType = "01";
-                        Global.businessType = cc.businessType;
-                        tradeEcToken(out outParam);
-                        //return trade1161(out outParam);
-                        return 0;
-
-                    }
-                    //身份证
-                    if (cc.cardType == "02")
-                    {
-                        if (cc.ID == "")
-                        {
-                            Global.pat.mdtrtcertType = "02";
-                            Global.pat.name = "";
-                        }
-                        else
-                        {
-                            Global.pat.mdtrtcertType = "02";
-                            //读身份证
-                            CardReader reader = new CardReader();
-                            int rtn = reader.ReadSFZ(out outParam);
-                            if (rtn == 0)
-                            {
-                                trade1101(out outParam);
-                            }
-                            
-                        }
-                        return 0;
-                    }
-                    //社保卡
-                    if (cc.cardType == "03")
-                    {
-                        #region 调用读卡接口信息
-
-                        Global.pat.mdtrtcertType = "03";
-                        //return trade1161(out outParam);
-                        int rtn = 0;
-                        if (!Global.curEvt.enabledDebug)
-                        {
-                            CardReader reader = new CardReader();
-                            rtn = reader.ReadCardBas(out outParam);
-                        }
-                        if(rtn ==0)
-                        {
-                            trade1101(out outParam);
-                        }
-                        return rtn;
-                        #endregion
-
-                    }
-                }
-                else {
-                    outParam = JsonHelper.setExceptionJson(-1, "读卡", "取消读卡").ToString();
-                    return -1;
-                }
-                return 0;
-
-            }
-            catch (Exception ex)
-            {
-                outParam = "异常:" + ex.Message;
-                return -1;
-            }
+            CallResult ret = new ReadCardProcess().Process(null);
+            outParam = ret.Data;
+            return ret.Code;
         }
 
 
 
-        /// <summary>
-        /// 通过电子凭证获取基本信息
-        /// </summary>
-        /// <param name="outParam"></param>
-        /// <returns></returns>
-        public int tradeEcToken(out string outParam)
-        {
-            //cardInfo
-            outParam = ECTokenReader.ECQuery("1");
-
-            trade1101(out outParam);
-
-            return 0;
-        }
-
-        /// <summary>
-        /// 通过证件号获取基本信息(无卡)
-        /// </summary>
-        /// <param name="cardNo"></param>
-        /// <param name="outParam"></param>
-        /// <returns></returns>
-        public int trade1101(out string outParam)
-        {
-            outParam = "";
-            string errorMsg = "";
-            JObject joInput = new JObject();
-
-            JObject joData = new JObject();
-            joData.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
-            joData.Add("mdtrt_cert_no", Utils.ConvertMdtrtcertNo());
-            joData.Add("card_sn", Global.pat.card.SN);
-            joData.Add("begntime", Utils.GetDateTimeNow());
-            joData.Add("psn_cert_type", Global.pat.certType);
-            joData.Add("certno", Global.pat.certNO); //证件号码
-            joData.Add("psn_name", Global.pat.name);
-
-            joInput.Add("data", joData);
-            InvokeHelper invoker = new InvokeHelper();
-            JObject joRtn = invoker.invokeCenterService(TradeEnum.PatientInfo, joInput);
-
-            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
-            {
-                outParam = "获取病人信息失败:" + errorMsg;
-                return -1;
-            }
-            else
-            {
-                //手动增加业务码(沈阳)
-                joRtn["output"]["baseinfo"]["bizCode"] = Global.pat.card.BusinessCode;
-                outParam = joRtn.ToString();
-                parsePatient(joRtn);
-
-                return 0;
-            }
-        }
-
-        /// <summary>
-        /// 读卡并获取基本信息
-        /// </summary>
-        /// <param name="outParam"></param>
-        /// <returns></returns>
-        public int trade1161( out string outParam)
-        {
-            outParam = "";
-            string errorMsg = "";
-
-            JObject joInput = new JObject();
-            joInput.Add("begntime", Utils.GetDateTimeNow());
-
-            JObject joRtn = new JObject();
-            joRtn = invoker.invokeCenterService(TradeEnum.ReadCardInfo, joInput);
-            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
-            {
-                outParam = "读卡失败:" + errorMsg;
-                return -1;
-            }
-            else
-            {
-                parsePatient(joRtn);
-                outParam = joRtn.ToString();
-            }
-            return 0;
-        }
-
-        /// <summary>
-        /// 解析人员基本信息
-        /// </summary>
-        /// <param name="joRtn"></param>
-        public void parsePatient(JObject joRtn)
-        {
-            // 基线版
-            PersonCardInfo info = JsonHelper.getOutput<PersonCardInfo>(joRtn);
-            if (info.cardInfo != null)
-            {
-                Global.pat.card.NO = info.cardInfo.cardno;
-                Global.pat.card.SN = info.cardInfo.card_sn;
-                Global.pat.card.Cardtoken = info.cardInfo.ecToken;
-                Global.pat.ecToken = info.cardInfo.ecToken;
-            }
-
-            //Global.writeLog("病人信息:"+joRtn.ToString());
-
-            if (info.insuInfo != null && info.insuInfo.Length > 0)
-            {
-                //参保地
-                Global.pat.insuplc_admdvs = info.insuInfo[0].insuplc_admdvs;
-                Global.pat.insuplc_name = info.insuInfo[0].insuplc_name;
-                Global.pat.medType = info.insuInfo[0].med_type ?? "C";
-            }
-            //证件号
-            Global.pat.certNO = info.baseInfo?.certno;
-            // 人员证件类型
-            Global.pat.certType = info.baseInfo?.psn_cert_type;
-            // 就诊类型
-            if(string.IsNullOrEmpty(Global.pat.mdtrtcertType))
-            {
-                Global.pat.mdtrtcertType = "03";
-            }
-            // 就诊凭证号
-            if (!string.IsNullOrEmpty(Global.pat.card.NO))
-            {
-                Global.pat.mdtrtcertNO = Global.pat.card.NO;
-            }
-
-            if (string.IsNullOrEmpty(Global.pat.mdtrtcertNO))
-            {
-                Global.pat.mdtrtcertNO = Global.pat.certNO;
-            }
-            
-            Global.pat.payOrdId = info.platformOrderNo;
-
-        }
-
         /// <summary>
         /// 读卡并展示病人信息
         /// </summary>

+ 2 - 2
Business/CenterBusiness.cs

@@ -312,7 +312,6 @@ namespace PTMedicalInsurance.Business
             {
                 //组织入参
                 dynamic joTmp = new JObject();
-                joTmp.chrg_bchno = "0000";
                 joTmp.mdtrt_id = Global.pat.mdtrtID;
                 joTmp.adm_Dr = Global.pat.adm_Dr.ToString();
                 joTmp.psn_no = Global.pat.psn_no;
@@ -320,15 +319,16 @@ namespace PTMedicalInsurance.Business
                 JObject joData = new JObject();
                 if (trade == TradeEnum.OutpatientFeeCancel)
                 {
+                    joTmp.chrg_bchno = "0000";
                     joData.Add("data", joTmp);
                 }
                 else
                 {
+                    joTmp.feedetl_sn = "0000";
                     JArray jaData = new JArray();
                     jaData.Add(joTmp);
                     joData.Add("data", jaData);
                 }
-                    
 
                 //组织好后上传给中心
                 JObject joRtn = invoker.invokeCenterService(trade, joData);

+ 27 - 0
Business/Inpatient/IPExitProcess.cs

@@ -0,0 +1,27 @@
+using Newtonsoft.Json.Linq;
+using PTMedicalInsurance.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PTMedicalInsurance.Business
+{
+    class IPExitProcess : AbstractProcess
+    {
+        public override CallResult Process(JObject input)
+        {
+            string errMsg = "";
+            JObject jo2402Inpar = JObject.Parse(JsonHelper.getDestValue(input, "DischargeRegister"));
+            JObject jo2402Rtn = invoker.invokeCenterService(TradeEnum.InpatientExit, jo2402Inpar);
+
+            if (JsonHelper.parseCenterRtnValue(jo2402Rtn, out errMsg) != 0)
+            {
+                return Exception(-1, "出院登记失败", errMsg);
+            }
+            outParam = input.ToString();
+            return Success();
+        }
+    }
+}

+ 9 - 1
Business/Inpatient/IPPreSettlementProcess.cs

@@ -12,6 +12,8 @@ namespace PTMedicalInsurance.Business
 {
     class IPPreSettlementProcess : AbstractProcess
     {
+        public IPPreSettlementProcess() {
+        }
         public override CallResult Process(JObject input)
         {
             //JObject joSettlement = new JObject();
@@ -152,9 +154,15 @@ namespace PTMedicalInsurance.Business
                 return Exception(-1, "结算信息展示", outParam);
             }
             //沈阳预结算不需要转换mdtrtCertNo,但结算需要
+            //在正式结算前读一次卡
+            //清除原数据
+            if ("03".Equals(Global.pat.mdtrtcertType)) {
+                CardReader reader = new CardReader();
+                reader.ReadCardBas(out outParam);
+            }
+            //读完卡后用新卡串
             Global.pat.mdtrtcertNO = "";
             joRtn["Settlement"]["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo();
-
             //joSettlement = (JObject)joRtn.DeepClone();
             outParam = joRtn.ToString();
             #endregion

+ 4 - 13
Business/Inpatient/IPSettlementProcess.cs

@@ -31,27 +31,18 @@ namespace PTMedicalInsurance.Business
             joDataExp.Add("elec_billno_code", "");
             joDataExp.Add("elec_bill_chkcode", "");
             joSettlement["exp_content"] = joDataExp;
-
             joSettlement.Add("data", joSettlement);
+
             JObject jo2304Rtn = invoker.invokeCenterService(TradeEnum.InpatientSettlement, joSettlement);
             if (JsonHelper.parseCenterRtnValue(jo2304Rtn, out errMsg) != 0)
             {
-                //cBus.cancleRegister(TradeEnum.InpatientExitCancel, out errMsg);
+                //取消出院
+                new InpatientExitCancelProcess().Process(input);
                 return Exception(-1, "结算失败", errMsg);
             }
             else
             {
-                // TODO:出院登记应独立出流程
-                JObject jo2402Inpar = JObject.Parse(JsonHelper.getDestValue(input, "DischargeRegister"));
-                JObject jo2402Rtn = invoker.invokeCenterService(TradeEnum.InpatientExit, jo2402Inpar);
-
-                if (JsonHelper.parseCenterRtnValue(jo2402Rtn, out errMsg) != 0)
-                {
-                    return Exception(-1, "出院登记失败", errMsg);
-                }
-
                 JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2304Rtn, "output.setlinfo"));
-
                 //济南未返回基金分项,手工拆分
                 //JArray fundArray = new LocalPayFundSplitService().Split(joSetlinfo);
                 //if (fundArray?.Count > 0)
@@ -71,7 +62,7 @@ namespace PTMedicalInsurance.Business
                     return Exception(-1, "云医保平台保存结算明细失败", errMsg);
                 }
                 //返回给HIS
-                if (hIS.returnInpatSettlementInfo(this.OrginalInput, joSetlinfo, out outParam) != 0)
+                if (hIS.returnInpatSettlementInfo(OrginalInput, joSetlinfo, out outParam) != 0)
                 {
                     return Exception(-1, "返回结算信息给HIS", outParam);
                 }

+ 240 - 0
Business/Local/ReadCardProcess.cs

@@ -0,0 +1,240 @@
+using Newtonsoft.Json.Linq;
+using PTMedicalInsurance.Common;
+using PTMedicalInsurance.Entity;
+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
+{
+    class ReadCardProcess : AbstractProcess
+    {
+        public override CallResult Process(JObject input)
+        {
+            JObject joCardInfo = new JObject();
+            ChooseCard cc = new ChooseCard();
+            JObject joRtn = new JObject();
+            JObject joInput = new JObject();
+
+            try
+            {
+                if (cc.ShowDialog() == DialogResult.OK)
+                {
+                    Global.businessType = "";
+                    Utils.GetInsuCode();
+                    Global.pat.certType = "01";
+
+                    //电子凭证
+                    if (cc.cardType == "01")
+                    {
+
+                        Global.pat.mdtrtcertType = "01";
+                        Global.businessType = cc.businessType;
+                        tradeEcToken(out outParam);
+                        //return trade1161(out outParam);
+                        return Success();
+
+                    }
+                    //身份证
+                    if (cc.cardType == "02")
+                    {
+                        if (cc.ID == "")
+                        {
+                            Global.pat.mdtrtcertType = "02";
+                            Global.pat.name = "";
+                        }
+                        else
+                        {
+                            Global.pat.mdtrtcertType = "02";
+                            //读身份证
+                            CardReader reader = new CardReader();
+                            int rtn = reader.ReadSFZ(out outParam);
+                            if (rtn == 0)
+                            {
+                                trade1101(out outParam);
+                            }
+
+                        }
+                        return Success();
+                    }
+                    //社保卡
+                    if (cc.cardType == "03")
+                    {
+                        #region 调用读卡接口信息
+
+                        Global.pat.mdtrtcertType = "03";
+                        
+                        //return trade1161(out outParam);
+                        int rtn = 0;
+                        if (!Global.curEvt.enabledDebug)
+                        {
+                            CardReader reader = new CardReader();
+                            rtn = reader.ReadCardBas(out outParam);
+                        }
+                        if (rtn == 0)
+                        {
+                            //清除原数据
+                            trade1101(out outParam);
+                        }
+                        return Success();
+                        #endregion
+
+                    }
+                }
+                else
+                {
+                    //outParam = JsonHelper.setExceptionJson().ToString();
+                    return Exception(-1, "读卡", "取消读卡");
+                }
+                return Success();
+
+            }
+            catch (Exception ex)
+            {
+                return Error("异常:" + ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// 通过证件号获取基本信息(无卡)
+        /// </summary>
+        /// <param name="cardNo"></param>
+        /// <param name="outParam"></param>
+        /// <returns></returns>
+        public int trade1101(out string outParam)
+        {
+            outParam = "";
+            string errorMsg = "";
+            JObject joInput = new JObject();
+
+            JObject joData = new JObject();
+            joData.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
+            joData.Add("mdtrt_cert_no", Utils.ConvertMdtrtcertNo());
+            joData.Add("card_sn", Global.pat.card.SN);
+            joData.Add("begntime", Utils.GetDateTimeNow());
+            joData.Add("psn_cert_type", Global.pat.certType);
+            joData.Add("certno", Global.pat.certNO); //证件号码
+            joData.Add("psn_name", Global.pat.name);
+
+            joInput.Add("data", joData);
+            InvokeHelper invoker = new InvokeHelper();
+            JObject joRtn = invoker.invokeCenterService(TradeEnum.PatientInfo, joInput);
+
+            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
+            {
+                outParam = "获取病人信息失败:" + errorMsg;
+                return -1;
+            }
+            else
+            {
+                //手动增加业务码(沈阳)
+                joRtn["output"]["baseinfo"]["bizCode"] = Global.pat.card.BusinessCode;
+                outParam = joRtn.ToString();
+                parsePatient(joRtn);
+
+                return 0;
+            }
+        }
+
+        /// <summary>
+        /// 读卡并获取基本信息
+        /// </summary>
+        /// <param name="outParam"></param>
+        /// <returns></returns>
+        public int trade1161(out string outParam)
+        {
+            outParam = "";
+            string errorMsg = "";
+
+            JObject joInput = new JObject();
+            joInput.Add("begntime", Utils.GetDateTimeNow());
+
+            JObject joRtn = new JObject();
+            joRtn = invoker.invokeCenterService(TradeEnum.ReadCardInfo, joInput);
+            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
+            {
+                outParam = "读卡失败:" + errorMsg;
+                return -1;
+            }
+            else
+            {
+                parsePatient(joRtn);
+                outParam = joRtn.ToString();
+            }
+            return 0;
+        }
+
+        /// <summary>
+        /// 解析人员基本信息
+        /// </summary>
+        /// <param name="joRtn"></param>
+        public void parsePatient(JObject joRtn)
+        {
+            // 基线版
+            PersonCardInfo info = JsonHelper.getOutput<PersonCardInfo>(joRtn);
+            if (info.cardInfo != null)
+            {
+                Global.pat.card.NO = info.cardInfo.cardno;
+                Global.pat.card.SN = info.cardInfo.card_sn;
+                Global.pat.card.Cardtoken = info.cardInfo.ecToken;
+                Global.pat.ecToken = info.cardInfo.ecToken;
+            }
+
+            //Global.writeLog("病人信息:"+joRtn.ToString());
+
+            if (info.insuInfo != null && info.insuInfo.Length > 0)
+            {
+                //参保地
+                Global.pat.insuplc_admdvs = info.insuInfo[0].insuplc_admdvs;
+                Global.pat.insuplc_name = info.insuInfo[0].insuplc_name;
+                Global.pat.medType = info.insuInfo[0].med_type ?? "C";
+            }
+            //证件号
+            Global.pat.certNO = info.baseInfo?.certno;
+            // 人员证件类型
+            Global.pat.certType = info.baseInfo?.psn_cert_type;
+            // 就诊类型
+            if (string.IsNullOrEmpty(Global.pat.mdtrtcertType))
+            {
+                Global.pat.mdtrtcertType = "03";
+            }
+            // 就诊凭证号
+            if (!string.IsNullOrEmpty(Global.pat.card.NO))
+            {
+                Global.pat.mdtrtcertNO = Global.pat.card.NO;
+            }
+
+            if (string.IsNullOrEmpty(Global.pat.mdtrtcertNO))
+            {
+                Global.pat.mdtrtcertNO = Global.pat.certNO;
+            }
+
+            Global.pat.payOrdId = info.platformOrderNo;
+
+        }
+
+
+        /// <summary>
+        /// 通过电子凭证获取基本信息
+        /// </summary>
+        /// <param name="outParam"></param>
+        /// <returns></returns>
+        public int tradeEcToken(out string outParam)
+        {
+            //cardInfo
+            outParam = ECTokenReader.ECQuery("1");
+
+            trade1101(out outParam);
+
+            return 0;
+        }
+
+
+    }
+}

+ 6 - 4
Common/Utils.cs

@@ -337,14 +337,16 @@ namespace PTMedicalInsurance.Common
             }
             else
             {
-                if (!string.IsNullOrEmpty(Global.pat.mdtrtcertNO) && Global.pat.mdtrtcertNO.Contains("|"))
+                string mdtrtCertNo = Global.pat.mdtrtcertNO;
+                if (!string.IsNullOrEmpty(mdtrtCertNo) && mdtrtCertNo.Contains("|"))
                 {
-                    Global.pat.card.NO = Global.pat.mdtrtcertNO.Split("|".ToCharArray())[0];
-                    Global.pat.card.BusinessCode = Global.pat.mdtrtcertNO.Split("|".ToCharArray())[1];
+                    Global.pat.card.NO = mdtrtCertNo.Split("|".ToCharArray())[0];
+                    Global.pat.card.BusinessCode = mdtrtCertNo.Split("|".ToCharArray())[1];
                 }
 
                 if (flag) {
-                    if (string.IsNullOrEmpty(Global.pat.mdtrtcertNO))
+                    //沈阳特殊
+                    if (string.IsNullOrEmpty(mdtrtCertNo) || !mdtrtCertNo.Contains("|"))
                     {
                         Global.pat.mdtrtcertNO = Global.pat.card.NO + "|" + Global.pat.card.BusinessCode;
                     }

+ 2 - 0
ShenYangMI.csproj

@@ -96,6 +96,7 @@
     <Compile Include="Business\DataImoport.cs" />
     <Compile Include="Business\HisMainBusiness.cs" />
     <Compile Include="Business\Inpatient\IPExitCancelProcess.cs" />
+    <Compile Include="Business\Inpatient\IPExitProcess.cs" />
     <Compile Include="Business\Inpatient\IPFeeUploadCancelProcess.cs" />
     <Compile Include="Business\Inpatient\IPFeeUploadProcess.cs" />
     <Compile Include="Business\Inpatient\IPPreSettlementProcess.cs" />
@@ -107,6 +108,7 @@
     <Compile Include="Business\Inpatient\IPSettlementCancelProcess.cs" />
     <Compile Include="Business\InsuServices.cs" />
     <Compile Include="Business\Basic\IPSettlementService.cs" />
+    <Compile Include="Business\Local\ReadCardProcess.cs" />
     <Compile Include="Business\Local\TestProcess.cs" />
     <Compile Include="Business\Other\MedDirDownloadProcess.cs" />
     <Compile Include="Business\Other\SettleBillPrintProcess.cs" />