| 
					
				 | 
			
			
				@@ -117,6 +117,13 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MSettl.clearingWay = JsonHelper.getDestValue(joInsuAdmObj, "psnSetlway"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MSettl.settlID = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MSettl.payOrdId = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            MSettl.onlineYBFalg = JsonHelper.getDestValue(joInsuAdmObj, "onlineYBFalg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string medOrdId = JsonHelper.getDestValue(joParam, "med_org_ord"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(!string.IsNullOrEmpty(medOrdId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MSettl.medins_setl_id = medOrdId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public void setPatientByInPar() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -124,6 +131,10 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MPat.adm_Dr = int.Parse(JsonHelper.getDestValue(joParam, "admID")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Global.pat.adm_Dr = MPat.adm_Dr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MPat.name = JsonHelper.getDestValue(joInsuAdmObj, "patName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (string.IsNullOrEmpty(MPat.name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MPat.name = JsonHelper.getDestValue(joInsuAdmObj, "psn_name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            MPat.IDNO = JsonHelper.getDestValue(joInsuAdmObj, "idNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MPat.recordID = JsonHelper.getDestValue(joParam, "recordID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MPat.billID = JsonHelper.getDestValue(joParam, "billID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MPat.medType = JsonHelper.getDestValue(joInsuAdmObj, "medType"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -218,9 +229,11 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject joInput = JObject.Parse(errMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 调用his服务(移动支付院内退款服务) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject jo6203Rtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110036", joInput).ToString(), "移动支付退费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //JObject jo6203Rtn = invoker.invokeServiceAsync(JsonHelper.setIrisInpar("05110036", joInput).ToString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Global.writeLog("异步调用返回:"+JsonHelper.toJsonString(jo6203Rtn)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (JsonHelper.parseIrisRtnValue(jo6203Rtn, out errMsg) != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    outPar = errMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outPar = JsonHelper.setIrisReturnValue(-1, errMsg, null).ToString(); ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 else 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -302,11 +315,13 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PatientService patientService = new PatientService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int ret = patientService.trade1161(out outPar); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int ret = patientService.readCard(out outPar); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (ret != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MPat.ecCardNo = Global.pat.ecCardNo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MPat.ecToken = Global.pat.ecToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             catch (Exception ex) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -626,8 +641,8 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("AccountPaySumamt", MSettl.accountPaySumamt);//个人账户支出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("PersonCashPay", MSettl.personCashPay);//个人现金支出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("Balance", MSettl.balance);// 余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joSetlinfo.Add("AccountMutualAidAmount", "");//个人账户共济支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joSetlinfo.Add("OrganSettlementID", "");//医药机构结算ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joSetlinfo.Add("AccountMutualAidAmount", "0");//个人账户共济支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joSetlinfo.Add("OrganSettlementID", MSettl.medins_setl_id);//医药机构结算ID);//医药机构结算ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("ClearingOrgan", MSettl.clearingOrgan);//清算经办机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("ClearingWay", MSettl.clearingWay);//清算方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSetlinfo.Add("ClearingType", MSettl.clearingType);//清算类别 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -689,43 +704,45 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //获取医保平台结算信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (QuerySettleInfo(out errMsg) != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    outparam = errMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outparam = Error(-1, errMsg).Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject joRtn = JObject.Parse(errMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 string settlInfo = JsonHelper.getDestValue(joRtn, "result.data[0]"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (string.IsNullOrEmpty(settlInfo)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    outparam = "没有查询到结算信息,请检查参数"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outparam = Error(-1, "没有查询到结算信息,请检查参数").Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 组织调用参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Global.curEvt.msgid = Global.inf.hospitalNO + DateTime.Now.ToString("yyyyMMddHHmmssffff"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject joSettl = JObject.Parse(settlInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string tradeNo = JsonHelper.getDestValue(joSettl, "OrganSettlementID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(string.IsNullOrEmpty(tradeNo)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outparam = Error(-1,"支付交易流水号为空,请核实").Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 MPat.settlID = JsonHelper.getDestValue(joSettl, "SettlementID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //入参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joInpar.Add("outtradeno", JsonHelper.getDestValue(joSettl, "PayOrdID"));//支付订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joInpar.Add("outtradeno", tradeNo);//支付订单号(采用本地ID) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joInpar.Add("appRefdSn", Global.curEvt.msgid);//应用退款流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                string appRefdTime = JsonHelper.getDestValue(joInsuAdmObj, "appRefdTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (string.IsNullOrEmpty(appRefdTime)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    appRefdTime = Utils.GetDateTimeNow(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joInpar.Add("businessType", "DWREFUND");//应用退费时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joInpar.Add("hospitalCode", Global.inf.hospitalNO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joInpar.Add("ec_code", Global.pat.ecToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joInpar.Add("patName", Global.pat.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JObject session = Global.curEvt.jaSession?[0].ToObject<JObject>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joInpar.Add("hospitalCode", JsonHelper.getDestValue(session,"hospCode")); //hiscode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joInpar.Add("ec_code", MPat.ecToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joInpar.Add("patName", MPat.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joInpar.Add("idType", "01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joInpar.Add("idCardNo", Global.pat.IDNO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                joInpar.Add("idCardNo", MPat.IDNO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 outparam = joInpar.ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                outparam = "Get6203Inpar:" + ex.Message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                outparam = Error(-1, ex.Message).Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             finally 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -741,7 +758,7 @@ namespace PTMedicalInsurance.Business 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=  " + Global.inf.hospitalDr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                sqlStr = sqlStr + " and AdmType = 3 and Adm_Dr= " + MPat.adm_Dr + " and PayOrdID= '" + MPat.payOrdId + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sqlStr = sqlStr + " and AdmType = 3 and Adm_Dr= " + MPat.adm_Dr + " and PayOrdID= '" + MPat.settlID + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject joSqlstr = new JObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joSqlstr.Add("sqlStr", sqlStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 JObject joRtn = mIS.DynamicQuerySettlInfo(joSqlstr); 
			 |