Преглед на файлове

perf: 优化历史处方查询及自定义交易

zhengjie преди 1 година
родител
ревизия
67605dda5f
променени са 7 файла, в които са добавени 92 реда и са изтрити 41 реда
  1. 32 1
      Business/HisMainBusiness.cs
  2. 7 25
      Business/Local/OtherQueryProcess.cs
  3. 9 8
      Forms/HandleException.cs
  4. 16 2
      Forms/PrescriptionForm.Designer.cs
  5. 17 2
      Forms/PrescriptionForm.cs
  6. 10 0
      Helper/InvokeHelper.cs
  7. 1 3
      InsuBusiness.cs

+ 32 - 1
Business/HisMainBusiness.cs

@@ -1911,6 +1911,37 @@ namespace PTMedicalInsurance.Business
                 return -1;
             }
         }
+        /// <summary>
+        /// 查询历史处方
+        /// </summary>
+        /// <param name="name"></param>
+        /// <param name="certNo"></param>
+        /// <returns></returns>
+        public JArray QueryPatientPrescription(string name, string certNo)
+        {
+            dynamic input = new JObject();
+            input.psn_name = name;
+            input.certno = certNo;
+
+            JArray joOutput = new JArray();
+            string errMsg = "";
+            try
+            {
+                JObject joRtn = invoker.invokeCenterService(TradeEnum.HistoryPrescriptionQuery, input);
+                if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
+                {
+                    Global.writeLog("QueryPatientPrescription", input.ToString(), errMsg);
+                    return joOutput;
+                }
+                joOutput = JArray.Parse(joRtn["mdtrtinfo"].Text());
+            }
+            catch (Exception ex)
+            {
+                Global.writeLog("QueryPatientPrescription", input.ToString(), ex.Message);
+            }
+
+            return joOutput;
+        }
 
         /// <summary>
         /// 事中分析
@@ -1964,7 +1995,7 @@ namespace PTMedicalInsurance.Business
                         Global.pat.insuType = JsonHelper.getDestValue(joInparam, "insuAdmObj.insutype");
                         break;
                     }
-                case "HistoryPrescription":
+                case "HistoryPrescriptionQuery":
                     pat.certNO = JsonHelper.getDestValue(joInparam, "insuAdmObj.certno");
                     pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
                     break;

+ 7 - 25
Business/Local/OtherQueryProcess.cs

@@ -40,33 +40,15 @@ namespace PTMedicalInsurance.Business
 
         private void QueryPatientPrescription()
         {
-            dynamic input = new JObject();
-            input.psn_name = Global.pat.name;
-            input.certno = Global.pat.certNO ;
-
-            string errMsg = "";
-            try
-            {
-                JObject joRtn = invoker.invokeCenterService(trade, input);
-                if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
-                {
-                    Global.writeLog("QueryPatientPrescription", input.ToString(), errMsg);
-                    return;
-                }
-
-                JArray list = JArray.Parse(joRtn["mdtrtinfo"].Text());
-                if (list?.Count > 0)
-                {
-                    PrescriptionForm form = new PrescriptionForm();
-                    form.initList(list);
-                    form.ShowDialog();
-                }
-            }
-            catch (Exception ex)
+            JArray list = hBus.QueryPatientPrescription(Global.pat.name, Global.pat.certNO);
+            PrescriptionForm form = new PrescriptionForm();
+            if (list?.Count > 0)
             {
-                Global.writeLog("QueryPatientPrescription",input.ToString(),ex.Message);
+                form.initList(list);
             }
-
+            form.ShowDialog();
         }
+
+        
     }
 }

+ 9 - 8
Forms/HandleException.cs

@@ -296,14 +296,15 @@ namespace PTMedicalInsurance.Forms
             string errorMsg = "";
             JObject joRtn = new JObject();
             Global.pat.insuplc_admdvs = tbCBD_Hand.Text;
-            //if (Chk_DealNo.Checked)
-            //{
-            //    joRtn = invoker.invokeCenterService(tb_DealNo.Text, JsonHelper.setCenterInpar(tb_DealNo.Text, rtbInparam.Text));
-            //}
-            //else
-            //{
-            joRtn = invoker.invokeCenterService(TradeEnum.ReverseTransaction, JObject.Parse(rtbInparam.Text));
-            //}
+            if (Chk_DealNo.Checked)
+            {
+                //自定义交易
+                joRtn = invoker.invokeCenterService(JsonHelper.setCenterInpar(tb_DealNo.Text, JObject.Parse(rtbInparam.Text)));
+            }
+            else
+            {
+                joRtn = invoker.invokeCenterService(TradeEnum.ReverseTransaction, JObject.Parse(rtbInparam.Text));
+            }
             if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
             {
                 MessageBox.Show("调用失败:" + errorMsg);

+ 16 - 2
Forms/PrescriptionForm.Designer.cs

@@ -40,6 +40,7 @@ namespace PTMedicalInsurance.Forms
             this.uiLabel1 = new Sunny.UI.UILabel();
             this.dgvHistory = new Sunny.UI.UIDataGridView();
             this.uiPanel1 = new Sunny.UI.UIPanel();
+            this.btnQuery = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.dgvHistory)).BeginInit();
             this.uiPanel1.SuspendLayout();
             this.SuspendLayout();
@@ -48,7 +49,7 @@ namespace PTMedicalInsurance.Forms
             // 
             this.txtNo.Cursor = System.Windows.Forms.Cursors.IBeam;
             this.txtNo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtNo.Location = new System.Drawing.Point(731, 30);
+            this.txtNo.Location = new System.Drawing.Point(703, 29);
             this.txtNo.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.txtNo.MinimumSize = new System.Drawing.Size(1, 16);
             this.txtNo.Name = "txtNo";
@@ -75,7 +76,7 @@ namespace PTMedicalInsurance.Forms
             // uiLabel2
             // 
             this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.uiLabel2.Location = new System.Drawing.Point(579, 30);
+            this.uiLabel2.Location = new System.Drawing.Point(551, 29);
             this.uiLabel2.Name = "uiLabel2";
             this.uiLabel2.Size = new System.Drawing.Size(130, 33);
             this.uiLabel2.TabIndex = 15;
@@ -148,6 +149,7 @@ namespace PTMedicalInsurance.Forms
             // 
             // uiPanel1
             // 
+            this.uiPanel1.Controls.Add(this.btnQuery);
             this.uiPanel1.Controls.Add(this.txtName);
             this.uiPanel1.Controls.Add(this.uiLabel1);
             this.uiPanel1.Controls.Add(this.txtNo);
@@ -160,9 +162,20 @@ namespace PTMedicalInsurance.Forms
             this.uiPanel1.Name = "uiPanel1";
             this.uiPanel1.Size = new System.Drawing.Size(1186, 98);
             this.uiPanel1.TabIndex = 19;
+            this.uiPanel1.Text = null;
             this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
             this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
             // 
+            // btnQuery
+            // 
+            this.btnQuery.Location = new System.Drawing.Point(1055, 24);
+            this.btnQuery.Name = "btnQuery";
+            this.btnQuery.Size = new System.Drawing.Size(119, 44);
+            this.btnQuery.TabIndex = 18;
+            this.btnQuery.Text = "查询(&S)";
+            this.btnQuery.UseVisualStyleBackColor = true;
+            this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
+            // 
             // PrescriptionForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
@@ -187,5 +200,6 @@ namespace PTMedicalInsurance.Forms
         private Sunny.UI.UILabel uiLabel1;
         private Sunny.UI.UIDataGridView dgvHistory;
         private Sunny.UI.UIPanel uiPanel1;
+        private System.Windows.Forms.Button btnQuery;
     }
 }

+ 17 - 2
Forms/PrescriptionForm.cs

@@ -1,4 +1,5 @@
 using Newtonsoft.Json.Linq;
+using PTMedicalInsurance.Business;
 using PTMedicalInsurance.FormSetter;
 using PTMedicalInsurance.Variables;
 using System;
@@ -16,10 +17,13 @@ namespace PTMedicalInsurance.Forms
     public partial class PrescriptionForm : Form
     {
         private GridViewSetter grdSetter = new GridViewSetter();
-
+        HisMainBusiness hBus = new HisMainBusiness();
         public PrescriptionForm()
         {
             InitializeComponent();
+
+            grdSetter.SetHeaderTextOfHistoryPrescription(dgvHistory);
+
         }
 
         private void PrescriptionForm_Load(object sender, EventArgs e)
@@ -32,7 +36,18 @@ namespace PTMedicalInsurance.Forms
         {
             DataTable dtData = (DataTable)joData.ToObject(typeof(DataTable));
             dgvHistory.DataSource = dtData;
-            grdSetter.SetHeaderTextOfHistoryPrescription(dgvHistory);
+        }
+
+        private void btnQuery_Click(object sender, EventArgs e)
+        {
+            JArray list = hBus.QueryPatientPrescription(txtName.Text.Trim(), txtNo.Text.Trim());
+            if (list?.Count > 0)
+            {
+                initList(list);
+            }
+            else {
+                MessageBox.Show("没有查询到任何记录!");
+            }
         }
     }
 

+ 10 - 0
Helper/InvokeHelper.cs

@@ -289,6 +289,16 @@ namespace PTMedicalInsurance.Helper
             return joRtn;
         }
 
+        /// <summary>
+        /// 预留自定义交易
+        /// </summary>
+        /// <param name="funNo"></param>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public JObject invokeCenterService(string data) {
+            Global.curEvt.URL = Global.inf.centerURL;
+            return invokeCenterService(data,ModeEnum.REST);
+        }
         /// <summary>
         /// 医保目录txt文件下载
         /// </summary>

+ 1 - 3
InsuBusiness.cs

@@ -635,9 +635,7 @@ namespace PTMedicalInsurance
                         }
                     case "HistoryPrescriptionQuery":
                         // 历史处方查询
-                        string funNo = JsonHelper.getDestValue(joInParam, "funNO");
-                        TradeEnum trade = TradeEnum.DEFAULT.GetByCode(funNo);
-                        new OtherQueryProcess(trade).Process(JObject.Parse(InParam));
+                        new OtherQueryProcess(TradeEnum.HistoryPrescriptionQuery).Process(JObject.Parse(InParam));
                         break;
                     default:
                         {