|  | @@ -46,6 +46,7 @@ namespace PTMedicalInsurance.Business
 | 
	
		
			
				|  |  |                  fee["chrg_bchno"] = Global.pat.adm_Dr.ToString();
 | 
	
		
			
				|  |  |                  fee["med_type"] = Global.pat.medType;
 | 
	
		
			
				|  |  |                  fee["med_list_spc"] = fee["spec"];
 | 
	
		
			
				|  |  | +                fee["medins_list_codg"] = fee["med_list_codg"]; // 医院编码须转换为中心编码
 | 
	
		
			
				|  |  |                  dynamic expContent = new JObject();
 | 
	
		
			
				|  |  |                  JProperty exp = fee.Children<JProperty>().FirstOrDefault(p => p.Name == "expContent");
 | 
	
		
			
				|  |  |                  if (exp != null)
 | 
	
	
		
			
				|  | @@ -69,7 +70,7 @@ namespace PTMedicalInsurance.Business
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //合并参数
 | 
	
		
			
				|  |  |              dynamic joInput = new JObject();
 | 
	
		
			
				|  |  | -            joInput.Add("feedetail", jaFeeDetail);
 | 
	
		
			
				|  |  | +            //joInput.Add("feedetail", jaFeeDetail);
 | 
	
		
			
				|  |  |              joInput = mergeJson(joInput, (JObject)input["patInfo"]);
 | 
	
		
			
				|  |  |              joInput = mergeJson(joInput, (JObject)input["data"]);
 | 
	
		
			
				|  |  |              joInput = mergeJson(joInput, (JObject)input["mdtrtinfo"]);
 | 
	
	
		
			
				|  | @@ -116,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()
 | 
	
	
		
			
				|  | @@ -123,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");
 | 
	
	
		
			
				|  | @@ -217,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
 | 
	
	
		
			
				|  | @@ -301,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)
 | 
	
	
		
			
				|  | @@ -625,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);//清算类别
 | 
	
	
		
			
				|  | @@ -688,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
 | 
	
	
		
			
				|  | @@ -740,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);
 |