瀏覽代碼

Merge branch '2.0' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into 2.0

LAPTOP-KB9HII50\70708 1 年之前
父節點
當前提交
b0409f98f2

+ 352 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/DsyyPrescriptionService.java

@ -8,16 +8,24 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
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.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
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.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
@ -85,6 +93,17 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private PrescriptionDao prescriptionDao;
    private PrescriptionDao prescriptionDao;
    @Autowired
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private YlzMedicailIcdDao ylzMedicailIcdDao;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    //=============查询视图========================
    //=============查询视图========================
    /**
    /**
@ -1328,4 +1347,337 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            return "处方号未空!";
            return "处方号未空!";
        }
        }
    }
    }
    /**
     * 获取待结算列表
     *
     *
     * @param cardno
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public YlzMedicalRelationDO getSettlementInfo(String cardno, String outpatientId) throws Exception {
        YlzMedicalRelationDO ylzMedicalRelationDO =new YlzMedicalRelationDO();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).get();
        //查询余额
        String balance = "";
        JSONObject jsonObject = dsyyEntranceService.selectCardInfo(cardno);
        String cardType= "";
        if (jsonObject!=null){
            balance = jsonObject.getString("ZHYE");
            cardType = jsonObject.getString("CARD_TYPE");
        }
        String resNo = outpatientDO.getRegisterNo();
        //请求his获取待结算存储
        Map<String,Object> params = new HashedMap();
        String url =entranceUrl +"getSettlement";
        params.put("cardType","cardType");
        params.put("cardNo",cardno);
        params.put("hismzlsh",outpatientDO.getRegisterNo());
        params.put("operatorId","HLWYY");
        params.put("operatorName","互联网医院");
        params.put("termNo","DSYYHLWYY");
        HttpResponse response = HttpUtils.doPost(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs3 = JSON.parseObject(content);
        Integer resStatus = rs3.getInteger("status");
        JSONObject resObj = new JSONObject();
        if (resStatus==200){
            resObj = rs3.getJSONObject("obj");
        }
        //获取his结算基本信息表
        String basicSql ="select * from SST_JSDP_JBXX_GJYB where CARD_NO ='"+cardno+"'";
        String res = dsyyEntranceService.getSql(basicSql);
        if (StringUtils.isNoneBlank(res)){
            JSONObject rs = JSONObject.parseObject(res);
            Integer status = rs.getInteger("status");
            if(status!=null&&status == 200){
                JSONArray array = rs.getJSONArray("detailModelList");
                for (int i=0;i<array.size();i++){
                    JSONObject object = array.getJSONObject(i);
                    String logNo = object.getString("LOG_NO");
                    String registerNo = object.getString("IPT_OTP_NO");
                    logger.info("logNo=="+logNo +"registerNo=="+registerNo);
                    if (registerNo.equalsIgnoreCase(resNo)){
                        logger.info("logNo=="+logNo +"registerNo=="+registerNo);
                        ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
                        if (ylzMedicalRelationDO==null){
                            ylzMedicalRelationDO = new YlzMedicalRelationDO();
                            ylzMedicalRelationDO.setLogNo(logNo);
                            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
                            ylzMedicalRelationDO.setRelationCode(outpatientId);
                            ylzMedicalRelationDO.setName(object.getString("PSN_NAME"));
                            ylzMedicalRelationDO.setTotalAmount(object.getString("COST"));
                            ylzMedicalRelationDO.setPersonCash(object.getString("ORIGIN_CHARGES"));
                            ylzMedicalRelationDO.setHisSerial(object.getString("RESIDENCE_NO"));
                            ylzMedicalRelationDO.setHisBillSerial(object.getString("SETTLE_NO"));
                            ylzMedicalRelationDO.setDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setHisDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setHisDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setStatus(0);
                            ylzMedicalRelationDO.setState(0);
                            ylzMedicalRelationDO.setDel(1);
                            ylzMedicalRelationDO.setDataSource("54");
                            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard());
                            ylzMedicalRelationDO.setBalance(balance);
                            ylzMedicalRelationDO.setPersonAccount("0");
                            ylzMedicalRelationDO.setMedicalPrice("0");
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setMedicalMode("10");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            if (StringUtils.isNoneBlank(outpatientDO.getDiseaseCode())){
                                ylzMedicalRelationDO.setMedicalType("13");
                            }else {
                                ylzMedicalRelationDO.setMedicalType("11");
                            }
                            ylzMedicalRelationDO.setHisSettleNo(object.getString("IPT_OTP_NO"));
                            ylzMedicalRelationDO.setCardNo(object.getString("CARD_NO"));
                            ylzMedicalRelationDO.setDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                            ylzMedicalRelationDO.setBcwkje(object.getString("YKFJE0"));
                        }else {
                            ylzMedicalRelationDO.setLogNo(logNo);
                            ylzMedicalRelationDO.setRelationCode(outpatientId);
                            ylzMedicalRelationDO.setDataSource("54");
                            ylzMedicalRelationDO.setDel(1);
                            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
                            ylzMedicalRelationDO.setName(object.getString("PSN_NAME"));
                            ylzMedicalRelationDO.setTotalAmount(object.getString("COST"));
                            ylzMedicalRelationDO.setPersonCash(object.getString("ORIGIN_CHARGES"));
                            ylzMedicalRelationDO.setHisSerial(object.getString("RESIDENCE_NO"));
                            ylzMedicalRelationDO.setHisBillSerial(object.getString("SETTLE_NO"));
                            ylzMedicalRelationDO.setDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setHisDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setHisDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setPersonAccount("0");
                            ylzMedicalRelationDO.setMedicalPrice("0");
                            ylzMedicalRelationDO.setBalance(balance);
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setMedicalMode("10");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            if (StringUtils.isNoneBlank(outpatientDO.getDiseaseCode())){
                                ylzMedicalRelationDO.setMedicalType("13");
                            }else {
                                ylzMedicalRelationDO.setMedicalType("11");
                            }
                            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard());
                            ylzMedicalRelationDO.setHisSettleNo(object.getString("IPT_OTP_NO"));
                            ylzMedicalRelationDO.setCardNo(object.getString("CARD_NO"));
                            ylzMedicalRelationDO.setDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                            ylzMedicalRelationDO.setBcwkje(object.getString("YKFJE0"));
                        }
                        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        ylzMedicailMxDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
                        //获取结算明细
                        String detailSql =" select * from SST_JSDP_JSMX_GJYB where LOG_NO ='"+logNo+"' ";
                        String detailRes = dsyyEntranceService.getSql(detailSql);
                        List<YlzMedicalMxDO> mxDOList = new ArrayList<>();
                        Integer itemCount = 0;
                        if (StringUtils.isNoneBlank(detailRes)) {
                            JSONObject drs = JSONObject.parseObject(detailRes);
                            Integer dstatus = drs.getInteger("status");
                            if (dstatus != null && dstatus == 200) {
                                JSONArray darray = drs.getJSONArray("detailModelList");
                                itemCount=darray.size();
                                for (int j = 0; j < darray.size(); j++) {
                                    JSONObject dobject = darray.getJSONObject(j);
                                    YlzMedicalMxDO medicalMxDO = new YlzMedicalMxDO();
                                    medicalMxDO.setDel(1);
                                    medicalMxDO.setMedicalId(ylzMedicalRelationDO.getId());
                                    medicalMxDO.setCreateTime(new Date());
                                    medicalMxDO.setInvoiceType("01");
                                    medicalMxDO.setItemName(dobject.getString("XMMC00"));
                                    medicalMxDO.setHisDetailSn(dobject.getString("FEEDETL_SN"));
                                    medicalMxDO.setItemCode(dobject.getString("MED_LIST_CODG"));
                                    medicalMxDO.setPrescriptionCode(dobject.getString(""));
                                    medicalMxDO.setChargeUnit(dobject.getString("PRCUNT"));
                                    medicalMxDO.setSpecificationType(dobject.getString(""));
                                    medicalMxDO.setAmount(dobject.getString("CNT"));
                                    medicalMxDO.setPrice(dobject.getString("PRIC"));
                                    medicalMxDO.setPrescriptionCode(dobject.getString("RXNO"));
                                    medicalMxDO.setSpecificationType(dobject.getString("SPECIFICATION_TYPE"));
                                    medicalMxDO.setDosageForm(dobject.getString("DOSAGE_FORM"));
                                    medicalMxDO.setPrescriptionDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                                    medicalMxDO.setActgDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                                    medicalMxDO.setClerkDays(DateUtil.strToDate(object.getString("BEGNTIME")));
                                    medicalMxDO.setPeopleType(null);
                                    medicalMxDO.setSingleDose(dobject.getString("SIN_DOS_DSCR"));
                                    medicalMxDO.setUseFrequency(dobject.getString("USED_FRQU_DSCR"));
                                    medicalMxDO.setMedicationDays(dobject.getString("PRD_DAYS"));
                                    medicalMxDO.setMedicalWay(dobject.getString("MEDC_WAY_DSCR"));
                                    medicalMxDO.setDeptCode(dobject.getString("BILG_DEPT_CODG"));
                                    medicalMxDO.setDeptName(dobject.getString("BILG_DEPT_NAME"));
                                    medicalMxDO.setHisDeptCode(dobject.getString("BILG_DEPT_CODG"));
                                    medicalMxDO.setHisDeptName(dobject.getString("BILG_DEPT_NAME"));
                                    medicalMxDO.setMedicalPerId(dobject.getString("BILG_DR_CODG"));
                                    medicalMxDO.setMedicalPerName(dobject.getString("BILG_DR_NAME"));
                                    if (StringUtils.isNoneBlank(dobject.getString("HOSP_APPR_FLAG"))){
                                        if (dobject.getString("HOSP_APPR_FLAG").equalsIgnoreCase("0")||dobject.getString("HOSP_APPR_FLAG").equalsIgnoreCase("2")){
                                            medicalMxDO.setLimitType("N");
                                        } else if (dobject.getString("HOSP_APPR_FLAG").equalsIgnoreCase("1")) {
                                            medicalMxDO.setLimitType("Y");
                                        }
                                    }
                                    medicalMxDO.setHisItemCode(dobject.getString("MED_LIST_CODG"));
                                    medicalMxDO.setHisItemName(dobject.getString("XMMC00"));
                                    medicalMxDO.setTotalMoney(dobject.getString("DET_ITEM_FEE_SUMAMT"));
                                    medicalMxDO = ylzMedicailMxDao.save(medicalMxDO);
                                    mxDOList.add(medicalMxDO);
                                }
                            }
                        }
                        ylzMedicalRelationDO.setItemCount(itemCount+"");
                        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                        List<YlzMedicalIcdDO> icdDOS = new ArrayList<>();
                        ylzMedicailIcdDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
                        //获取诊断
                        String icdSql =" select * from SST_JSDP_DZMX_GJYB where LOG_NO ='"+logNo+"' ";
                        String icdRes = dsyyEntranceService.getSql(icdSql);
                        if (StringUtils.isNoneBlank(icdRes)) {
                            JSONObject drs = JSONObject.parseObject(icdRes);
                            Integer dstatus = drs.getInteger("status");
                            if (dstatus != null && dstatus == 200) {
                                JSONArray darray = drs.getJSONArray("detailModelList");
                                for (int j = 0; j < darray.size(); j++) {
                                    JSONObject dobject = darray.getJSONObject(j);
                                    YlzMedicalIcdDO icdDO = new YlzMedicalIcdDO();
                                    icdDO.setCreateTime(new Date());
                                    icdDO.setDel(1);
                                    icdDO.setDiseaseCodeIcd10(dobject.getString("DIAG_CODE"));
                                    icdDO.setDiseaseNameIcd10(dobject.getString("DIAG_NAME"));
                                    icdDO.setDiseaseType(dobject.getString("DIAG_TYPE"));
                                    icdDO.setDiseaseOrder(dobject.getString("DIAG_SRT_NO"));
                                    icdDO.setMedicalId(ylzMedicalRelationDO.getId());
                                    icdDO = ylzMedicailIcdDao.save(icdDO);
                                    icdDOS.add(icdDO);
                                }
                            }
                        }
                        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOS);
                    }
                }
            }
        }
        return  ylzMedicalRelationDO;
    }
    /**
     * 确认医保结算
     *
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlement(String outpatientId) throws Exception {
        try {
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).get();
            if (outpatientDO==null){
                throw new Exception("未找到待结算记录");
            }
            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getState()!=null&&ylzMedicalRelationDO.getState()==1){
                return "已结算";
            }
            if (ylzMedicalRelationDO==null){
                return "已结算";
            }
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
            String depositType = "";
            String depositAmount = "";
            String outChargeNo = "";
            String orderNo="";
            if (businessOrderDO!=null){
                depositType = businessOrderDO.getDepositType();
                depositAmount = businessOrderDO.getPayPrice()+"";
                outChargeNo = businessOrderDO.getTraceNo();
                orderNo = businessOrderDO.getOrderNo();
            }
            if (ylzMedicalRelationDO.getMedicalState()==null||(ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0)){
            }else {
            }
            Map<String,Object> params = new HashedMap();
            String url ="" +"comfirmSettleMent";
            params.put("mct","03");
            params.put("mcn",ylzMedicalRelationDO.getCardNo());
            params.put("xtgzh0",ylzMedicalRelationDO.getLogNo());
            HttpResponse response = HttpUtils.doGet(url,params);
            System.out.println("response=="+response.getContent());
            String res = response.getContent();
            boolean flag = true;
            if (StringUtils.isNoneBlank(res)){
                JSONObject jsonObject = JSONObject.parseObject(res);
                String status = jsonObject.getString("status");
                if (status.equalsIgnoreCase("200")){
                    JSONObject obj = jsonObject.getJSONObject("obj");
                    String rs = obj.getString("rs");
                    JSONObject rsObj = JSONObject.parseObject(rs);
                    String retCode = rsObj.getString("retCode");
                    if (retCode.equalsIgnoreCase("99")){
                        flag=false;
                        throw new Exception(rsObj.getString("retMsg"));
                    }
                }else {
                    flag = false;
                }
            }
            if (flag){
                ylzMedicalRelationDO.setState(1);
                ylzMedicalRelationDO.setSettleDate(new Date());
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(ylzMedicalRelationDO.getRelationCode());
                /*String */
                String realOrder = "";
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                    if (prescriptionDO.getStatus()==20){
                        WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                        prescriptionLogDO.setCreateTime(new Date());
                        prescriptionLogDO.setStatus(30);
                        prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                        prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
                        prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                        prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                        prescriptionLogDO.setUserType(1);
                        prescriptionLogDO.setDatajson("处方结算");
                        prescriptionLogDao.save(prescriptionLogDO);
                        prescriptionDO.setStatus(30);
                        prescriptionDO.setVoucherNo(ylzMedicalRelationDO.getHisBillSerial());
                        prescriptionDO.setPayTime(new Date());
                        prescriptionDao.save(prescriptionDO);
                        logger.info("变更处方结算状态成功");
                        realOrder = prescriptionDO.getRealOrder();
                    }
                    try {
                        sfToHis(outpatientId, realOrder);
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
                try {
                    logger.info("=================电子发票开具开始=================");
               /*     dsyyEntranceService.OutpatientInvoicing(ylzMedicalRelationDO.getHisBillSerial(),"lb");*/
                    logger.info("=================电子发票开具结束=================");
                }catch (Exception e){
                    e.printStackTrace();
                }
                return "结算成功!";
            }else {
                throw new Exception("结算失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            throw new Exception(e.getMessage());
        }
    }
}
}

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

@ -53,6 +53,7 @@ import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.third.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.entity.third.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.healthCare.service.HealthCareNewService;
import com.yihu.jw.healthCare.service.HealthCareService;
import com.yihu.jw.healthCare.service.HealthCareService;
import com.yihu.jw.hospital.consult.dao.BaseAdviceTreatmentDao;
import com.yihu.jw.hospital.consult.dao.BaseAdviceTreatmentDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
@ -358,6 +359,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private boolean flag;
    private boolean flag;
    @Autowired
    @Autowired
    private OutpatientHospitalizationDao outpatientHospitalizationDao;
    private OutpatientHospitalizationDao outpatientHospitalizationDao;
    @Autowired
    private HealthCareNewService healthCareNewService;
    /**
    /**
@ -14611,127 +14614,134 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(outpatientDO==null){
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
            throw new Exception("门诊信息为空");
        }
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode").orElse(null);
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),outpatientId,sysDictDO.getDictValue());
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.registerToEntrance(outpatientId);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(outpatientId);
            logger.info("医保费用明细上传结束!");
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(outpatientId);
            logger.info("医保预结算信息结束!");
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
            }
            object.put("register",register);
            object.put("feeDetailUpload",feeDetailUpload);
            object.put("preSettlement",ylzMedicalRelationDO);
            object.put("cardNo",outpatientDO.getCardNo());
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }else {
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode").get();
        if (wechatId.equalsIgnoreCase("xm_dsyy_wx")) {
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            logger.info("获取患者待结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
            if (ylzMedicalRelationDO != null && StringUtils.isNoneBlank(ylzMedicalRelationDO.getPageCode())) {
                String result = confirmSettlementInfo(outpatientId, ylzMedicalRelationDO.getPageCode());
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(result);
                if (jsonObject.getString("flag").equalsIgnoreCase("1")) {
                    com.alibaba.fastjson.JSONObject object1 = jsonObject.getJSONObject("encrypt_data");
                    BigDecimal b1 = new BigDecimal(object1.getString("tcjj_pay"));
                    BigDecimal b2 = new BigDecimal(object1.getString("sbjj_pay"));
                    BigDecimal b3 = new BigDecimal(object1.getString("gwy_pay"));
                    BigDecimal b4 = new BigDecimal(object1.getString("jzfp_pay"));
                    BigDecimal b5 = new BigDecimal(object1.getString("yljz_pay"));
                    BigDecimal b6 = new BigDecimal(object1.getString("other_pay"));
                    String valiFlag = object1.getString("vali_flag");
                    if (valiFlag.equalsIgnoreCase("1")) {
                        BigDecimal b7 = new BigDecimal(object1.getString("enterprise_supplement"));
                        Double price = b1.add(b2).add(b3).add(b4).add(b5).add(b6).add(b7).doubleValue();
                        if (Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice()) == price) {
                            ylzMedicalRelationDO.setStatus(1);
                            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        } else {
                            if (StringUtils.isNoneBlank(ylzMedicalRelationDO.getDiseaseCode())) {
                                throw new Exception("已存在医保结算记录,请先处理后再结算!");
                            }
                            ylzMedicalRelationDO.setStatus(0);
                            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        }
                    } else {
                        ylzMedicalRelationDO.setStatus(0);
                        ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                    }
                } else {
                    if (jsonObject.getString("flag").equalsIgnoreCase("50204")) {
                        ylzMedicalRelationDO.setStatus(0);
                        ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                    } else {
                        throw new Exception(jsonObject.getString("cause"));
                    }
                }
            }
            if (ylzMedicalRelationDO != null && ylzMedicalRelationDO.getStatus() == 1) {
                com.alibaba.fastjson.JSONObject object2 = hcyyPrescriptionService.selectCardInfo(outpatientDO.getCardNo());
                Double cardFee = object2.getDouble("ZHYE");
                //医保已结算直接返回数据
                //医保已结算直接返回数据
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                Double totalPirce=b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:"+totalPirce);
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                ylzMedicalRelationDO.setBalance(cardFee + "");
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                Double totalPirce = b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:" + totalPirce);
                if (totalPirce != Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())) {
                    object.put("code", "403");
                    object.put("message", "金额不对无法结算!");
                } else {
                    object.put("code", "200");
                    object.put("message", "核对金额无误!");
                }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                object.put("getSettleInfo", ylzMedicalRelationDO);
                return object;
                return object;
            }
            }
            try {
                ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            }catch (Exception e){
                throw new Exception(e.getMessage());
            }
            if (ylzMedicalRelationDO==null){
            ylzMedicalRelationDO = dsyyPrescriptionService.getSettlementInfo(outpatientDO.getCardNo(), outpatientDO.getId());
            if (ylzMedicalRelationDO == null) {
                throw new Exception("无待结算信息");
                throw new Exception("无待结算信息");
            }
            }
            logger.info("获取患者待结算信息结束!");
            if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
            if (outpatientDO != null && outpatientDO.getMedicalState().equalsIgnoreCase("1")) {
                logger.info("医保挂号开始!");
                logger.info("医保挂号开始!");
                String register = healthCareService.register(outpatientId,ylzMedicalRelationDO.getLogNo());
                String register = healthCareNewService.register(outpatientId);
                logger.info("医保挂号结束!");
                logger.info("医保挂号结束!");
                logger.info("医保费用明细上传开始!");
                logger.info("医保费用明细上传开始!");
                String feeDetailUpload= healthCareService.feeDetailUpload(outpatientId,ylzMedicalRelationDO.getLogNo());
                String feeDetailUpload = healthCareNewService.feeDetailUpload(outpatientId);
                logger.info("医保费用明细上传结束!");
                logger.info("医保费用明细上传结束!");
                logger.info("医保预结算信息开始!");
                logger.info("医保预结算信息开始!");
                ylzMedicalRelationDO =  healthCareService.preSettlement(outpatientId,ylzMedicalRelationDO.getLogNo());
                ylzMedicalRelationDO = healthCareNewService.preSettlement(outpatientId);
                logger.info("医保预结算信息结束!");
                logger.info("医保预结算信息结束!");
                if (flag==1){
                if (flag == 1) {
                    logger.info("获取医保结算页面地址开始!");
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrl = healthCareService.getSettlementResultUrl(outpatientId,ylzMedicalRelationDO.getLogNo());
                    String getSettlementResultUrl = healthCareNewService.getSettlementResultUrl(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrl",getSettlementResultUrl);
                }else if (flag==2){
                    object.put("getSettlementResultUrl", getSettlementResultUrl);
                } else if (flag == 2) {
                    logger.info("获取医保结算页面地址开始!");
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(outpatientId,ylzMedicalRelationDO.getLogNo());
                    String getSettlementResultUrlBase64 = healthCareNewService.getSettlementResultUrlBase64(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
                    object.put("getSettlementResultUrlBase64", getSettlementResultUrlBase64);
                }
                }
                if (ylzMedicalRelationDO.getPersonCash()!=null){
                if (ylzMedicalRelationDO.getPersonCash() != null) {
                    BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                    BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                    BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                    BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                    BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                    BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                    Double totalPirce=b1.add(b2).add(b3).doubleValue();
                    logger.info("总费用:"+totalPirce);
                    if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                        object.put("code","403");
                        object.put("message","金额不对无法结算!");
                    }else {
                        object.put("code","200");
                        object.put("message","核对金额无误!");
                    Double totalPirce = b1.add(b2).add(b3).doubleValue();
                    logger.info("总费用:" + totalPirce);
                    if (totalPirce != Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())) {
                        object.put("code", "403");
                        object.put("message", "金额不对无法结算!");
                    } else {
                        object.put("code", "200");
                        object.put("message", "核对金额无误!");
                    }
                    }
                }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                object.put("getSettleInfo", ylzMedicalRelationDO);
                return object;
                return object;
            }else {
            } else {
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                Double totalPirce=b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:"+totalPirce);
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                Double totalPirce = b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:" + totalPirce);
                if (totalPirce != Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())) {
                    object.put("code", "403");
                    object.put("message", "金额不对无法结算!");
                } else {
                    object.put("code", "200");
                    object.put("message", "核对金额无误!");
                }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                object.put("getSettleInfo", ylzMedicalRelationDO);
                return object;
                return object;
            }
            }
        }else {
            return null;
        }
        }
    }
    }

+ 73 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -299,6 +299,23 @@ public class DsyyEntranceService {
    private final static String url="http://192.168.101.2:10023/dsyy/createSQLQuery";
    private final static String url="http://192.168.101.2:10023/dsyy/createSQLQuery";
    private final static String orgCode ="350211A1004";
    private final static String orgCode ="350211A1004";
    /**
     * 请求his服务查询数据
     * @param sql
     * @return
     * @throws Exception
     */
    public String getSql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql语句:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        return content;
    }
    /**
    /**
     * 同步科室信息
     * 同步科室信息
     * @return
     * @return
@ -1103,6 +1120,52 @@ public class DsyyEntranceService {
        return patientMappingDO.getMappingCode();
        return patientMappingDO.getMappingCode();
    }
    }
    /**
     * 获取患者卡详情
     *
     *
     * @param cardno
     * @throws Exception
     */
    public JSONObject selectCardInfo(String cardno) throws Exception {
        String sql ="SELECT\n" +
                "\tPAT_NO AS \"PAT_NO\",\n" +
                "\tSICK_ID AS \"SICK_ID\",\n" +
                "\tCARD_NO AS \"CARD_NO\",\n" +
                "\tCARD_STAT AS \"CARD_STAT\",\n" +
                "\tOP_DATE AS \"OP_DATE\",\n" +
                "\tCARD_TYPE AS \"CARD_TYPE\",\n" +
                "\tXM AS \"XM\",\n" +
                "\tXB AS \"XB\",\n" +
                "\tLXDH AS \"LXDH\",\n" +
                "\tZJHM AS \"ZJHM\",\n" +
                "\tZHYE AS \"ZHYE\" \n" +
                "FROM\n" +
                "\tzhiydba.v_internet_patient_card_info \n" +
                "WHERE\n" +
                " 1=1 ";
        JSONObject object = new JSONObject();
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(cardno)){
            sql +=" and CARD_NO = '"+cardno+"' ";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("cardNo:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            if (array!=null&&array.size()!=0){
                object = array.getJSONObject(0);
            }
        }
        return object;
    }
    /**
    /**
     * 获取患者卡列表
     * 获取患者卡列表
     *
     *
@ -1701,7 +1764,7 @@ public class DsyyEntranceService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getSettlement(String cardNo,String cardType,String xtgzh0,String operatorId,String operatorName,String termNo) throws  Exception{
    public String getSettlement(String cardNo,String cardType,String xtgzh0,String hismzlsh,String operatorId,String operatorName,String termNo) throws  Exception{
        String api = "query_recipe_gjyb";
        String api = "query_recipe_gjyb";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "<root> " +
@ -1731,6 +1794,11 @@ public class DsyyEntranceService {
        if (StringUtils.isNoneBlank(termNo)){
        if (StringUtils.isNoneBlank(termNo)){
            object.put("termNo",termNo);
            object.put("termNo",termNo);
        }
        }
        if (StringUtils.isNoneBlank(hismzlsh)){
            object.put("hismzlsh",hismzlsh);
        }
        object.put("accountType","01");
        object.put("sfxsjs","Y");
        condition = object.toJSONString();
        condition = object.toJSONString();
        String msgBody =condition;
        String msgBody =condition;
        Map<String,String> params = new HashedMap();
        Map<String,String> params = new HashedMap();
@ -1989,7 +2057,7 @@ public class DsyyEntranceService {
     * @throws Exception
     * @throws Exception
     */
     */
    public String queryDayDetailList(String operatorId ,String operatorName,String termNo,String orgCode,String iptNo,String patientId,
    public String queryDayDetailList(String operatorId ,String operatorName,String termNo,String orgCode,String iptNo,String patientId,
                                     String beginDate,String endData) throws  Exception{
                                     String beginDate,String endData,String cardNo) throws  Exception{
        String api = "query_day_detail_list";
        String api = "query_day_detail_list";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "<root> " +
@ -2004,6 +2072,9 @@ public class DsyyEntranceService {
        if (StringUtils.isNoneBlank(operatorId)){
        if (StringUtils.isNoneBlank(operatorId)){
            object.put("operatorId",operatorId);
            object.put("operatorId",operatorId);
        }
        }
        if (StringUtils.isNoneBlank(cardNo)){
            object.put("cardNo",cardNo);
        }
        if (StringUtils.isNoneBlank(operatorName)){
        if (StringUtils.isNoneBlank(operatorName)){
            object.put("operatorName",operatorName);
            object.put("operatorName",operatorName);
        }
        }

+ 72 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -303,6 +303,21 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String planId;//康复执行计划关联id
    private String planId;//康复执行计划关联id
    private String planDoctor;//康复执行计划负责人id
    private String planDoctor;//康复执行计划负责人id
    private String diseaseCode;//特殊病种编码
    private String diseaseName;//特殊病种名称
    private Integer isPositive;//是否新冠阳性 1是0否
    private String inquirySign;//问诊标识1发热咨询0普通门诊
    private String visitType;//就诊类型:1首诊2复诊
    private String virusFlag;//新冠病毒:1阴性、2阳性、0无
    private String isDisease;//特殊病种1是0否
    @Column(name = "medical_state")
    @Column(name = "medical_state")
    public String getMedicalState() {
    public String getMedicalState() {
        return medicalState;
        return medicalState;
@ -847,4 +862,61 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setPlanDoctor(String planDoctor) {
    public void setPlanDoctor(String planDoctor) {
        this.planDoctor = planDoctor;
        this.planDoctor = planDoctor;
    }
    }
    public String getDiseaseCode() {
        return diseaseCode;
    }
    public void setDiseaseCode(String diseaseCode) {
        this.diseaseCode = diseaseCode;
    }
    public String getDiseaseName() {
        return diseaseName;
    }
    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }
    public Integer getIsPositive() {
        return isPositive;
    }
    public void setIsPositive(Integer isPositive) {
        this.isPositive = isPositive;
    }
    public String getInquirySign() {
        return inquirySign;
    }
    public void setInquirySign(String inquirySign) {
        this.inquirySign = inquirySign;
    }
    public String getVisitType() {
        return visitType;
    }
    public void setVisitType(String visitType) {
        this.visitType = visitType;
    }
    public String getVirusFlag() {
        return virusFlag;
    }
    public void setVirusFlag(String virusFlag) {
        this.virusFlag = virusFlag;
    }
    public String getIsDisease() {
        return isDisease;
    }
    public void setIsDisease(String isDisease) {
        this.isDisease = isDisease;
    }
}
}

+ 1 - 1
server/svr-authentication/src/main/resources/application.yml

@ -567,7 +567,7 @@ wechat:
spring:
spring:
  profiles: dsyyProd
  profiles: dsyyProd
  datasource:
  datasource:
    url: jdbc:mysql://192.168.101.2:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    url: jdbc:mysql://192.168.101.2:3306/base?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    username: wlyy
    password: 2oEq3Kf7@zjxl
    password: 2oEq3Kf7@zjxl
  redis:
  redis:

+ 7 - 3
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/DsyyController.java

@ -166,13 +166,15 @@ public class DsyyController extends EnvelopRestEndpoint {
                                    @RequestParam(value = "cardType",required = false)String cardType,
                                    @RequestParam(value = "cardType",required = false)String cardType,
                                    @ApiParam(name = "xtgzh0", value = "单据号", required = false)
                                    @ApiParam(name = "xtgzh0", value = "单据号", required = false)
                                        @RequestParam(value = "xtgzh0",required = false)String xtgzh0,
                                        @RequestParam(value = "xtgzh0",required = false)String xtgzh0,
                                    @ApiParam(name = "hismzlsh", value = "挂号号", required = false)
                                        @RequestParam(value = "hismzlsh",required = false)String hismzlsh,
                                    @ApiParam(name = "operatorId", value = "操作者id", required = false)
                                    @ApiParam(name = "operatorId", value = "操作者id", required = false)
                                        @RequestParam(value = "operatorId",required = false)String operatorId,
                                        @RequestParam(value = "operatorId",required = false)String operatorId,
                                    @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                    @ApiParam(name = "operatorName", value = "操作者姓名", required = false)
                                        @RequestParam(value = "operatorName",required = false)String operatorName,
                                        @RequestParam(value = "operatorName",required = false)String operatorName,
                                    @ApiParam(name = "termNo", value = "终端编号", required = false)
                                    @ApiParam(name = "termNo", value = "终端编号", required = false)
                                        @RequestParam(value = "termNo",required = false)String termNo) throws Exception {
                                        @RequestParam(value = "termNo",required = false)String termNo) throws Exception {
        return success("请求成功",dsyyEntranceService.getSettlement(cardNo,cardType,xtgzh0,operatorId,operatorName,termNo));
        return success("请求成功",dsyyEntranceService.getSettlement(cardNo,cardType,xtgzh0,hismzlsh,operatorId,operatorName,termNo));
    }
    }
    @PostMapping(value = "/confirmPayGjyb")
    @PostMapping(value = "/confirmPayGjyb")
@ -300,9 +302,11 @@ public class DsyyController extends EnvelopRestEndpoint {
                                   @ApiParam(name = "beginDate", value = "开始日期 20230801不能为空", required = false)
                                   @ApiParam(name = "beginDate", value = "开始日期 20230801不能为空", required = false)
                                   @RequestParam(value = "beginDate",required = false)String beginDate,
                                   @RequestParam(value = "beginDate",required = false)String beginDate,
                                   @ApiParam(name = "endData", value = "截止日期 可为空", required = false)
                                   @ApiParam(name = "endData", value = "截止日期 可为空", required = false)
                                   @RequestParam(value = "endData",required = false)String endData) throws Exception {
                                   @RequestParam(value = "endData",required = false)String endData,
                                         @ApiParam(name = "cardNo", value = "卡号", required = false)
                                             @RequestParam(value = "cardNo",required = false)String cardNo) throws Exception {
        return success("请求成功",dsyyEntranceService.queryDayDetailList(operatorId ,operatorName,termNo,orgCode,
        return success("请求成功",dsyyEntranceService.queryDayDetailList(operatorId ,operatorName,termNo,orgCode,
                iptNo,patientId,beginDate,endData));
                iptNo,patientId,beginDate,endData,cardNo));
    }
    }

+ 1 - 1
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -667,7 +667,7 @@ express:
---
---
#马銮湾医院
#73医院
spring:
spring:
  profiles: qsyyProd
  profiles: qsyyProd
  datasource:
  datasource:

+ 5 - 0
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/config/DataSourceConfig.java

@ -75,6 +75,7 @@ public class DataSourceConfig {
    @Bean(name = "primaryReadWrite")
    @Bean(name = "primaryReadWrite")
    @Primary//主库 默认不写名字用这个
    @Primary//主库 默认不写名字用这个
    public DataSource primaryReadWriteDataSource(StatFilter statFilter) throws SQLException {
    public DataSource primaryReadWriteDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("主数据库配置==>"+primaryReadWriteUrl+"  账号==>"+primaryReadWriteUsername+"  密码==>"+primaryReadWritePassword);
        DruidDataSource datasource = new DruidDataSource();
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadWriteUrl);
        datasource.setUrl(primaryReadWriteUrl);
        datasource.setUsername(primaryReadWriteUsername);
        datasource.setUsername(primaryReadWriteUsername);
@ -117,6 +118,8 @@ public class DataSourceConfig {
    @Bean(name = "primaryRead")
    @Bean(name = "primaryRead")
    public DataSource primaryReadDataSource(StatFilter statFilter) throws SQLException {
    public DataSource primaryReadDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("从数据库配置==>"+primaryReadUrl+"  账号==>"+pprimaryReadUsername+"  密码==>"+primaryReadPassword);
        DruidDataSource datasource = new DruidDataSource();
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadUrl);
        datasource.setUrl(primaryReadUrl);
        datasource.setUsername(pprimaryReadUsername);
        datasource.setUsername(pprimaryReadUsername);
@ -159,6 +162,8 @@ public class DataSourceConfig {
    @Bean(name = "imData")
    @Bean(name = "imData")
    public DataSource imDataSource(StatFilter statFilter) throws SQLException {
    public DataSource imDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("imData数据库配置==>"+imUrl+"  账号==>"+imUsername+"  密码==>"+imPassword);
        DruidDataSource datasource = new DruidDataSource();
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(imUrl);
        datasource.setUrl(imUrl);
        datasource.setUsername(imUsername);
        datasource.setUsername(imUsername);

+ 11 - 9
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/etl/extract/ExtractHelper.java

@ -54,43 +54,45 @@ public class ExtractHelper {
                timeSql = wlyyJobConfigVO.getSqlDay();
                timeSql = wlyyJobConfigVO.getSqlDay();
            }
            }
            //如果为null 初始化
            //如果为null 初始化
            if(StringUtils.isEmpty(timeSql)){
                timeSql="";
            if (StringUtils.isEmpty(timeSql)) {
                timeSql = "";
            }
            }
            //设置时间
            //设置时间
            String sql = initSql(wlyyJobConfigVO.getSql() + "  " + timeSql, year);
            String sql = initSql(wlyyJobConfigVO.getSql() + "  " + timeSql, year);
            String sqlCount = initSql(wlyyJobConfigVO.getSqlCount() + "  " + timeSql, year);
            String sqlCount = initSql(wlyyJobConfigVO.getSqlCount() + "  " + timeSql, year);
            logger.info(" sql: " + sql);
            logger.info(" sql: " + sql);
            logger.info(" sqlCount: " + sqlCount);
            logger.info(" sqlCount: " + sqlCount);
            Map<String,Object> params = new HashedMap();
            Map<String, Object> params = new HashedMap();
            params.put("startTime", startTime);
            params.put("startTime", startTime);
            params.put("endTime", endTime);
            params.put("endTime", endTime);
            /*params.put("startTime", DateUtil.strToDate(startTime,"yyyy-MM-dd HH:mm:ss"));
            /*params.put("startTime", DateUtil.strToDate(startTime,"yyyy-MM-dd HH:mm:ss"));
            params.put("endTime", DateUtil.strToDate(endTime,"yyyy-MM-dd HH:mm:ss"));*/
            params.put("endTime", DateUtil.strToDate(endTime,"yyyy-MM-dd HH:mm:ss"));*/
            //如果是数据库从数据库抽取
            //如果是数据库从数据库抽取
            if (StringUtils.isEmpty(wlyyJobConfigVO.getExtractType())||"1".equals(wlyyJobConfigVO.getExtractType())){
            if (StringUtils.isEmpty(wlyyJobConfigVO.getExtractType()) || "1".equals(wlyyJobConfigVO.getExtractType())) {
                //抽取数据库
                //抽取数据库
                System.out.println("抽取数据库sql==>" + sql);
                return SpringUtil.getBean(DBExtract.class).extractByPage(
                return SpringUtil.getBean(DBExtract.class).extractByPage(
                        DataModel.class,
                        DataModel.class,
                        sql,
                        sql,
                        sqlCount,
                        sqlCount,
                        true,
                        true,
                        jdbcTemplate,params);
            }else if("2".equals(wlyyJobConfigVO.getExtractType())){
                        jdbcTemplate, params);
            } else if ("2".equals(wlyyJobConfigVO.getExtractType())) {
                //抽取ES
                //抽取ES
               return SpringUtil.getBean(ESExtract.class).extract(wlyyJobConfigVO);
                return SpringUtil.getBean(ESExtract.class).extract(wlyyJobConfigVO);
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            System.out.println("报错了");
            logger.error("extract error:" + e.getMessage());
            logger.error("extract error:" + e.getMessage());
            logger.error("quotaVO str:" + wlyyJobConfigVO.toString());
            logger.error("quotaVO str:" + wlyyJobConfigVO.toString());
            e.printStackTrace();
        }
        }
        return null;
        return null;
    }
    }
    public String initSql(String sql, String year) {
    public String initSql(String sql, String year) {
        return sql.replace("[year]", year).replace("[im]",imDatabaseName);
        return sql.replace("[year]", year).replace("[im]", imDatabaseName);
    }
    }
}
}

+ 41 - 20
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/util/hibernate/HibenateUtils.java

@ -1,5 +1,6 @@
package com.yihu.jw.statistics.util.hibernate;
package com.yihu.jw.statistics.util.hibernate;
import com.alibaba.fastjson.JSON;
import org.hibernate.SQLQuery;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Session;
import org.hibernate.transform.Transformers;
import org.hibernate.transform.Transformers;
@ -45,7 +46,7 @@ public class HibenateUtils {
        SQLQuery query = session.createSQLQuery(sql);
        SQLQuery query = session.createSQLQuery(sql);
        query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
        query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
        if(page!=null&&size!=null){
        if (page != null && size != null) {
            query.setFirstResult((page - 1) * size);
            query.setFirstResult((page - 1) * size);
            query.setMaxResults(size);
            query.setMaxResults(size);
        }
        }
@ -58,6 +59,7 @@ public class HibenateUtils {
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     * 无分页
     * 无分页
     *
     * @param sql
     * @param sql
     * @return
     * @return
     */
     */
@ -73,10 +75,11 @@ public class HibenateUtils {
     * 创建SQL查询,根据配置,获取数据库方言
     * 创建SQL查询,根据配置,获取数据库方言
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     *
     * @param sql
     * @param sql
     * @param params 动态占位符入参,例如 like:name
     * @param params 动态占位符入参,例如 like:name
     * @param page 第几页,1开始
     * @param size 每页记录数
     * @param page   第几页,1开始
     * @param size   每页记录数
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size) {
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size) {
@ -87,7 +90,7 @@ public class HibenateUtils {
        //设置查询参数
        //设置查询参数
        setSqlQueryByMap(query, params);
        setSqlQueryByMap(query, params);
        if(page!=null&&size!=null){
        if (page != null && size != null) {
            query.setFirstResult((page - 1) * size);
            query.setFirstResult((page - 1) * size);
            query.setMaxResults(size);
            query.setMaxResults(size);
        }
        }
@ -99,12 +102,26 @@ public class HibenateUtils {
     * 创建SQL查询,根据配置,获取数据库方言
     * 创建SQL查询,根据配置,获取数据库方言
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * sql为原生sql语句,查询,Oracle不区分大小写,返回值需要驼峰命名,字段别名需要加 双引号
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     * 目前只支持通用的聚合函数,特有的聚合函数不支持
     *
     * @param sql
     * @param sql
     * @param params 动态占位符入参,例如 like:name
     * @param params 动态占位符入参,例如 like:name
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params) {
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params) {
        Map<String, Object> entityProperties = entityManager.getProperties();
        Session session = (Session) entityManager.getDelegate();
        Session session = (Session) entityManager.getDelegate();
        Map<String, Object> sessionProperties = session.getProperties();
//        System.out.println("----------------------------------------");
//        System.out.println("打印entityProperties");
//        for (Map.Entry<String, Object> entry : entityProperties.entrySet()) {
//            System.out.println(entry.getKey() + "   值==>" + JSON.toJSONString(entry.getValue()));
//        }
//        System.out.println("打印sessionProperties");
//        for (Map.Entry<String, Object> entry : sessionProperties.entrySet()) {
//            System.out.println(entry.getKey() + "   值==>" + JSON.toJSONString(entry.getValue()));
//        }
//        System.out.println("----------------------------------------");
        SQLQuery query = session.createSQLQuery(sql);
        SQLQuery query = session.createSQLQuery(sql);
        query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
        query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
@ -117,6 +134,7 @@ public class HibenateUtils {
    /**
    /**
     * 设置查询参数
     * 设置查询参数
     *
     * @param sqlQuery
     * @param sqlQuery
     * @param params
     * @param params
     * @return
     * @return
@ -139,17 +157,18 @@ public class HibenateUtils {
    /**
    /**
     * 聚合函数类型装换
     * 聚合函数类型装换
     *
     * @param obj
     * @param obj
     * @return
     * @return
     */
     */
    public Long objTransformLong(Object obj){
    public Long objTransformLong(Object obj) {
        //Oracle count(1) 聚合函数类型装换
        //Oracle count(1) 聚合函数类型装换
        if(obj instanceof BigDecimal){
        if (obj instanceof BigDecimal) {
            return ((BigDecimal) obj).longValue();
            return ((BigDecimal) obj).longValue();
        //Mysql count(1) 聚合函数类型装换
        }else if(obj instanceof BigInteger){
            return ((BigInteger)obj).longValue();
        }else{
            //Mysql count(1) 聚合函数类型装换
        } else if (obj instanceof BigInteger) {
            return ((BigInteger) obj).longValue();
        } else {
            return 0L;
            return 0L;
        }
        }
    }
    }
@ -157,6 +176,7 @@ public class HibenateUtils {
    /**
    /**
     * map - T
     * map - T
     *
     * @param map
     * @param map
     * @param clazz
     * @param clazz
     * @param <T>
     * @param <T>
@ -196,7 +216,8 @@ public class HibenateUtils {
    }
    }
    /**
    /**
     *  List<Map> -- List<T>
     * List<Map> -- List<T>
     *
     * @param list
     * @param list
     * @param clazz
     * @param clazz
     * @param <T>
     * @param <T>
@ -204,7 +225,7 @@ public class HibenateUtils {
     * @throws Exception
     * @throws Exception
     */
     */
    public static <T> List<T> castMapToBean(List<Map<String, Object>> list, Class<T> clazz) throws Exception {
    public static <T> List<T> castMapToBean(List<Map<String, Object>> list, Class<T> clazz) throws Exception {
        if(list == null || list.size()==0) {
        if (list == null || list.size() == 0) {
            return null;
            return null;
        }
        }
        List<T> tList = new ArrayList<T>();
        List<T> tList = new ArrayList<T>();
@ -212,23 +233,23 @@ public class HibenateUtils {
        Field[] fields = clazz.getDeclaredFields();
        Field[] fields = clazz.getDeclaredFields();
        T t;
        T t;
        for(Map<String, Object> map : list) {
        for (Map<String, Object> map : list) {
            // 每次都先初始化一遍,然后再设置值
            // 每次都先初始化一遍,然后再设置值
            t = clazz.newInstance();
            t = clazz.newInstance();
            for(Field field : fields) {
            for (Field field : fields) {
                // 把序列化的字段去除掉
                // 把序列化的字段去除掉
                if(!"serialVersionUID".equals(field.getName())){
                if (!"serialVersionUID".equals(field.getName())) {
                    // 由于Field都是私有属性,所有需要允许修改
                    // 由于Field都是私有属性,所有需要允许修改
                    field.setAccessible(true);
                    field.setAccessible(true);
                    Object value = map.get(field.getName());
                    Object value = map.get(field.getName());
                    if (value!=null){
                        if("java.math.BigDecimal".equals(value.getClass().getName())){
                            value=Double.parseDouble(value.toString());
                    if (value != null) {
                        if ("java.math.BigDecimal".equals(value.getClass().getName())) {
                            value = Double.parseDouble(value.toString());
                        }
                        }
                        if(value.getClass().getName().equals("java.lang.Integer") && field.getName().equals("slaveKey1")){
                        if (value.getClass().getName().equals("java.lang.Integer") && field.getName().equals("slaveKey1")) {
                            value = value.toString();
                            value = value.toString();
                        }
                        }
                        if(field.getName().equals("slaveKey2")){
                        if (field.getName().equals("slaveKey2")) {
                            value = value.toString();
                            value = value.toString();
                        }
                        }
                    }
                    }