Browse Source

Merge branch 'medicare' of liubing/wlyy2.0 into medicare

liubing 2 years ago
parent
commit
5d8952f74e

+ 13 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicalRechargeDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.hospital.healthCare;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRecharge;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2022/7/18.
 */
public interface YlzMedicalRechargeDao extends PagingAndSortingRepository<YlzMedicalRecharge, String>,
        JpaSpecificationExecutor<YlzMedicalRecharge> {
    YlzMedicalRecharge findByOutChargeNo(String outChargeNo);
}

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicalResponseDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.hospital.healthCare;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalResponse;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2022/7/18.
 */
public interface YlzMedicalResponseDao extends PagingAndSortingRepository<YlzMedicalResponse, String>, JpaSpecificationExecutor<YlzMedicalResponse> {
    YlzMedicalResponse findByMedicalId(String medicalId);
}

+ 16 - 0
common/common-entity/sql记录

@ -1642,3 +1642,19 @@ ALTER table base_ylz_medical_mx add column hosp_appr_flag VARCHAR(3) default nul
ALTER table base_ylz_medical_mx add column rxno VARCHAR(30) default null COMMENT'单据号(对应基线接口:rxno)';
ALTER table base_ylz_medical_mx add column charge_unit_name VARCHAR(30) default null COMMENT'医保项目单位名称【对应基线接口:prcunt】';
-- 2022-07-15
ALTER table base_ylz_medical_relation add column card_sn VARCHAR(50) default null COMMENT'卡识别码';
CREATE TABLE `base_ylz_medical_response` (
  `id` varchar(50) NOT NULL,
  `medical_id` varchar(50) DEFAULT NULL COMMENT '设备id,关联t_mediicine_device表',
  `value` longtext COMMENT '医保结算返回值',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='医保确认结算返回值';
CREATE TABLE `base_ylz_medical_recharge` (
  `id` varchar(50) NOT NULL,
  `out_charge_no` varchar(50) DEFAULT NULL COMMENT '流水号',
  `value` varchar(2000) DEFAULT NULL COMMENT '关联处方号',
  `charge_result` varchar(50) DEFAULT NULL COMMENT '预交金交易结果',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='医保预交金充值关联表';

+ 41 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRecharge.java

@ -0,0 +1,41 @@
package com.yihu.jw.entity.hospital.healthCare;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2022/7/18.
 */
@Entity
@Table(name = "base_ylz_medical_response")
public class YlzMedicalRecharge extends UuidIdentityEntity {
    private String outChargeNo;
    private String value;
    private String chargeResult;
    public String getOutChargeNo() {
        return outChargeNo;
    }
    public void setOutChargeNo(String outChargeNo) {
        this.outChargeNo = outChargeNo;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getChargeResult() {
        return chargeResult;
    }
    public void setChargeResult(String chargeResult) {
        this.chargeResult = chargeResult;
    }
}

+ 10 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java

@ -89,7 +89,7 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private Integer medicalState;//0自费1医保
    private String hisDesc;//his结算描述
    private String balance;//预交金余额
    private String medicalPrice;//医保基金总额
    private String medicalPrice;//医保基金支付总额
    private Date settleDate;//his结算时间
    //自助机字段
@ -100,6 +100,7 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private String visitMsgid; //挂号发送方报文ID【挂号】
    private String psnNo; //人员编码 医保
    private String applyTime; //开单时间
    private String cardSn; //卡识别码 医保
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="settle_date")
@ -794,4 +795,12 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    public void setApplyTime(String applyTime) {
        this.applyTime = applyTime;
    }
    public String getCardSn() {
        return cardSn;
    }
    public void setCardSn(String cardSn) {
        this.cardSn = cardSn;
    }
}

+ 32 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalResponse.java

@ -0,0 +1,32 @@
package com.yihu.jw.entity.hospital.healthCare;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2022/7/18.
 */
@Entity
@Table(name = "base_ylz_medical_response")
public class YlzMedicalResponse  extends UuidIdentityEntity {
    private String medicalId;
    private String value;
    public String getMedicalId() {
        return medicalId;
    }
    public void setMedicalId(String medicalId) {
        this.medicalId = medicalId;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}

+ 61 - 27
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineOrderDrugsEndpoint.java

@ -107,45 +107,79 @@ public class MedicineOrderDrugsEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/open/executeSickSettleMultiNew")
    @ApiOperation(value = "续方确认结算-智业", notes = "续方确认结算-智业")
    public Envelop getSettlementInfo(
            @ApiParam(name = "recipe_no", value = "处方号")
            @RequestParam(value = "recipe_no", required = true) String recipe_no){
        try {
            return success("操作成功", medOrderService.executeSickSettleMultiNew(recipe_no));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
//    @GetMapping("/open/executeSickSettleMultiNew")
//    @ApiOperation(value = "续方确认结算-智业", notes = "续方确认结算-智业")
//    public Envelop getSettlementInfo(
//            @ApiParam(name = "recipe_no", value = "处方号")
//            @RequestParam(value = "recipe_no", required = true) String recipe_no){
//        try {
//            return success("结算成功", medOrderService.executeSickSettleMultiNew(recipe_no));
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Envelop.getError(e.getMessage());
//        }
//    }
    @GetMapping("/open/hlwyyRecharge")
    @ApiOperation(value = "预缴金充值", notes = "预缴金充值")
    public Envelop hlwyyRecharge(
                @ApiParam(name="orgCode",value="机构code",defaultValue = "")
                @RequestParam(value = "orgCode",required = false) String orgCode,
                @ApiParam(name = "recipe_no", value = "处方号,多笔结算逗号隔开")
                @RequestParam(value = "recipe_no", required = true) String recipe_no,
                @ApiParam(name="equ_num",value="药柜设备号",defaultValue = "")
                @RequestParam(value = "equ_num",required = false) String equ_num,
                @ApiParam(name="ssc",value="社保卡",defaultValue = "")
                @RequestParam(value = "ssc",required = false) String ssc,
                @ApiParam(name="depositType",value="支付方式ALI_QR 支付宝二维码支付;WX_QR微信二维码",defaultValue = "")
                @RequestParam(value = "depositType",required = false) String depositType,
                @ApiParam(name="amount",value="金额 单位元 2位小数",defaultValue = "")
                @RequestParam(value = "amount",required = false) String amount,
                @ApiParam(name="hisCustId",value="患者his系统编号 可传身份证",defaultValue = "")
                @RequestParam(value = "hisCustId",required = false) String hisCustId,
                @ApiParam(name="userName",value="患者名字",defaultValue = "")
                @RequestParam(value = "userName",required = false) String userName,
                @ApiParam(name="returnUrl",value="支付成功后中转地址",defaultValue = "")
                @RequestParam(value = "returnUrl",required = false) String returnUrl
           ){
        try {
            return success("操作成功", ylzService.hlwyyRecharge(orgCode,equ_num,ssc,depositType,amount,
                    hisCustId,userName,returnUrl));
            return success("操作成功", medOrderService.hlwyyRecharge(recipe_no,equ_num,depositType,returnUrl));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/open/patient/hlwyyRecharge")
    @ApiOperation(value = "居民自助充值-预缴金", notes = "预缴金充值")
    public Envelop patientHlwyyRecharge(
            @ApiParam(name="orgCode",value="机构code",defaultValue = "")
            @RequestParam(value = "orgCode",required = false) String orgCode,
            @ApiParam(name="equ_num",value="药柜设备号",defaultValue = "")
            @RequestParam(value = "equ_num",required = false) String equ_num,
            @ApiParam(name="ssc",value="社保卡",defaultValue = "")
            @RequestParam(value = "ssc",required = false) String ssc,
            @ApiParam(name="depositType",value="支付方式ALI_QR 支付宝二维码支付;WX_QR微信二维码",defaultValue = "")
            @RequestParam(value = "depositType",required = false) String depositType,
            @ApiParam(name="amount",value="金额 单位元 2位小数",defaultValue = "")
            @RequestParam(value = "amount",required = false) String amount,
            @ApiParam(name="hisCustId",value="患者his系统编号 可传身份证",defaultValue = "")
            @RequestParam(value = "hisCustId",required = false) String hisCustId,
            @ApiParam(name="userName",value="患者名字",defaultValue = "")
            @RequestParam(value = "userName",required = false) String userName,
            @ApiParam(name="returnUrl",value="支付成功后中转地址",defaultValue = "")
            @RequestParam(value = "returnUrl",required = false) String returnUrl
    ){
        try {
            return success("操作成功", medOrderService.patientHlwyyRecharge(orgCode,equ_num,ssc,
                    depositType,amount,hisCustId,userName,returnUrl));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/open/patient/hlwyyRechargeTest")
    @ApiOperation(value = "居民自助充值-预缴金", notes = "预缴金充值")
    public Envelop patientHlwyyRecharge(
    ){
        try {
            return success("操作成功", medOrderService.patientHlwyyRecharge("3502060300","14912202107000001500000000000000","DD2781527",
                    "WX_QR","10.5","350524199405230613","王志南",null));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
@ -155,7 +189,7 @@ public class MedicineOrderDrugsEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/open/hlwyyQueryDetail")
    @ApiOperation(value = "预缴金充值结果查询", notes = "预缴金充值结果查询")
    public Envelop hlwyyQueryDetail(
                @ApiParam(name="orgCode",value="发药人编码",defaultValue = "")
                @ApiParam(name="orgCode",value="机构",defaultValue = "")
                @RequestParam(value = "orgCode",required = true) String orgCode,
                @ApiParam(name="equ_num",value="药柜设备号",defaultValue = "")
                @RequestParam(value = "equ_num",required = true) String equ_num,
@ -175,7 +209,7 @@ public class MedicineOrderDrugsEndpoint extends EnvelopRestEndpoint {
    @RequestMapping(value = "/open/hlwyyRechargeNotify", method = RequestMethod.POST)
    @ApiOperation(value = "智能药柜预缴金充值回调数据接收")
    public void receiveRecipeNotify2(String responsStr) throws Exception {
    public void hlwyyRechargeNotify(String responsStr) throws Exception {
        try {
            ylzService.hlwyyRechargeNotify(responsStr);
        } catch (Exception e) {

+ 194 - 118
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/JwService.java

@ -1,15 +1,18 @@
package com.yihu.jw.base.service.a3service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalResponse;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.healthCare.YlzMedicalResponseDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
@ -17,7 +20,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@ -42,6 +47,10 @@ public class JwService {
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Value("${spring.profiles}")
    private String springProfiles;
    @Autowired
    private YlzMedicalResponseDao ylzMedicalResponseDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取智业待结算数据接口--自助机
@ -84,7 +93,7 @@ public class JwService {
        param.put("msgBody",msgBody.toJSONString());
        JSONObject re = null;
        if ("jwtest".equals(springProfiles)){
            re = JSONObject.parseObject("{\"msg\":\"success\",\"data\":{\"CODE\":\"1\",\"returnData\":[{\"result\":\"1\"}],\"byRefParaData\":[{\"dispBalance\":\"100\"}]},\"status\":200}\n");
            re = JSONObject.parseObject("{\"msg\":\"success\",\"data\":{\"CODE\":\"1\",\"returnData\":[{\"result\":\"1\"}],\"byRefParaData\":[{\"dispBalance\":\"5.5\"}]},\"status\":200}\n");
        }else {
            re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
        }
@ -104,147 +113,197 @@ public class JwService {
     * @param
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject executeSickSettleMultiNew(String recipe_no) throws Exception {
    @Transactional(propagation= Propagation.NOT_SUPPORTED)
    public boolean executeSickSettleMultiNew(String recipe_no) throws Exception {
        String   sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='his_settlement' ";
        List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
        String AnalogFlag = "0";
        if (AnalogFlags.size()>0){
            AnalogFlag = AnalogFlags.get(0).get("dict_code").toString();
        }
        if ("1".equals(AnalogFlag)) {//获取调式模拟数据
            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
            if(null==ylzMedicalRelationDO){
               return true;
            }
            ylzMedicalRelationDO.setState(1);
            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            return true;
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
        if (null==recipe_no){
            throw new Exception("无结算信息");
           return true;
        }
        if (ylzMedicalRelationDO.getState()==1){
            throw new Exception("订单已结算,无法重复结算");
            return true;
        }
        List<YlzMedicalMxDO> ylzMedicalMxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
        List<YlzMedicalIcdDO> ylzMedicalIcdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
        JSONObject msgBody = new JSONObject();
        JSONArray insurVisitInfo = new JSONArray();
        JSONArray insurResult = new JSONArray(); //医保结算信息 自费病人没有产生医保收费记录,insurResult节点不传自费结算信息
        JSONArray insurResult = new JSONArray(); //自费病人没有产生医保收费记录,insurResult节点不传自费结算信息
        msgBody.put("cardNo",ylzMedicalRelationDO.getCardNo());//病人卡号
        msgBody.put("settleDept",ylzMedicalRelationDO.getDeptCode());//结算科室编码
        msgBody.put("settleOperator",ylzMedicalRelationDO.getCollector());//结算人员编码
        msgBody.put("visitNo","");//结算人员编码
        if (0==ylzMedicalRelationDO.getMedicalState()){//自费
            msgBody.put("insurResult",insurResult);//todo
            msgBody.put("insurResult",insurResult);
        }else if (1==ylzMedicalRelationDO.getMedicalState()){//医保
            for (YlzMedicalMxDO medicalMxDO:ylzMedicalMxDOList){
                JSONObject insurResultTmp = new JSONObject();
                insurResultTmp.put("visitNo",ylzMedicalRelationDO.getRelationCode()); //院内挂号号
                insurResultTmp.put("insurSettleSort",medicalMxDO.getInsurSettleSort()); //医保结算序号
                insurResultTmp.put("setl_msgid",medicalMxDO.getSetlMsgid()); //发送方报文ID
                insurResultTmp.put("fee_msgid",medicalMxDO.getFeeMsgid()); //费用上传发送方报文ID
                insurResultTmp.put("dise_msgid",""); //就诊信息上传发送方报文ID todo
                insurResultTmp.put("chrg_bchno",medicalMxDO.getChrgBchno());   //收费批次号
                insurResultTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode()); //参保地医保区划【窗口冲销有用】
                insurResultTmp.put("card_sn",""); //卡识别码 todo
                insurResultTmp.put("mdtrt_cert_no",ylzMedicalRelationDO.getCardNo()); //就诊凭证编号
                insurResultTmp.put("fm_acct_balc",""); //家庭共济账户余额 todo
                insurResultTmp.put("hl_acct_balc",""); //健康账户余额 todo
                insurResultTmp.put("cvl_acct_balc",""); //公务员账户余额 todo
                insurResultTmp.put("acct_used_flag","1"); //个人账户使用标志【窗口目前默认固定1,后续可开放前端选择传入】
                insurResultTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial()); //就诊 ID
                insurResultTmp.put("setl_id",""); //结算ID   todo
                insurResultTmp.put("psn_no","1"); //人员编号   医保人员基本信息获取接口返回
                insurResultTmp.put("psn_name",ylzMedicalRelationDO.getName()); //人员姓名
                insurResultTmp.put("psn_cert_type",""); //人员证件类型 todo
                insurResultTmp.put("certno",""); //证件号码 todo
                insurResultTmp.put("gend",""); //性别 todo
                insurResultTmp.put("naty",""); //民族 todo
                insurResultTmp.put("brdy",""); //出生日期 todo
                insurResultTmp.put("age",""); //年龄 todo
                insurResultTmp.put("insutype","310"); //险种类型
                insurResultTmp.put("psn_type","11"); //人员类别"
                insurResultTmp.put("cvlserv_flag","0"); //公务员标志
                insurResultTmp.put("setl_time", DateUtil.getStringDateShort());    //结算时间
                insurResultTmp.put("mdtrt_cert_type","03");  //就诊凭证类型
                insurResultTmp.put("med_type",ylzMedicalRelationDO.getMedType()); //医疗类别
                insurResultTmp.put("medfee_sumamt","");  //医疗费总额 todo
                insurResultTmp.put("fulamt_ownpay_amt",ylzMedicalRelationDO.getOwnPay()); //全自费金额 todo
                insurResultTmp.put("overlmt_selfpay","");  //超限价自费费用 todo
                insurResultTmp.put("preselfpay_amt","");   //先行自付金额 todo
                insurResultTmp.put("inscp_scp_amt","");    //符合政策范围金额 todo
                insurResultTmp.put("act_pay_dedc",""); //实际支付起付线 todo
                insurResultTmp.put("hifp_pay",""); //基本医疗保险统筹基金支出
                insurResultTmp.put("pool_prop_selfpay","");    //基本医疗保险统筹基金支付比例 todo
                insurResultTmp.put("cvlserv_pay","");  //公务员医疗补助资金支出 todo
                insurResultTmp.put("hifes_pay","");    //企业补充医疗保险基金支出
                insurResultTmp.put("hifmi_pay","");    //居民大病保险资金支出
                insurResultTmp.put("hifob_pay","");    //职工大额医疗费用补助基金支出
                insurResultTmp.put("maf_pay","");  //医疗救助基金支出
                insurResultTmp.put("oth_pay","");  //其他支出
                insurResultTmp.put("fund_pay_sumamt","");  //基金支付总额
                insurResultTmp.put("psn_part_amt",""); //个人负担总金额
                insurResultTmp.put("acct_pay",""); //个人账户支出
                insurResultTmp.put("psn_cash_pay",""); //个人现金支出
                insurResultTmp.put("hosp_part_amt","");    //医院负担金额
                insurResultTmp.put("balc",""); //余额
                insurResultTmp.put("acct_mulaid_pay","");  //个人账户共济支付金额
                insurResultTmp.put("medins_setl_id",medicalMxDO.getSetlMsgid());   //医药机构结算ID(应跟setl_msgid值一致)
                insurResultTmp.put("clr_optins","");   //清算经办机构
                insurResultTmp.put("clr_way","");  //清算方式
                insurResultTmp.put("clr_type","11"); //清算类别
                insurResultTmp.put("hifdm_pay","0");    //伤残人员医疗保障基金支出
                insurResultTmp.put("exp_content","");  //
            YlzMedicalResponse ylzMedicalResponse = ylzMedicalResponseDao.findByMedicalId(ylzMedicalRelationDO.getId());
            if (null==ylzMedicalResponse){
                throw new Exception("未查询到医保结算信息");
            }
            JSONArray ylzResponse = JSONArray.parseArray(ylzMedicalResponse.getValue());
            JSONObject ylzResponseData = null;
            JSONObject ylzResponseOutPut = null;
            JSONObject setlinfo = null;
            if (ylzResponse.size()>0){
                for (int i=0;i<ylzResponse.size();i++){
                    JSONObject ylzResponse0 = ylzResponse.getJSONObject(i);
                    ylzResponseData = ylzResponse0.getJSONObject("data");
                    ylzResponseOutPut = ylzResponseData.getJSONObject("output");
                    setlinfo =  ylzResponseOutPut.getJSONObject("setlinfo");
                    JSONArray outPutSetldetail = ylzResponseOutPut.getJSONArray("setldetail");
                    JSONArray outPutResult = ylzResponseOutPut.getJSONArray("result");
                    YlzMedicalMxDO medicalMxDO = ylzMedicalMxDOList.get(0);
                    JSONObject insurResultTmp = new JSONObject();
                    insurResultTmp.put("visitNo",ylzMedicalRelationDO.getRelationCode()); //院内挂号号
                    insurResultTmp.put("insurSettleSort",medicalMxDO.getInsurSettleSort()); //医保结算序号
                    insurResultTmp.put("setl_msgid",medicalMxDO.getSetlMsgid()); //发送方报文ID
                    insurResultTmp.put("fee_msgid",medicalMxDO.getFeeMsgid()); //费用上传发送方报文ID
                    insurResultTmp.put("dise_msgid",ylzMedicalIcdDOList.get(0).getDiseMsgid()); //就诊信息上传发送方报文ID
                    insurResultTmp.put("chrg_bchno",medicalMxDO.getChrgBchno());   //收费批次号
                    insurResultTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode()); //参保地医保区划【窗口冲销有用】
                    insurResultTmp.put("card_sn",ylzMedicalRelationDO.getCardSn()); //卡识别码
                    insurResultTmp.put("mdtrt_cert_no",ylzMedicalRelationDO.getCardNo()); //就诊凭证编号
                    JSONObject setlinfoEexpContent = JSONObject.parseObject(setlinfo.getString("exp_content"));
                JSONArray setldetail  = new JSONArray();
                JSONObject setldetailTmp = new JSONObject();
                setldetailTmp.put("fund_pay_type","");  //基金支付类型
                setldetailTmp.put("inscp_scp_amt","");  //符合政策范围金额
                setldetailTmp.put("crt_payb_lmt_amt","");   //本次可支付限额金额
                setldetailTmp.put("fund_payamt","");    //基金支付金额
                setldetailTmp.put("fund_pay_type_name",""); //基金支付类型名称
                setldetailTmp.put("setl_proc_info",""); //结算过程信息
                setldetail.add(setldetailTmp);
                    insurResultTmp.put("fm_acct_balc",setlinfoEexpContent.get("fm_acct_balc").toString()); //家庭共济账户余额
                    insurResultTmp.put("hl_acct_balc",setlinfoEexpContent.get("hl_acct_balc").toString()); //健康账户余额
                    insurResultTmp.put("cvl_acct_balc",setlinfoEexpContent.get("cvl_acct_balc").toString()); //公务员账户余额
                    insurResultTmp.put("acct_used_flag","1"); //个人账户使用标志【窗口目前默认固定1,后续可开放前端选择传入】
                    insurResultTmp.put("mdtrt_id",setlinfo.get("mdtrt_id")); //就诊 ID
                    insurResultTmp.put("setl_id",setlinfo.get("setl_id")); //结算ID
                    insurResultTmp.put("psn_no",setlinfo.get("psn_no")); //人员编号   医保人员基本信息获取接口返回
                    insurResultTmp.put("psn_name",setlinfo.get("psn_name")); //人员姓名
                    insurResultTmp.put("psn_cert_type",setlinfo.get("psn_cert_type")); //人员证件类型
                    insurResultTmp.put("certno",setlinfo.get("certno")); //证件号码
                    insurResultTmp.put("gend",setlinfo.get("gend")); //性别
                    insurResultTmp.put("naty",setlinfo.get("naty")); //民族
                    insurResultTmp.put("brdy",setlinfo.get("brdy")); //出生日期
                    insurResultTmp.put("age",setlinfo.get("age").toString()); //年龄
                    insurResultTmp.put("insutype","310"); //险种类型
                    insurResultTmp.put("psn_type","11"); //人员类别"
                    insurResultTmp.put("cvlserv_flag","0"); //公务员标志
                    insurResultTmp.put("setl_time", setlinfo.get("setl_time"));    //结算时间
                    insurResultTmp.put("mdtrt_cert_type","03");  //就诊凭证类型
                    insurResultTmp.put("med_type",setlinfo.get("med_type")); //医疗类别
                    insurResultTmp.put("medfee_sumamt",setlinfo.get("medfee_sumamt").toString());  //医疗费总额
                    insurResultTmp.put("fulamt_ownpay_amt",setlinfo.get("fulamt_ownpay_amt").toString()); //全自费金额
                    insurResultTmp.put("overlmt_selfpay",setlinfo.get("overlmt_selfpay").toString());  //超限价自费费用
                    insurResultTmp.put("preselfpay_amt",setlinfo.get("preselfpay_amt").toString());   //先行自付金额
                    insurResultTmp.put("inscp_scp_amt",setlinfo.get("inscp_scp_amt").toString());    //符合政策范围金额
                    insurResultTmp.put("act_pay_dedc",setlinfo.get("act_pay_dedc").toString()); //实际支付起付线
                    insurResultTmp.put("hifp_pay",setlinfo.get("hifp_pay").toString()); //基本医疗保险统筹基金支出
                    insurResultTmp.put("pool_prop_selfpay",setlinfo.get("pool_prop_selfpay").toString());    //基本医疗保险统筹基金支付比例
                    insurResultTmp.put("cvlserv_pay",setlinfo.get("cvlserv_pay").toString());  //公务员医疗补助资金支出
                    insurResultTmp.put("hifes_pay",setlinfo.get("hifes_pay").toString());    //企业补充医疗保险基金支出
                    insurResultTmp.put("hifmi_pay",setlinfo.get("hifmi_pay").toString());    //居民大病保险资金支出
                    insurResultTmp.put("hifob_pay",setlinfo.get("hifob_pay").toString());    //职工大额医疗费用补助基金支出
                    insurResultTmp.put("maf_pay",setlinfo.get("maf_pay").toString());  //医疗救助基金支出
                    insurResultTmp.put("oth_pay",setlinfo.get("oth_pay").toString());  //其他支出
                    insurResultTmp.put("fund_pay_sumamt",setlinfo.get("fund_pay_sumamt").toString());  //基金支付总额
                    insurResultTmp.put("psn_part_amt",setlinfo.get("psn_part_amt").toString()); //个人负担总金额
                    insurResultTmp.put("acct_pay",setlinfo.get("acct_pay").toString()); //个人账户支出
                    insurResultTmp.put("psn_cash_pay",setlinfo.get("psn_cash_pay").toString()); //个人现金支出
                    insurResultTmp.put("hosp_part_amt",setlinfo.get("hosp_part_amt").toString());    //医院负担金额
                    insurResultTmp.put("balc",setlinfo.get("balc").toString()); //余额
                    insurResultTmp.put("acct_mulaid_pay",setlinfo.get("acct_mulaid_pay").toString());  //个人账户共济支付金额
                    insurResultTmp.put("medins_setl_id",setlinfo.get("medins_setl_id"));   //医药机构结算ID(应跟setl_msgid值一致)
                    insurResultTmp.put("clr_optins",setlinfo.get("clr_optins"));   //清算经办机构
                    insurResultTmp.put("clr_way",setlinfo.get("clr_way"));  //清算方式
                    insurResultTmp.put("clr_type",setlinfo.get("clr_type")); //清算类别
                    insurResultTmp.put("hifdm_pay",setlinfo.get("setlinfo").toString());    //伤残人员医疗保障基金支出
                    insurResultTmp.put("exp_content",setlinfo.get("exp_content"));
                JSONArray fpdetail  = new JSONArray();
                JSONObject fpdetailTmp  = new JSONObject();
                fpdetailTmp.put("chrgitmType",""); //发票项目类别
                fpdetailTmp.put("chrgitmTypeName","");  //发票项目类别名称
                fpdetailTmp.put("medChrgitmType","");   //发票项目类别
                fpdetailTmp.put("medChrgitmName","");   //发票项目类别名称
                fpdetailTmp.put("itemSumamt","");   //发票项目费用
                fpdetailTmp.put("itemClaaAmt","");  //医保发票费用
                fpdetailTmp.put("itemClabAmt","");  //医保个人费用
                fpdetailTmp.put("itemOthAmt","");   //特殊项目发票费用
                fpdetailTmp.put("itemOwnpayAmt","");    //非医保发票费用
                fpdetail.add(fpdetailTmp);
                    JSONArray setldetail  = new JSONArray();
                JSONArray feedetail_result  = new JSONArray();
                JSONObject feedetail_resultTmp  = new JSONObject();
                feedetail_resultTmp.put("feedetl_sn",medicalMxDO.getHisDetailSn());   // 费用明细流水
                feedetail_resultTmp.put("det_item_fee_sumamt",medicalMxDO.getTotalMoney()); //明细项目费用总额
                feedetail_resultTmp.put("cnt",medicalMxDO.getAmount()); //数量
                feedetail_resultTmp.put("pric",medicalMxDO.getPrice()); //单价
                feedetail_resultTmp.put("pric_uplmt_amt",""); //定价上限金额
                feedetail_resultTmp.put("selfpay_prop",""); //自付比例
                feedetail_resultTmp.put("fulamt_ownpay_amt",""); //全自费金额
                feedetail_resultTmp.put("overlmt_amt",""); //超限价金额
                feedetail_resultTmp.put("preselfpay_amt",""); //先行自付金额
                feedetail_resultTmp.put("inscp_scp_amt",""); //符合政策范围金额
                feedetail_resultTmp.put("chrgitm_lv",""); //收费项目等级
                feedetail_resultTmp.put("med_chrgitm_type",""); //医疗收费项目类别
                feedetail_resultTmp.put("bas_medn_flag",""); //基本药物标志
                feedetail_resultTmp.put("hi_nego_drug_flag",""); //医保谈判药品标志
                feedetail_resultTmp.put("chld_medc_flag",""); //儿童用药标志
                feedetail_resultTmp.put("list_sp_item_flag",""); //目录特项标志
                feedetail_resultTmp.put("lmt_used_flag",""); //限制使用标志
                feedetail_resultTmp.put("drt_reim_flag",""); //直报标志
                feedetail_resultTmp.put("memo",""); //备注
                feedetail_resultTmp.put("exp_content",""); //字段扩展
                feedetail_result.add(feedetail_resultTmp);
                    for (int j=0;j<outPutSetldetail.size();j++){
                        JSONObject outPutSetldetailTmp = outPutSetldetail.getJSONObject(j);
                        JSONObject setldetailTmp = new JSONObject();
                        setldetailTmp.put("fund_pay_type",null==outPutSetldetailTmp.get("fund_pay_type")?"":outPutSetldetailTmp.get("fund_pay_type").toString());  //基金支付类型
                        setldetailTmp.put("inscp_scp_amt",null==outPutSetldetailTmp.get("inscp_scp_amt")?"":outPutSetldetailTmp.get("inscp_scp_amt").toString());  //符合政策范围金额
                        setldetailTmp.put("crt_payb_lmt_amt",null==outPutSetldetailTmp.get("crt_payb_lmt_amt")?"":outPutSetldetailTmp.get("crt_payb_lmt_amt").toString());   //本次可支付限额金额
                        setldetailTmp.put("fund_payamt",null==outPutSetldetailTmp.get("fund_payamt")?"":outPutSetldetailTmp.get("fund_payamt").toString());    //基金支付金额
                        setldetailTmp.put("fund_pay_type_name",null==outPutSetldetailTmp.get("fund_pay_type_name")?"":outPutSetldetailTmp.get("fund_pay_type_name").toString()); //基金支付类型名称
                        setldetailTmp.put("setl_proc_info",null==outPutSetldetailTmp.get("setl_proc_info")?"":outPutSetldetailTmp.get("setl_proc_info").toString()); //结算过程信息
                        setldetail.add(setldetailTmp);
                    }
                insurResultTmp.put("setldetail",setldetail);
                insurResultTmp.put("fpdetail",fpdetail);
                insurResultTmp.put("feedetail_result",feedetail_result);
                    JSONArray fpdetail  = new JSONArray();
                    JSONArray fplists =  setlinfoEexpContent.getJSONArray("fplist");
                    for (int j=0;j<fplists.size();j++){
                        JSONObject fplistTmp = fplists.getJSONObject(j);
                        JSONObject fpdetailTmp  = new JSONObject();
                        fpdetailTmp.put("chrgitmType",null==fplistTmp.get("medChrgitmType")?"":fplistTmp.get("medChrgitmType").toString()); //发票项目类别
                        fpdetailTmp.put("chrgitmTypeName",null==fplistTmp.get("medChrgitmName")?"":fplistTmp.get("medChrgitmName").toString());  //发票项目类别名称
                        fpdetailTmp.put("itemSumamt",null==fplistTmp.get("itemSumamt")?"":fplistTmp.get("itemSumamt").toString());   //发票项目费用
                        fpdetailTmp.put("itemClaaAmt",null==fplistTmp.get("itemClaaAmt")?"":fplistTmp.get("itemClaaAmt").toString());  //医保发票费用
                        fpdetailTmp.put("itemClabAmt",null==fplistTmp.get("itemClabAmt")?"":fplistTmp.get("itemClabAmt").toString());  //医保个人费用
                        fpdetailTmp.put("itemOthAmt",null==fplistTmp.get("itemOthAmt")?"":fplistTmp.get("itemOthAmt").toString());   //特殊项目发票费用
                        fpdetailTmp.put("itemOwnpayAmt",null==fplistTmp.get("itemOwnpayAmt")?"":fplistTmp.get("itemOwnpayAmt").toString());    //非医保发票费用
                        fpdetail.add(fpdetailTmp);
                    }
                insurResult.add(insurResultTmp);
                    JSONArray feedetail_result  = new JSONArray();
                    for (int j=0;j<outPutResult.size();j++){
                        JSONObject outPutResultTmp = outPutResult.getJSONObject(j);
                        JSONObject feedetail_resultTmp  = new JSONObject();
                        feedetail_resultTmp.put("feedetl_sn",null==outPutResultTmp.get("feedetl_sn")?"":outPutResultTmp.get("feedetl_sn").toString());   // 费用明细流水
                        feedetail_resultTmp.put("det_item_fee_sumamt",null==outPutResultTmp.get("det_item_fee_sumamt")?"":outPutResultTmp.get("det_item_fee_sumamt").toString()); //明细项目费用总额
                        feedetail_resultTmp.put("cnt",null==outPutResultTmp.get("cnt")?"":outPutResultTmp.get("cnt").toString()); //数量
                        feedetail_resultTmp.put("pric",null==outPutResultTmp.get("pric")?"":outPutResultTmp.get("pric").toString()); //单价
                        feedetail_resultTmp.put("pric_uplmt_amt",null==outPutResultTmp.get("pric_uplmt_amt")?"":outPutResultTmp.get("pric_uplmt_amt").toString()); //定价上限金额
                        feedetail_resultTmp.put("selfpay_prop",null==outPutResultTmp.get("selfpay_prop")?"":outPutResultTmp.get("selfpay_prop").toString()); //自付比例
                        feedetail_resultTmp.put("fulamt_ownpay_amt",null==outPutResultTmp.get("fulamt_ownpay_amt")?"":outPutResultTmp.get("fulamt_ownpay_amt").toString()); //全自费金额
                        feedetail_resultTmp.put("overlmt_amt",null==outPutResultTmp.get("overlmt_amt")?"":outPutResultTmp.get("overlmt_amt").toString()); //超限价金额
                        feedetail_resultTmp.put("preselfpay_amt",null==outPutResultTmp.get("preselfpay_amt")?"":outPutResultTmp.get("preselfpay_amt").toString()); //先行自付金额
                        feedetail_resultTmp.put("inscp_scp_amt",null==outPutResultTmp.get("inscp_scp_amt")?"":outPutResultTmp.get("inscp_scp_amt").toString()); //符合政策范围金额
                        feedetail_resultTmp.put("chrgitm_lv",null==outPutResultTmp.get("chrgitm_lv")?"":outPutResultTmp.get("chrgitm_lv").toString()); //收费项目等级
                        feedetail_resultTmp.put("med_chrgitm_type",null==outPutResultTmp.get("med_chrgitm_type")?"":outPutResultTmp.get("med_chrgitm_type").toString()); //医疗收费项目类别
                        feedetail_resultTmp.put("bas_medn_flag",null==outPutResultTmp.get("bas_medn_flag")?"":outPutResultTmp.get("bas_medn_flag").toString()); //基本药物标志
                        feedetail_resultTmp.put("hi_nego_drug_flag",null==outPutResultTmp.get("hi_nego_drug_flag")?"":outPutResultTmp.get("hi_nego_drug_flag").toString()); //医保谈判药品标志
                        feedetail_resultTmp.put("chld_medc_flag",null==outPutResultTmp.get("chld_medc_flag")?"":outPutResultTmp.get("chld_medc_flag").toString()); //儿童用药标志
                        feedetail_resultTmp.put("list_sp_item_flag",null==outPutResultTmp.get("list_sp_item_flag")?"":outPutResultTmp.get("list_sp_item_flag").toString()); //目录特项标志
                        feedetail_resultTmp.put("lmt_used_flag",null==outPutResultTmp.get("lmt_used_flag")?"":outPutResultTmp.get("lmt_used_flag").toString()); //限制使用标志
                        feedetail_resultTmp.put("drt_reim_flag",null==outPutResultTmp.get("drt_reim_flag")?"":outPutResultTmp.get("drt_reim_flag").toString()); //直报标志
                        feedetail_resultTmp.put("memo",null==outPutResultTmp.get("memo")?"":outPutResultTmp.get("memo").toString()); //备注
                        feedetail_resultTmp.put("exp_content",null==outPutResultTmp.get("exp_content")?"":outPutResultTmp.get("exp_content").toString()); //字段扩展
                        feedetail_result.add(feedetail_resultTmp);
                    }
                    insurResultTmp.put("setldetail",setldetail);//直接取医保的返回值
                    insurResultTmp.put("fpdetail",fpdetail);
                    insurResultTmp.put("feedetail_result",feedetail_result);
                    insurResult.add(insurResultTmp);
                }
                msgBody.put("insurResult",insurResult);
            }
            msgBody.put("insurResult",insurResult);
        }
        JSONObject insurVisitTmp = new JSONObject();
        insurVisitTmp.put("visit_msgid",ylzMedicalRelationDO.getHisSettleNo());//发送方报文ID"
        insurVisitTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode());//参保地医保区划【窗口冲销有用】
        insurVisitTmp.put("insutype","310");//险种类型【挂号时用的险种,医保目前以此为准】
        insurVisitTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial());//就诊ID  医保挂号接口返回 todo
        insurVisitTmp.put("psn_no","");//人员编号   医保人员基本信息获取接口返回 todo
        insurVisitTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial());//就诊ID  医保挂号接口返回
        insurVisitTmp.put("psn_no",ylzMedicalRelationDO.getPsnNo());//人员编号   医保人员基本信息获取接口返回
        insurVisitTmp.put("ipt_otp_no",ylzMedicalRelationDO.getRelationCode());//门诊号
        insurVisitTmp.put("exp_content","");//字段扩展【应需要解决转义字符反斜杠被过滤问题,否则要将里面的扩展节点独立字段出
        insurVisitInfo.add(insurVisitTmp);
@ -254,7 +313,12 @@ public class JwService {
        param.put("interfaceStr","executeSickSettleMultiNew");//接口方法
        param.put("orgCode",ylzMedicalRelationDO.getOrgCode());
        param.put("msgBody",msgBody.toJSONString());
        JSONObject re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
        JSONObject re = null;
        if ("jwtest".equals(springProfiles)){
            String response = " ";
        }else {
            re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
        }
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setCode("callEhrInterfaceYG");
        wlyyHttpLogDO.setRequest(param.toString());
@ -263,7 +327,19 @@ public class JwService {
        wlyyHttpLogDO.setStatus("1");
        wlyyHttpLogDO.setCreateTime(new Date());
        httpLogDao.save(wlyyHttpLogDO);
        return re;
        if (re.getString("status").equalsIgnoreCase("200")) {//i健康返回值
            JSONObject responseDataTmp = re.getJSONObject("data");
            String codeTMP = responseDataTmp.getString("CODE");//智业返回值 0失败 1成功
            if (codeTMP.equalsIgnoreCase("1")) {
                ylzMedicalRelationDO.setState(1);
                ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                return true;
            }else {
                throw new Exception("结算失败"+responseDataTmp.getString("MESSAGE"));
            }
        }else {
            throw new Exception("结算失败"+re.getString("msg"));
        }
    }

File diff suppressed because it is too large
+ 277 - 237
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedOrderService.java


File diff suppressed because it is too large
+ 44 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/YlzService.java