Forráskód Böngészése

pref: 门诊收费通过

zhengjie 1 éve
szülő
commit
d9a481cee3

+ 13 - 7
Business/Basic/PatientService.cs

@@ -80,9 +80,12 @@ namespace PTMedicalInsurance.Business
 
                         Global.pat.mdtrtcertType = "03";
                         //return trade1161(out outParam);
-
-                        CardReader reader = new CardReader();
-                        int rtn = reader.ReadCardBas(out outParam);
+                        int rtn = 0;
+                        if (!Global.curEvt.enabledDebug)
+                        {
+                            CardReader reader = new CardReader();
+                            rtn = reader.ReadCardBas(out outParam);
+                        }
                         if(rtn ==0)
                         {
                             trade1101(out outParam);
@@ -198,10 +201,13 @@ namespace PTMedicalInsurance.Business
         {
             // 基线版
             PersonCardInfo info = JsonHelper.getOutput<PersonCardInfo>(joRtn);
-            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;
+            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());
 

+ 1 - 0
Business/Basic/ReadPatientProcess.cs

@@ -29,6 +29,7 @@ namespace PTMedicalInsurance.Business
                 return Exception(-1, "显示登记面板", outParam);
             }
 
+            //用于没有返回病人信息时增加
             JObject joInput = JObject.Parse(outParam);
             JObject joPatInfo = JObject.Parse(patInfo);
             joInput["patInfo"] = joPatInfo;

+ 1 - 2
Business/Outpatient/OPFeeUploadProcess.cs

@@ -16,8 +16,7 @@ namespace PTMedicalInsurance.Business
             var ret = hBus.getFeeDetail();
             if (ret.code < 0)
             {
-                outParam = ret.data.ToString();
-                return Error("获取费用明细失败");
+                return Exception("费用上传", ret.data.ToString());
             }
             JArray jaFeeDetail = (JArray)ret.data;
             //按指定条数分割后上传,保存,更新

+ 12 - 14
Business/Outpatient/OPPreSettlementProcess.cs

@@ -30,13 +30,12 @@ namespace PTMedicalInsurance.Business
             JObject joSettlement = JObject.Parse(JsonHelper.getDestValue(joReg, "settlement"));
             //修改joSettlement的就诊ID ,总金额等
             joSettlement["mdtrt_id"] = Global.pat.mdtrtID;
+            joSettlement["mdtrt_cert_no"] = Global.pat.mdtrtcertNO;   //与计算不需要转换
             joSettlement["medfee_sumamt"] = JsonHelper.getDestValue(joSumFee, "data.Sumamt");
-            joSettlement["register_flag"] = "0"; //挂号标志
             if ("RegisterOP".Equals(OperationType))
             {
                 // 门诊挂号(医疗类别/统筹类别)
-                joSettlement["med_type"] = "6";
-                joSettlement["register_flag"] = "1";
+                joSettlement["med_type"] = "12";
             }
 
             // 个性化(济南),费用不单独上传
@@ -52,21 +51,19 @@ namespace PTMedicalInsurance.Business
             //    otherAreaFlag = "01"; //本地
             //}
             //joSettlement.Add("other_area_flag", otherAreaFlag);
-
-
-            var ret = hBus.getFeeDetail();
-            if (ret.code < 0)
-            {
-                return Error(ret.code,ret.data.ToString());
-            }
-            JArray jaFeeDetail = (JArray)ret.data;
-            joSettlement["feeDetail"] = jaFeeDetail;
+            //var ret = hBus.getFeeDetail();
+            //if (ret.code < 0)
+            //{
+            //    return Error(ret.code,ret.data.ToString());
+            //}
+            //JArray jaFeeDetail = (JArray)ret.data;
+            //joSettlement["feeDetail"] = jaFeeDetail;
 
 
             //预结算  
             JObject jo2206Data = new JObject();
             jo2206Data.Add("data", joSettlement);
-            JObject jo2206Rtn = invoker.invokeCenterService(TradeEnum.OutpatientPreSettlement, jo2206Data);
+            JObject jo2206Rtn = invoker.invokeCenterService(TradeEnum.OutpatientPreSettlementA, jo2206Data);
             if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
             {
                 return Exception(-1, "出院预结算", outParam);
@@ -116,7 +113,8 @@ namespace PTMedicalInsurance.Business
             //joRtnSettle["exp_content"] = joDataExp;
 
             joRtn.Add("setlinfo", joRtnSettle);
-
+            //结算需要转换
+            joRtn["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo();
             outParam = joRtn.ToString();
 
             return Success();

+ 7 - 2
Business/Outpatient/OPRegProcess.cs

@@ -34,6 +34,10 @@ namespace PTMedicalInsurance.Business
             {
                 Global.pat.mdtrtID = JsonHelper.getDestValue(jo2201Rtn, "output.data.mdtrt_id");
                 string outParam = "";
+                // 兼容不同的模式
+                if (joPatient.ContainsKey("patInfo")) {
+                    joPatient = JObject.Parse(JsonHelper.getDestValue(joPatient,"patInfo"));
+                }
                 //插入患者本次就诊用的参保信息
                 if (hBus.insertPatCurInsuInfo(joPatient.ToString(), out outParam) != 0)
                 {
@@ -67,10 +71,11 @@ namespace PTMedicalInsurance.Business
             //此处先取到就诊信息上传的入参,只要挂号成功就保存到云HIS后台(保存后台需要用到2203入参)
             JObject jo2203Inpar = new JObject();
             JObject jo2203Inpar_plain = new JObject();
+            joPatient["mdtrtinfo"]["mdtrt_id"] = Global.pat.mdtrtID;
+
             jo2203Inpar.Add("mdtrtinfo", JObject.Parse(JsonHelper.getDestValue(joPatient, "mdtrtinfo")));
             jo2203Inpar.Add("diseinfo", JArray.Parse(JsonHelper.getDestValue(joPatient, "diseinfo")));
-
-            jo2203Inpar["mdtrtinfo"]["mdtrt_id"] = Global.pat.mdtrtID;
+            
             jo2203Inpar_plain = JObject.Parse(JsonHelper.setCenterInpar_plain("2203A", jo2203Inpar));
             jo2203Inpar = JObject.Parse(JsonHelper.setCenterInpar("2203A", jo2203Inpar));
 

+ 16 - 11
Common/CardReader.cs

@@ -50,12 +50,12 @@ namespace PTMedicalInsurance.Common
         static extern IntPtr DailySinIn(StringBuilder OutData);
 
         //电子凭证
-        [DllImport("HeaSecReadInfo.dll", EntryPoint = "EcQuery", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
+        [DllImport(DllPath, EntryPoint = "EcQuery", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
         public static extern int NationEcTrans(StringBuilder InData, StringBuilder OutData);
 
         public CardReader()
         {
-            CardReader.Init();
+           CardReader.Init();
         }
 
         public static int Init()
@@ -150,22 +150,27 @@ namespace PTMedicalInsurance.Common
         /// </summary>
         /// <param name="outBuff"></param>
         /// <returns></returns>
-        private string parseCardInfo(string outBuff)
+        private string parseCardInfo(string inBuff)
         {
-            //发卡地区行政区划代码(卡识别码前6位)、社会保障号码、卡号、卡识别码、姓名、卡复位信息(仅取历史字节)、规范版本、发卡日期、卡有效期、终端机编号、终端设备号。各数据项之间以“|”分割,且最后一个数据项以“|”结尾
-            string[] data = outBuff.Split("|".ToCharArray());
+            //卡类型、发卡地区行政区划代码(卡识别码前6位)、社会保障号码、卡号、卡识别码、姓名、卡复位信息(仅取历史字节)、规范版本、发卡日期、卡有效期、终端机编号、终端设备号。各数据项之间以“|”分割,且最后一个数据项以“|”结尾
+            string[] data = inBuff.Split("|".ToCharArray());
             CardInfo card = new CardInfo();
-            card.certno = data[1];
-            card.cardno = data[2];
-            card.card_sn = data[3];
-            card.psn_name = data[4];
-            Global.pat.insuplc_admdvs = data[0]; //行政区划
+            card.certno = data[2];
+            card.cardno = data[3];
+            card.card_sn = data[4];
+            card.psn_name = data[5];
+            
+            Global.pat.insuplc_admdvs = data[1]; //行政区划
             Global.pat.card.SN = card.card_sn;
             Global.pat.certNO = card.certno;
             Global.pat.name = card.psn_name;
             Global.pat.card.NO = card.cardno;
 
-            return JsonHelper.toJsonString(card);
+            Global.pat.mdtrtcertNO = card.certno;
+
+            string outParam = JsonHelper.toJsonString(card);
+            Global.writeLog("读卡返回:", inBuff, outParam);
+            return outParam;
         }
 
         //public string FastReportPrint(out string OutData)

+ 12 - 3
Common/Utils.cs

@@ -289,7 +289,7 @@ namespace PTMedicalInsurance.Common
                 joOutput = mapper.MapRequest<JObject, T>(request);
             }
             // 日志
-            Global.writeLog("ConvertRequest", request.ToString(),joOutput.ToString());
+            //Global.writeLog("ConvertRequest", request.ToString(),joOutput.ToString());
             return joOutput;
         }
 
@@ -318,7 +318,7 @@ namespace PTMedicalInsurance.Common
                 joOutput = mapper.MapResponse<JObject, T>(response);
             }
             // 日志
-            Global.writeLog("ConvertResponse", "", joOutput.ToString());
+            //Global.writeLog("ConvertResponse", "", joOutput.ToString());
             return joOutput;
         }
         /// <summary>
@@ -331,10 +331,14 @@ namespace PTMedicalInsurance.Common
             {
                 return Global.pat.mdtrtcertNO;
             }
-            else
+            else if("02".Equals(Global.pat.mdtrtcertType))
             {
                 return Global.pat.certNO + "|" + Global.pat.card.BusinessCode;
             }
+            else
+            {
+                return Global.pat.card.NO + "|" + Global.pat.card.BusinessCode;
+            }
         }
 
         /// <summary>
@@ -387,6 +391,11 @@ namespace PTMedicalInsurance.Common
             return true;
         }
 
+        public static void WriteMockData(bool requestFlag, string tradeNo,string content)
+        {
+            string dataFile = Global.curEvt.path + "/config/mock/" + (requestFlag ? "request" : "response") + "/" + tradeNo + ".json";
+            File.WriteAllText(dataFile, content);
+        }
 
         public static string MockData(bool requestFlag,string tradeNo)
         {

+ 25 - 18
Forms/BasicData.cs

@@ -1304,7 +1304,7 @@ namespace PTMedicalInsurance.Forms
         /// </summary>
         private void SingleUpload()
         {
-            if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
+            if ((dgvHISDirectory.CurrentRow == null))
             {
                 MessageBox.Show("请查询HIS目录对照关系");
                 return;
@@ -1336,13 +1336,14 @@ namespace PTMedicalInsurance.Forms
             string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
             string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
 
+            JArray dataArray = new JArray();
             //调用3301目录对照上传
             JObject joData = new JObject();
             joData.Add("fixmedins_hilist_id", HisCode);
             joData.Add("fixmedins_hilist_name", HisName);
             joData.Add("list_type", sMLLX);            //目录类别
             joData.Add("med_list_codg", InsuCode);     //医疗目录编码
-            joData.Add("begndate", "2022-10-01");      //开始日期
+            joData.Add("begndate", "2023-10-01");      //开始日期
             joData.Add("enddate", UpdateDate);         //结束日期
             joData.Add("aprvno", "");
             joData.Add("dosform", "");
@@ -1352,12 +1353,15 @@ namespace PTMedicalInsurance.Forms
             joData.Add("spec", "");
             joData.Add("pacspec", "");
             joData.Add("memo", "");
+
+            dataArray.Add(joData);
+            // 单条与多条保持一致
             JObject joInput = new JObject();
-            joInput.Add("data", joData);
+            joInput.Add("data", dataArray);
 
             InvokeHelper invoker = new InvokeHelper();
-
-            JObject joRtn = invoker.invokeCenterService(TradeEnum.PreAnalysis, joInput);
+            Global.pat.insuplc_admdvs = Global.inf.areaCode;
+            JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
             if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
             {
                 MessageBox.Show("目录对照关系上传失败:" + errorMsg);
@@ -1412,7 +1416,7 @@ namespace PTMedicalInsurance.Forms
             joInput.Add("data", joData);
 
             InvokeHelper invoker = new InvokeHelper();
-
+            Global.pat.insuplc_admdvs = Global.inf.areaCode;
             JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastCancel, joInput);
             if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
             {
@@ -1429,7 +1433,7 @@ namespace PTMedicalInsurance.Forms
         /// </summary>
         private void AllUpLoad()
         {
-            if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
+            if ((dgvHISDirectory.CurrentRow == null))
             {
                 MessageBox.Show("请查询HIS目录对照关系");
                 return;
@@ -1454,8 +1458,8 @@ namespace PTMedicalInsurance.Forms
                 sMLLX = "301";
             }
 
-            DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;                   
-
+            DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
+            JArray dataArray = new JArray();
             for (int i = 0; i < dtHis.Rows.Count; i++)
             {                
                 string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();  //医保目录编码
@@ -1479,16 +1483,19 @@ namespace PTMedicalInsurance.Forms
                 joData.Add("spec", "");
                 joData.Add("pacspec", "");
                 joData.Add("memo", "");
-                JObject joInput = new JObject();
-                joInput.Add("data", joData);
 
-                InvokeHelper invoker = new InvokeHelper();
-                JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
-                if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
-                {
-                    bOk = false;                    
-                    Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
-                }
+                dataArray.Add(joData);
+            }
+
+            JObject joInput = new JObject();
+            joInput.Add("data", dataArray);
+            Global.pat.insuplc_admdvs = Global.inf.areaCode;
+            InvokeHelper invoker = new InvokeHelper();
+            JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
+            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
+            {
+                bOk = false;
+                Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
             }
 
             if (bOk == false)

+ 31 - 19
Forms/CenterResult.Designer.cs

@@ -36,14 +36,15 @@ namespace PTMedicalInsurance.Forms
             this.txtOutput = new System.Windows.Forms.RichTextBox();
             this.label1 = new System.Windows.Forms.Label();
             this.btnLoad = new System.Windows.Forms.Button();
+            this.btnSaveMock = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(10, 62);
+            this.label4.Location = new System.Drawing.Point(9, 52);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(98, 18);
+            this.label4.Size = new System.Drawing.Size(82, 15);
             this.label4.TabIndex = 19;
             this.label4.Text = "交易入参:";
             // 
@@ -51,19 +52,18 @@ namespace PTMedicalInsurance.Forms
             // 
             this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.txtInput.Location = new System.Drawing.Point(14, 83);
+            this.txtInput.Location = new System.Drawing.Point(12, 69);
             this.txtInput.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtInput.Name = "txtInput";
-            this.txtInput.Size = new System.Drawing.Size(1415, 290);
+            this.txtInput.Size = new System.Drawing.Size(1258, 242);
             this.txtInput.TabIndex = 18;
             this.txtInput.Text = "";
             // 
             // btnOK
             // 
-            this.btnOK.Location = new System.Drawing.Point(1066, 14);
-            this.btnOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+            this.btnOK.Location = new System.Drawing.Point(948, 12);
             this.btnOK.Name = "btnOK";
-            this.btnOK.Size = new System.Drawing.Size(136, 48);
+            this.btnOK.Size = new System.Drawing.Size(121, 40);
             this.btnOK.TabIndex = 20;
             this.btnOK.Text = "确定(&O)";
             this.btnOK.UseVisualStyleBackColor = true;
@@ -71,10 +71,9 @@ namespace PTMedicalInsurance.Forms
             // 
             // btnCancel
             // 
-            this.btnCancel.Location = new System.Drawing.Point(1254, 14);
-            this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+            this.btnCancel.Location = new System.Drawing.Point(1115, 12);
             this.btnCancel.Name = "btnCancel";
-            this.btnCancel.Size = new System.Drawing.Size(136, 48);
+            this.btnCancel.Size = new System.Drawing.Size(121, 40);
             this.btnCancel.TabIndex = 20;
             this.btnCancel.Text = "取消(&C)";
             this.btnCancel.UseVisualStyleBackColor = true;
@@ -84,37 +83,50 @@ namespace PTMedicalInsurance.Forms
             // 
             this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.txtOutput.Location = new System.Drawing.Point(14, 432);
+            this.txtOutput.Location = new System.Drawing.Point(12, 360);
             this.txtOutput.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtOutput.Name = "txtOutput";
-            this.txtOutput.Size = new System.Drawing.Size(1415, 315);
+            this.txtOutput.Size = new System.Drawing.Size(1258, 263);
             this.txtOutput.TabIndex = 18;
             this.txtOutput.Text = "";
             // 
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(10, 412);
+            this.label1.Location = new System.Drawing.Point(9, 343);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(98, 18);
+            this.label1.Size = new System.Drawing.Size(82, 15);
             this.label1.TabIndex = 19;
             this.label1.Text = "交易出参:";
             // 
             // btnLoad
             // 
-            this.btnLoad.Location = new System.Drawing.Point(1280, 391);
+            this.btnLoad.Location = new System.Drawing.Point(1138, 326);
+            this.btnLoad.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnLoad.Name = "btnLoad";
-            this.btnLoad.Size = new System.Drawing.Size(131, 36);
+            this.btnLoad.Size = new System.Drawing.Size(116, 30);
             this.btnLoad.TabIndex = 21;
             this.btnLoad.Text = "加载测试数据";
             this.btnLoad.UseVisualStyleBackColor = true;
             this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
             // 
+            // btnSaveMock
+            // 
+            this.btnSaveMock.Location = new System.Drawing.Point(953, 326);
+            this.btnSaveMock.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.btnSaveMock.Name = "btnSaveMock";
+            this.btnSaveMock.Size = new System.Drawing.Size(116, 30);
+            this.btnSaveMock.TabIndex = 21;
+            this.btnSaveMock.Text = "覆盖测试数据";
+            this.btnSaveMock.UseVisualStyleBackColor = true;
+            this.btnSaveMock.Click += new System.EventHandler(this.btnSaveMock_Click);
+            // 
             // CenterResult
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1442, 740);
+            this.ClientSize = new System.Drawing.Size(1282, 617);
+            this.Controls.Add(this.btnSaveMock);
             this.Controls.Add(this.btnLoad);
             this.Controls.Add(this.btnCancel);
             this.Controls.Add(this.btnOK);
@@ -122,7 +134,6 @@ namespace PTMedicalInsurance.Forms
             this.Controls.Add(this.label4);
             this.Controls.Add(this.txtOutput);
             this.Controls.Add(this.txtInput);
-            this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.Name = "CenterResult";
             this.Text = "CenterResult";
             this.Load += new System.EventHandler(this.CenterResult_Load);
@@ -140,5 +151,6 @@ namespace PTMedicalInsurance.Forms
         private System.Windows.Forms.RichTextBox txtOutput;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Button btnLoad;
+        private System.Windows.Forms.Button btnSaveMock;
     }
 }

+ 5 - 0
Forms/CenterResult.cs

@@ -60,5 +60,10 @@ namespace PTMedicalInsurance.Forms
         {
             btnLoad_Click(sender,e);
         }
+
+        private void btnSaveMock_Click(object sender, EventArgs e)
+        {
+            Utils.WriteMockData(false, tradeNo, txtOutput.Text);
+        }
     }
 }

+ 3 - 0
Variables/TradeEnum.cs

@@ -219,6 +219,9 @@ namespace PTMedicalInsurance
         [Trade("2206", "门诊预结算")]
         OutpatientPreSettlement,
 
+        [Trade("2206A", "门诊预结算")]
+        OutpatientPreSettlementA,
+
         /// <summary>
         /// 2207,门诊结算
         /// </summary>