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

perf: 移动支付支持多平台

zhengjie 1 éve
szülő
commit
a0b874cda7

+ 17 - 0
Business/MobilePay.cs

@@ -38,6 +38,7 @@ namespace PTMedicalInsurance.Business
                 joInsuAdmObj = JObject.Parse(JsonHelper.getDestValue(joInpar, "insuAdmObj"));
                 setPatientByInPar();
                 setSettlementsByInPar();
+                initAppConfig();
             }
             catch (Exception ex)
             {
@@ -46,6 +47,22 @@ namespace PTMedicalInsurance.Business
 
         }
 
+        /// <summary>
+        /// 根据调用的平台初始化应用配置(alipay:支付宝,wxpay:微信)
+        /// </summary>
+        private void initAppConfig()
+        {
+            string platform = JsonHelper.getDestValue(joInsuAdmObj, "platform");
+            if (string.IsNullOrEmpty(platform)) platform = "wxpay";
+
+            // TODO:应从数据库中获取配置
+            IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini");
+            Global.inf.appId = ini.ReadValue(platform, "id");
+            Global.inf.secretKey = ini.ReadValue(platform, "key");
+            Global.inf.privateKey = ini.ReadValue(platform, "private");
+            Global.inf.publicKey = ini.ReadValue(platform, "public");
+        }
+
         private JObject OutpatientReg()
         {
             string diagnoses;

+ 12 - 49
Forms/InpatientRegistration.cs

@@ -25,50 +25,22 @@ namespace PTMedicalInsurance.Forms
 
             this.StartPosition = FormStartPosition.CenterParent;
             Global.pat.medType = string.IsNullOrEmpty(Global.pat.medType) ? "21": Global.pat.medType;  //默认医疗
-            if (Global.pat.RYorCY == "2")
-            {
-                string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
-
-                string sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  "
-                              + " WHERE B.Code='" + Global.pat.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
-
-                sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
-                //// 如果登记选择了,则直接用登记的病种
-                //if(!string.IsNullOrEmpty(Global.pat.DiseasecCode))
-                //{
-                //    sqlStr += " and A.Code='" + Global.pat.DiseasecCode + "' ";
-                //}
-                SetDBLKCombox(ref dblkcbxDisease, sqlStr);
-
-                sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr"
-                       + " WHERE B.Code='" + Global.pat.medType + "' and A.InsuCode = 'med_type'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
-
-                sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'psn_setlway'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
-
-                sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'dscg_way'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxExitway, sqlStr);
-            }
-            else
-            {
-                string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
-                string sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'insutype'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
+            string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
+           
+            string sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'insutype'" + sqlCondition;
+            SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
 
-                sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxDisease, sqlStr);
+            sqlStr = "SELECT A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
+            SetDBLKCombox(ref dblkcbxDisease, sqlStr);
 
-                sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'psn_setlway'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
+            sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'psn_setlway'" + sqlCondition;
+            SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
 
-                sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'med_type'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
+            sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr  WHERE A.InsuCode = 'med_type'" + sqlCondition;
+            SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
 
-                sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'dscg_way'" + sqlCondition;
-                SetDBLKCombox(ref dblkcbxExitway, sqlStr);
-            }
+            sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'dscg_way'" + sqlCondition;
+            SetDBLKCombox(ref dblkcbxExitway, sqlStr);
             
             cbxAccountPay.Checked = false;
         }
@@ -228,21 +200,12 @@ namespace PTMedicalInsurance.Forms
                 dangerFlag = "1";
             }
 
-            //单病种时必须选择病种
-            if (string.IsNullOrEmpty(this.diseCodg) && "0201".Equals(psn_setlway))
-            {
-                MessageBox.Show("单病种时必须选择病种");
-                return;
-            }
-
             // 是否使用个人账户金额
             if (cbxAccountPay.Checked)
             {
                 personAccountUsedFlag = "1";
             }
 
-            this.local_dise_code = txtLocateCode.Text.Trim();
-
             this.DialogResult = DialogResult.OK;
         }
 

+ 8 - 39
Forms/InpatientRegistration.designer.cs

@@ -30,7 +30,7 @@ namespace PTMedicalInsurance.Forms
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             this.pnlHeader = new System.Windows.Forms.Panel();
             this.grpHeader = new Sunny.UI.UIGroupBox();
             this.txtBirthDay = new Sunny.UI.UITextBox();
@@ -74,14 +74,12 @@ namespace PTMedicalInsurance.Forms
             this.diag_time = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pnlBottom = new System.Windows.Forms.Panel();
             this.pnlCenter = new System.Windows.Forms.Panel();
-            this.txtLocateCode = new Sunny.UI.UITextBox();
             this.chkEmergency = new Sunny.UI.UICheckBox();
             this.cbxAccountPay = new Sunny.UI.UICheckBox();
             this.Chk_RelTtpFlag = new Sunny.UI.UICheckBox();
             this.chkDanger = new Sunny.UI.UICheckBox();
             this.Chk_TraumaFlag = new Sunny.UI.UICheckBox();
             this.dblkcbxExitway = new PTControl.DBLookupCombox();
-            this.label5 = new System.Windows.Forms.Label();
             this.label8 = new System.Windows.Forms.Label();
             this.dblkcbxSettelmentWay = new PTControl.DBLookupCombox();
             this.dblkcbxDisease = new PTControl.DBLookupCombox();
@@ -516,13 +514,13 @@ namespace PTMedicalInsurance.Forms
             // 
             this.dgvDiagnose.AllowUserToAddRows = false;
             this.dgvDiagnose.BorderStyle = System.Windows.Forms.BorderStyle.None;
-            dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.ButtonShadow;
-            dataGridViewCellStyle8.Font = new System.Drawing.Font("新宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.dgvDiagnose.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
+            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ButtonShadow;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("新宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.dgvDiagnose.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
             this.dgvDiagnose.ColumnHeadersHeight = 40;
             this.dgvDiagnose.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
             this.dgvDiagnose.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -647,14 +645,12 @@ namespace PTMedicalInsurance.Forms
             // pnlCenter
             // 
             this.pnlCenter.BackColor = System.Drawing.SystemColors.Window;
-            this.pnlCenter.Controls.Add(this.txtLocateCode);
             this.pnlCenter.Controls.Add(this.chkEmergency);
             this.pnlCenter.Controls.Add(this.cbxAccountPay);
             this.pnlCenter.Controls.Add(this.Chk_RelTtpFlag);
             this.pnlCenter.Controls.Add(this.chkDanger);
             this.pnlCenter.Controls.Add(this.Chk_TraumaFlag);
             this.pnlCenter.Controls.Add(this.dblkcbxExitway);
-            this.pnlCenter.Controls.Add(this.label5);
             this.pnlCenter.Controls.Add(this.label8);
             this.pnlCenter.Controls.Add(this.dblkcbxSettelmentWay);
             this.pnlCenter.Controls.Add(this.dblkcbxDisease);
@@ -670,20 +666,6 @@ namespace PTMedicalInsurance.Forms
             this.pnlCenter.Size = new System.Drawing.Size(1267, 165);
             this.pnlCenter.TabIndex = 12;
             // 
-            // txtLocateCode
-            // 
-            this.txtLocateCode.Cursor = System.Windows.Forms.Cursors.IBeam;
-            this.txtLocateCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtLocateCode.Location = new System.Drawing.Point(588, 117);
-            this.txtLocateCode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
-            this.txtLocateCode.MinimumSize = new System.Drawing.Size(1, 16);
-            this.txtLocateCode.Name = "txtLocateCode";
-            this.txtLocateCode.ShowText = false;
-            this.txtLocateCode.Size = new System.Drawing.Size(257, 29);
-            this.txtLocateCode.TabIndex = 68;
-            this.txtLocateCode.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
-            this.txtLocateCode.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
-            // 
             // chkEmergency
             // 
             this.chkEmergency.Cursor = System.Windows.Forms.Cursors.Hand;
@@ -769,17 +751,6 @@ namespace PTMedicalInsurance.Forms
             this.dblkcbxExitway.Value = "";
             this.dblkcbxExitway.AfterSelector += new PTControl.AfterSelectorEventHandler(this.dblkcbxHospType_AfterSelector);
             // 
-            // label5
-            // 
-            this.label5.AutoSize = true;
-            this.label5.ForeColor = System.Drawing.SystemColors.InfoText;
-            this.label5.Location = new System.Drawing.Point(492, 124);
-            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(89, 19);
-            this.label5.TabIndex = 61;
-            this.label5.Text = "本地编码";
-            // 
             // label8
             // 
             this.label8.AutoSize = true;
@@ -991,14 +962,12 @@ namespace PTMedicalInsurance.Forms
         private Sunny.UI.UIGroupBox grpHeader;
         private Sunny.UI.UILabel uiLabel21;
         private System.Windows.Forms.Panel pnlCenter;
-        private Sunny.UI.UITextBox txtLocateCode;
         public Sunny.UI.UICheckBox chkEmergency;
         public Sunny.UI.UICheckBox cbxAccountPay;
         public Sunny.UI.UICheckBox Chk_RelTtpFlag;
         public Sunny.UI.UICheckBox chkDanger;
         public Sunny.UI.UICheckBox Chk_TraumaFlag;
         public PTControl.DBLookupCombox dblkcbxExitway;
-        private System.Windows.Forms.Label label5;
         private System.Windows.Forms.Label label8;
         public PTControl.DBLookupCombox dblkcbxSettelmentWay;
         public PTControl.DBLookupCombox dblkcbxDisease;

+ 10 - 37
Helper/EncryptHelper.cs

@@ -19,34 +19,22 @@ namespace PTMedicalInsurance.Helper
         //private static string appId = "1G566663I0023F60C80A00000A8F1C36";
 
         //测试
+        private string appId = "1H1INA1L30OG3F60C80A0000DEE43558";    //渠道ID
         private string appSecret = "1H1INA1L90OH3F60C80A00008119D616";   //appSecret 数字密钥sm4
         private string privateKey = "APCIAgJqh3+AcK/IXL1WJD130i2q+6UblRxQzus3+sVw";     //渠道私密
-        private string appId = "1H1INA1L30OG3F60C80A0000DEE43558";    //渠道ID
         private string publicKey = "BDMsMM2HPRkaKSl2ynBbCRtJodP8Nh4G5IkEnV+7YHaCplkAZbPMsUlvJpWqQ+Q4sT7611xGSZ1/mPsqgqJ49zs=";            //平台公钥
 
-        //正式
-        //private string ak = "1H62Q1KH205K76430B0A0000BF149773";
-        //private string sk = "YbNObZNMdUgwgLUEyK4ixNSkaCF9OPtCdDth9APWYKU=";
-        //private string appid = "1H62Q1KGP05J76430B0A00007144E257";
-
         public EncryptHelper()
         {
+            // 如果有配置信息
+            if (!string.IsNullOrEmpty(Global.inf.appId)) {
+                this.appId = Global.inf.appId;
+                this.appSecret = Global.inf.secretKey;
+                this.privateKey = Global.inf.privateKey;
+                this.publicKey = Global.inf.publicKey;
+            }
 
-        }
-
-        public EncryptHelper(string appId, string appSecret, string publicKey, string privateKey)
-        {
-            this.appId = appId;
-            this.appSecret = appSecret;
-            this.publicKey = publicKey;
-            this.privateKey = privateKey;
-        }
-
-        public string getSignText(string data)
-        {
-            return "";
-            //string ts = DateTime.Now.ToString("yyyyMMddHHmmss");
-            //return SignUtils.getSignText(appid, ak, data,StringUtils.CurrentTimeStamp());
+            Global.writeLog("ak:" + appSecret + ";sk:" + privateKey + ";appid:" + appId);
         }
         public string encrypt(string data, ref string signText)
         {
@@ -63,10 +51,7 @@ namespace PTMedicalInsurance.Helper
                 encryptData = ex.Message;
                 return encryptData;
             }
-            finally
-            {
-                //Global.writeLog("ak:" + appSecret + ";sk:" + privateKey + ";appid:" + appId, data, encryptData);
-            }
+            
         }
 
         public string sign(string data)
@@ -82,10 +67,6 @@ namespace PTMedicalInsurance.Helper
                 encryptData = ex.Message;
                 return encryptData;
             }
-            finally
-            {
-                Global.writeLog("ak:" + appSecret + ";sk:" + privateKey + ";appid:" + appId, data, encryptData);
-            }
         }
 
         public bool verify(JObject signDto, string signData)
@@ -100,10 +81,6 @@ namespace PTMedicalInsurance.Helper
                 error = ex.Message;
                 return false;
             }
-            finally
-            {
-                Global.writeLog("ak:" + appSecret + ";sk:" + privateKey + ";appid:" + appId, signDto.ToString() + ";" + signData, error);
-            }
         }
 
         public string decrypt(string encryptData)
@@ -119,10 +96,6 @@ namespace PTMedicalInsurance.Helper
                 data = ex.Message;
                 return data;
             }
-            finally
-            {
-                Global.writeLog("ak:" + appSecret + ";sk:" + privateKey + ";appid:" + appId, encryptData, data);
-            }
         }
     }
 }

+ 2 - 0
Variables/Struct.cs

@@ -49,10 +49,12 @@ namespace PTMedicalInsurance.Variables
         public string version;
         public string signatureType;
         public string recivedSystem;
+        // 三方对接
         public string appId;
         public string privateKey;
         public string secretKey;
         public string publicKey;
+        // AccessKey
         public string AK;
         public string SK;
         public string dev_no;