Explorar o código

[医保代码]

wangzhinan %!s(int64=3) %!d(string=hai) anos
pai
achega
32f6384a27

+ 10 - 2
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -1074,13 +1074,21 @@ public class HealthCareService {
     * @return
     * @throws Exception
     */
    public String preSettlement(String registerNo) throws Exception{
    public YlzMedicalRelationDO preSettlement(String registerNo) throws Exception{
        String funid = "N20.17.04.05";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
        List<YlzMedicalIcdDO> icdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());;
        if (icdDOList!=null){
            ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOList);
        }
        List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());;
        if (mxDOList!=null){
            ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
        }
        JSONObject data = new JSONObject();
        data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
        data.put("idcard",ylzMedicalRelationDO.getIdcard());//证件号码
@ -1144,7 +1152,7 @@ public class HealthCareService {
            }
            logger.info("医保预结算服务保存成功");
        }
        return result;
        return ylzMedicalRelationDO;
    }
    /**

+ 0 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -60,8 +60,6 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByOutPatientIdList(String outpatientId);
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.status>=20 and a.status<30 and a.medicalStatus=1 ")
    List<WlyyPrescriptionDO> findByOutPatientIdListAndMedical(String outpatientId);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2 and a.status <30 and a.status>=0")

+ 38 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -43,6 +43,7 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
@ -13079,6 +13080,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public JSONObject getSettlementInfo(String outpatientId) throws Exception {
        logger.info("获取患者待结算信息开始!");
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
        String registerNo = outpatientDO.getRegisterNo();
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
@ -13093,7 +13097,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        logger.info("医保费用明细上传结束!");
        logger.info("医保预结算信息开始!");
        String preSettlement =  healthCareService.preSettlement(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
        logger.info("医保预结算信息结束!");
        logger.info("获取医保结算页面地址开始!");
@ -13102,8 +13106,40 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        JSONObject object = new JSONObject();
        object.put("register",register);
        object.put("feeDetailUpload",feeDetailUpload);
        object.put("preSettlement",preSettlement);
        object.put("preSettlement",ylzMedicalRelationDO);
        object.put("getSettlementResultUrl",getSettlementResultUrl);
        object.put("cardNo",outpatientDO.getCardNo());
        object.put("deptName",outpatientDO.getPatientName());
        return object;
    }
    /**
     * 医保结算页面
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlementInfo(String outpatientId,String code) throws Exception {
        logger.info("获取患者待结算信息开始!");
        String result = "";
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
        if (StringUtils.isNoneBlank(code)){
            logger.info("医保结算结果获取start!");
            result = healthCareService.getSettlementResult(code);
            logger.info("医保结算结果获取end!");
        }else{
            logger.info("医保结算页面start!");
            String registerNo = outpatientDO.getRegisterNo();
            result = healthCareService.getSettlementResultUrl(registerNo);
            logger.info("医保结算页面end!");
        }
        return result;
    }
}

+ 119 - 15
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -2229,8 +2229,20 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject jsonObject = new JSONObject();
        if (!StringUtils.isEmpty(icCardNo)){
            jsonObject.put("icCardNo",icCardNo);
        }
        if (!StringUtils.isEmpty(his_serial)){
            jsonObject.put("his_serial",his_serial);
        }
        if (!StringUtils.isEmpty(org_code)){
            jsonObject.put("org_code",org_code);
        }
        String condition =jsonObject.toJSONString();
        /*if (!StringUtils.isEmpty(icCardNo)){
            condition += "<icCardNo>"+icCardNo+"</icCardNo>";
        }
        if (!StringUtils.isEmpty(his_serial)){
@ -2238,9 +2250,8 @@ public class XzzxEntranceService{
        }
        if (!StringUtils.isEmpty(org_code)){
            condition += "<org_code>"+org_code+"</org_code>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        }*/
        String msgBody =condition;
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
@ -2448,9 +2459,80 @@ public class XzzxEntranceService{
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(his_serial);
        String condition ="";
        JSONObject jsonObject = new JSONObject();
        if (ylzMedicalRelationDO!=null){
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getLogNo())){
                jsonObject.put("log_no",ylzMedicalRelationDO.getLogNo());
            }
            if (!StringUtils.isEmpty(icCardNo)){
                jsonObject.put("icCardNo",icCardNo);
            }
            if (!StringUtils.isEmpty(org_code)){
                jsonObject.put("org_code",org_code);
            }
            if (!StringUtils.isEmpty("acc_class")){
                jsonObject.put("acc_class","acc_class");
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getInsuranceSerial())){
                jsonObject.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getBillSerial())){
                jsonObject.put("bill_serial",ylzMedicalRelationDO.getBillSerial());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getTotalAmount())){
                jsonObject.put("total_amount",ylzMedicalRelationDO.getTotalAmount());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getPersonCash())){
                jsonObject.put("person_cash",ylzMedicalRelationDO.getPersonCash());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getPersonAccount())){
                jsonObject.put("person_account",ylzMedicalRelationDO.getPersonAccount());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getFundPrice())){
                jsonObject.put("fund_amount",ylzMedicalRelationDO.getFundPrice());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getJkzhPay())){
                jsonObject.put("jkzh_pay",ylzMedicalRelationDO.getJkzhPay());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getOwnPay())){
                jsonObject.put("own_pay",ylzMedicalRelationDO.getOwnPay());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getAccountBalance())){
                jsonObject.put("account_balance",ylzMedicalRelationDO.getAccountBalance());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getHospitalizationQty())){
                jsonObject.put("hospitalization_qty",ylzMedicalRelationDO.getHospitalizationQty());
            }
            List<YlzMedicalBillDO> ylzMedicalBillDOS = ylzMedicailBillDao.findByMedicalId(ylzMedicalRelationDO.getId());
            JSONArray fpArray = new JSONArray();
            for (YlzMedicalBillDO ylzMedicalBillDO :ylzMedicalBillDOS){
                JSONObject fpObject = new JSONObject();
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getInvoiceType())){
                    fpObject.put("invoice_type",ylzMedicalBillDO.getInvoiceType());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getInvoiceTypeName())){
                    fpObject.put("invoice_type_name",ylzMedicalBillDO.getInvoiceTypeName());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getProjectPay())){
                    fpObject.put("project_pay",ylzMedicalBillDO.getProjectPay());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getInvoicePay())){
                    fpObject.put("invoice_pay",ylzMedicalBillDO.getInvoicePay());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getOwnPay())){
                    fpObject.put("own_pay",ylzMedicalBillDO.getOwnPay());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getSpecialPay())){
                    fpObject.put("special_pay",ylzMedicalBillDO.getSpecialPay());
                }
                if (!StringUtils.isEmpty(ylzMedicalBillDO.getUninsurancePay())){
                    fpObject.put("uninsurance_pay",ylzMedicalBillDO.getUninsurancePay());
                }
                fpArray.add(fpObject);
            }
            jsonObject.put("fplist",fpArray);
            condition = jsonObject.toJSONString();
            /*if (!StringUtils.isEmpty(ylzMedicalRelationDO.getLogNo())){
                condition += "<log_no>"+ylzMedicalRelationDO.getLogNo()+"</log_noc>";
            }
            if (!StringUtils.isEmpty(icCardNo)){
@ -2517,12 +2599,11 @@ public class XzzxEntranceService{
                    condition += "<uninsurance_pay>"+ylzMedicalBillDO.getUninsurancePay()+"</uninsurance_pay>";
                }
            }
            condition += "</fplist>";
            condition += "</fplist>";*/
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        String msgBody =condition;
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
@ -2550,7 +2631,7 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        /*String condition ="";
        if (!StringUtils.isEmpty(icCardNo)){
            condition += "<icCardNo>"+icCardNo+"</icCardNo>";
        }
@ -2559,9 +2640,19 @@ public class XzzxEntranceService{
        }
        if (!StringUtils.isEmpty(org_code)){
            condition += "<org_code>"+org_code+"</org_code>";
        }*/
        JSONObject object = new JSONObject();
        if (!StringUtils.isEmpty(icCardNo)){
            object.put("icCardNo",icCardNo);
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        if (!StringUtils.isEmpty(his_serial)){
            object.put("his_serial",his_serial);
        }
        if (!StringUtils.isEmpty(org_code)){
            object.put("org_code",org_code);
        }
        String condition =object.toJSONString();
        String msgBody =condition;
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
@ -2596,9 +2687,23 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        JSONObject jsonObject = new JSONObject();
        if (!StringUtils.isEmpty(sick_id)){
            jsonObject.put("sick_id",sick_id);
        }
        if (!StringUtils.isEmpty(settle_no)){
            jsonObject.put("settle_no",settle_no);
        }
        if (!StringUtils.isEmpty(einvoice_code)){
            jsonObject.put("einvoice_code",einvoice_code);
        }
        if (!StringUtils.isEmpty(einvoice_number)){
            jsonObject.put("einvoice_number",einvoice_number);
        }
        /*if (!StringUtils.isEmpty(sick_id)){
            condition += "<sick_id>"+sick_id+"</sick_id>";
        }
        if (!StringUtils.isEmpty(settle_no)){
@ -2609,10 +2714,9 @@ public class XzzxEntranceService{
        }
        if (!StringUtils.isEmpty(einvoice_number)){
            condition += "<einvoice_number>"+einvoice_number+"</einvoice_number>";
        }
        }*/
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        String msgBody =jsonObject.toJSONString();
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);

+ 61 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1247,6 +1247,67 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 调取支付参数
     *
     *
     * @param code
     * @param depositType WX_MIN 微信小程序,WX_PUB 微信公众号 ,ALI_WAP 支付宝生活号 WX_QR pc扫码,ALI_QR支付宝扫码
     * @param wechatId
     * @return
     * @throws Exception
     */
    public String prescriptionPay(String code,String depositType,String wechatId) throws Exception {
        String response = null;
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO =hospitalSysDictDao.findById("YLZ_NOTIFY_URL");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            String ssc = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            String openId = "";
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            String notifyUrl = hospitalSysDictDO.getDictCode();
            response = ylzPayService.rechargeConsume("123456",businessOrderDO.getPatientName(),"01",ssc,"01",idcard,depositType,
                    price,price,businessOrderDO.getOrderNo(),idcard,"0",businessOrderDO.getPatientName(),businessOrderDO.getRematk(),openId,notifyUrl,notifyUrl,null);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }
        }else {
            return "找不到订单!";
        }
        return response;
    }
    public BusinessOrderDO selectStatus(String relationCode){
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);

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

@ -2,17 +2,21 @@ package com.yihu.jw.entity.hospital.healthCare;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import org.w3c.dom.stylesheets.LinkStyle;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created by wangzhinan on 20211003
 */
@Entity
@Table(name = "base_ylz_medial_relation")
@Table(name = "base_ylz_medical_relation")
public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private String insuranceSerial;//医保收费流水号,
@ -60,6 +64,59 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private String doctorLevel;//医师诊察费等级
    private Date createTime;//创建时间',
    private String detailSerial;//医保明细流水号
    private Integer status;//结算状态
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    private List<YlzMedicalIcdDO> ylzMedicalIcdDOList;
    private List<YlzMedicalMxDO> ylzMedicalMxDOList;
    private List<YlzMedicalBillDO> ylzMedicalBillDOList;
    private WlyyOutpatientDO wlyyOutpatientDO;
    @Transient
    public WlyyOutpatientDO getWlyyOutpatientDO() {
        return wlyyOutpatientDO;
    }
    public void setWlyyOutpatientDO(WlyyOutpatientDO wlyyOutpatientDO) {
        this.wlyyOutpatientDO = wlyyOutpatientDO;
    }
    @Transient
    public List<YlzMedicalIcdDO> getYlzMedicalIcdDOList() {
        return ylzMedicalIcdDOList;
    }
    public void setYlzMedicalIcdDOList(List<YlzMedicalIcdDO> ylzMedicalIcdDOList) {
        this.ylzMedicalIcdDOList = ylzMedicalIcdDOList;
    }
    @Transient
    public List<YlzMedicalMxDO> getYlzMedicalMxDOList() {
        return ylzMedicalMxDOList;
    }
    public void setYlzMedicalMxDOList(List<YlzMedicalMxDO> ylzMedicalMxDOList) {
        this.ylzMedicalMxDOList = ylzMedicalMxDOList;
    }
    @Transient
    public List<YlzMedicalBillDO> getYlzMedicalBillDOList() {
        return ylzMedicalBillDOList;
    }
    public void setYlzMedicalBillDOList(List<YlzMedicalBillDO> ylzMedicalBillDOList) {
        this.ylzMedicalBillDOList = ylzMedicalBillDOList;
    }
    public String getDetailSerial() {
        return detailSerial;

+ 14 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -3331,4 +3331,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/confirmSettlementInfo")
    @ApiOperation(value = "确认医保结算", notes = "确认医保结算")
    public Envelop getSettlementInfo(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false)String outpatientId,
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = false)String code)throws Exception {
        try {
            return success("操作成功",prescriptionService.confirmSettlementInfo(outpatientId,code));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
}