Explorar o código

Merge branch 'dev' of http://27.154.233.186:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
#	server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
wangzhinan %!s(int64=3) %!d(string=hai) anos
pai
achega
a66d10a6b0
Modificáronse 15 ficheiros con 400 adicións e 191 borrados
  1. 78 74
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  2. 4 1
      business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java
  3. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  4. 17 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  5. 106 60
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  6. 89 24
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  7. 5 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 20 9
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  9. 2 2
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java
  10. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  11. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java
  12. 13 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java
  13. 9 15
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java
  14. 2 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  15. 39 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 78 - 74
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -647,78 +647,81 @@ public class HealthCareService {
            throw new Exception("居民信息不存在");
        }
        WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
        JSONObject data = new JSONObject();
        data.put("order_code",outpatientDO.getRegisterNo());//订单号
        data.put("order_time",DateUtil.dateToStrFormatLong(expressageDO.getCreateTime()));//订单时间
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if(wlyyPrescriptionDOS.size()==0){
            throw new Exception("处方信息不存在");
        }
        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
        data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
        data.put("channel","1");//1、微信公众号,2、app,3、web
        data.put("insurance_ticket_no",ylzMedicalRelationDO.getBillSerial());//医保收费单据号	String	N	订单结算后的收费单据号
        String order_state = "";
        if (wlyyPrescriptionDO.getStatus()==30){
            order_state = "1";
        }else if (wlyyPrescriptionDO.getStatus()==31){
            order_state = "2";
        }else if (wlyyPrescriptionDO.getStatus()==100){
            order_state = "3";
        }
        data.put("order_state",order_state);//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
        data.put("order_addr_detail",expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());//订单详细地址
        data.put("order_owner",expressageDO.getName());
        data.put("order_owner_idcard",patientDO.getIdcard());
        data.put("order_owner_phone",patientDO.getMobile());
        Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());
        data.put("addr_lat",map.get("lat"));//收货地址纬度
        data.put("addr_lng",map.get("lng"));//收货地址经度
        if(expressageDO.getOneselfPickupFlg()==1){
            //自取
            data.put("delivery_way","2");//1.网订配送,2.网订自取
            data.put("qrcode_check_time","");//扫码校验时间
            data.put("receiving_time","");//药品签收时间
        }else {
            //非自取
            data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
            data.put("delivery_number",expressageDO.getMailno());//配送单号
            data.put("delivery_org","顺丰");//配送单位
            data.put("delivery_take_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//配送接单时间
            data.put("delivery_name","顺丰");//配送人姓名
            data.put("delivery_id_card","顺丰");//配送人身份证
        logger.info("电子处方订单接收:1");
        List<YlzMedicalRelationDO> ylzMedicalRelationDOList = ylzMedicailRelationDao.findByOutpatientStatus(outpatientId);
        for (YlzMedicalRelationDO ylzMedicalRelationDO:ylzMedicalRelationDOList){
            logger.info("电子处方订单接收:2");
            JSONObject data = new JSONObject();
            data.put("order_time",DateUtil.dateToStrLong(expressageDO.getCreateTime()));//订单时间
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderList(ylzMedicalRelationDO.getLogNo());
            if(wlyyPrescriptionDOS.size()==0){
                throw new Exception("处方信息不存在");
            }
            data.put("order_code",ylzMedicalRelationDO.getLogNo());//订单号
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
            data.put("channel","1");//1、微信公众号,2、app,3、web
            data.put("insurance_ticket_no",ylzMedicalRelationDO.getBillSerial());//医保收费单据号	String	N	订单结算后的收费单据号
            String order_state = "";
            if (wlyyPrescriptionDO.getStatus()==30){
                order_state = "1";
            }else if (wlyyPrescriptionDO.getStatus()==31){
                order_state = "2";
            }else if (wlyyPrescriptionDO.getStatus()==100){
                order_state = "3";
            }
            logger.info("电子处方订单接收:3"+order_state);
            data.put("order_state",order_state);//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
            data.put("order_addr_detail",expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());//订单详细地址
            data.put("order_owner",expressageDO.getName());
            data.put("order_owner_idcard",patientDO.getIdcard());
            data.put("order_owner_phone",patientDO.getMobile());
            Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());
            data.put("addr_lat",map.get("lat"));//收货地址纬度
            data.put("addr_lng",map.get("lng"));//收货地址经度
            if(expressageDO.getOneselfPickupFlg()==1){
                //自取
                data.put("delivery_way","2");//1.网订配送,2.网订自取
                data.put("qrcode_check_time","");//扫码校验时间
                data.put("receiving_time","");//药品签收时间
            }else {
                //非自取
                data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
                data.put("delivery_number",expressageDO.getMailno());//配送单号
                data.put("delivery_org","顺丰");//配送单位
                data.put("delivery_take_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//配送接单时间
                data.put("delivery_name","顺丰");//配送人姓名
                data.put("delivery_id_card","顺丰");//配送人身份证
//            data.put("delivery_phone","");//配送人联系电话 N
            data.put("getmedical_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//骑手取药记录
            data.put("delivery_money","");//配送费
                data.put("getmedical_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//骑手取药记录
                data.put("delivery_money","");//配送费
        }
            }
//        apothecary_name	药师姓名	String	N
//        apothecary_id_card	药师身份证	String	N
//        apothecary_audit	药师审核时间	String	N
        data.put("money",ylzMedicalRelationDO.getTotalAmount());//商品金额
        data.put("settlement_time",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getPayDate()));//结算时间
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("delivery_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//发单时间
            data.put("money",ylzMedicalRelationDO.getTotalAmount());//商品金额
            data.put("settlement_time",DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));//结算时间
            data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
            data.put("delivery_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//发单时间
        data.put("elec_prescription_code",wlyyPrescriptionDO.getId());//平台处方编号
        data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
            data.put("elec_prescription_code",wlyyPrescriptionDO.getId());//平台处方编号
            data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
//        data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊流水号
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//门诊业务流水号
        JSONArray array = new JSONArray();
        List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
        for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
            JSONObject object = new JSONObject();
            object.put("order_id",outpatientDO.getRegisterNo());
            object.put("settlement_no",ylzMedicalRelationDO.getHisBillSerial());
            object.put("item_name",ylzMedicalMxDO.getItemName());
            object.put("item_code",ylzMedicalMxDO.getItemCode());
            array.add(object);
        }
        data.put("MXLIST",array);
            data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//门诊业务流水号
            JSONArray array = new JSONArray();
            List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
            for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
                JSONObject object = new JSONObject();
                object.put("order_id",ylzMedicalRelationDO.getLogNo());
                object.put("settlement_no",ylzMedicalRelationDO.getHisBillSerial());
                object.put("item_name",ylzMedicalMxDO.getItemName());
                object.put("item_code",ylzMedicalMxDO.getItemCode());
                array.add(object);
            }
            data.put("MXLIST",array);
//        mxlist	药品明细	MXLIST	N
//        MXLIST
//        order_id	订单号	String	Y
@ -727,17 +730,18 @@ public class HealthCareService {
//        item_code	医保项目编码	String	Y
//        supervision_code	药品电子监管码	String	N	非必填
        String result = requestYlz(data,"N20.17.05.02","电子处方订单接收");
        if(result == null){
            throw new Exception("医保请求失败");
        }
        logger.info("电子处方订单接收:"+result);
        JSONObject object = JSONObject.parseObject(result);
        if (object.getString("flag").equalsIgnoreCase("1")){
            JSONObject encryptData = object.getJSONObject("encrypt_data");
            return encryptData.toJSONString();
            String result = requestYlz(data,"N20.17.05.02","电子处方订单接收");
            if(result == null){
                throw new Exception("医保请求失败");
            }
            logger.info("电子处方订单接收:"+result);
            JSONObject object = JSONObject.parseObject(result);
            if (object.getString("flag").equalsIgnoreCase("1")){
                JSONObject encryptData = object.getJSONObject("encrypt_data");
                logger.info("encryptData=="+encryptData);
            }
        }
        return result;
        return "上传成功";
    }
    /**

+ 4 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java

@ -15,9 +15,12 @@ import java.util.List;
 */
public interface YlzMedicailRelationDao extends PagingAndSortingRepository<YlzMedicalRelationDO, String>, JpaSpecificationExecutor<YlzMedicalRelationDO> {
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 ")
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 and a.state=0 ")
    YlzMedicalRelationDO findByOutpatient(String outpatientId);
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 and a.state=1 ")
    List<YlzMedicalRelationDO> findByOutpatientStatus(String outpatientId);
    @Query("from YlzMedicalRelationDO a where a.logNo = ?1 ")
    YlzMedicalRelationDO findByLog_no(String logNo);

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

@ -60,6 +60,8 @@ 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.realOrder = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByRealOrderAndStatusList(String realOrder);
    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")

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

@ -53,6 +53,23 @@ public class PayInfoNoticeService {
        return null;
    }
    public String pushPrescriptionPayMedicare(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total,String mipay,String selfPay,String title,String url){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
            String userName = patientDO.getName();
            String idcard = patientDO.getIdcard();
            String phone = patientDO.getMobile();
            if (!StringUtils.isNotBlank(url)){
                url = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+prescriptionId;
            }
            String remark = "结算方式:微信结算" +
                    "点击查看取药\n物流信息";
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,mipay,selfPay,orderNo,remark);
        }
        return null;
    }
    public String pushPrescriptionPayAndHsjc(String patient,String doctorName,String orderNo,String id,String total,String title,String url,String realOrder){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){

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

@ -7337,19 +7337,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Boolean flag = healthCareService.isHospitalFlag();
        if (flag){
            try{
                String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                    if (object.getString("flag").equalsIgnoreCase("1")){
                        com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                        String state = encryptData.getString("state");
                        String auth_date = encryptData.getString("auth_date");
                        basePatientDO.setMedicalState(state);
                        basePatientDO = basePatientDao.save(basePatientDO);
                    }
                }else {
                    String result = healthCareService.authorized(basePatientDO.getId());
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                    if (object.getString("flag").equalsIgnoreCase("1")){
                        com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                        String state = encryptData.getString("state");
                        String auth_date = encryptData.getString("auth_date");
                        basePatientDO.setMedicalState(state);
                        basePatientDO = basePatientDao.save(basePatientDO);
                    }
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
@ -14047,17 +14058,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }else {
            /*entranceService.BS10108()*/
            /*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            /*if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
            if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
                //医保已结算直接返回数据
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                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","金额不对无法结算!");
@ -14067,22 +14080,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }*/
            }
            try {
                ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            }catch (Exception e){
                e.printStackTrace();
                throw new Exception(e.getMessage());
            }
            if (ylzMedicalRelationDO==null){
                throw new Exception("无待结算信息");
            }
/*
            if (ylzMedicalRelationDO.getStatus()!=null&&ylzMedicalRelationDO.getStatus()==1){
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }*/
            logger.info("获取患者待结算信息结束!");
            if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
                logger.info("医保挂号开始!");
@ -14107,18 +14113,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
                }
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                if (ylzMedicalRelationDO.getPersonCash()!=null){
                    BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                    BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                    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","核对金额无误!");
                    }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }else {
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                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","金额不对无法结算!");
@ -14130,15 +14146,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                return object;
            }
        }
    }
    public YlzMedicalRelationDO selectByOutpatientId(String outpatientId){
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        return ylzMedicalRelationDO;
    }
    public String electronicPrescriptionReceiving(String outpatientId) {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
            try {
                return  healthCareService.electronicPrescriptionReceiving(outpatientId);
                healthCareService.electronicPrescriptionReceiving(outpatientId);
                return "上传成功";
            }catch (Exception e){
                e.printStackTrace();
            }
@ -14208,7 +14228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw new Exception("未找到待结算记录");
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getAdmNo());
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        String depositType = "";
        String depositAmount = "";
@ -14270,9 +14290,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHisSettleVO.setMzlsh0(ylzMedicalRelationDO.getInsuranceSerial());
            wlyyHisSettleVO.setZhzfe0(ylzMedicalRelationDO.getPersonAccount());
            wlyyHisSettleVO.setGrzfe0(ylzMedicalRelationDO.getPersonCash());
/*
            Double bcbxzg = Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount());
*/
            wlyyHisSettleVO.setJjzfe0(ylzMedicalRelationDO.getMedicalPrice());
            wlyyHisSettleVO.setGwybz0(ylzMedicalRelationDO.getGwyPay());
            wlyyHisSettleVO.setFybfy0(ylzMedicalRelationDO.getPersonCash());
@ -14294,6 +14311,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHisSettleVO.setPsnNo(ylzMedicalRelationDO.getPersonalCode());
            wlyyHisSettleVO.setAab301(ylzMedicalRelationDO.getAdministrativeArea());
            wlyyHisSettleVO.setInsutype(ylzMedicalRelationDO.getInsuranceType());
            wlyyHisSettleVO.setSetlTime(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
            jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
        }
        if (jsonArray!=null&&jsonArray.size()!=0){
@ -14304,37 +14322,65 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                ylzMedicalRelationDO.setState(1);
                ylzMedicalRelationDO.setHisBillSerial(msgInfoJson.getString("callSn"));
                ylzMedicalRelationDO.setHisDesc(msgInfoJson.getString("jsxxts"));
                ylzMedicalRelationDO.setSettleDate(new Date());
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                boolean hisState = false;
                for (YlzMedicalMxDO mxDO:mxDOList){
                    if (mxDO.getItemName().contains("互联网医院复诊诊查费")){
                        hisState = true;
                    }
                }
                logger.info("变更医保结算状态成功");
                String realOrder = "";
                List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByRegisterNoList(ylzMedicalRelationDO.getHisSerial());
                for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(wlyyOutpatientDO.getId());
                    for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                        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.setPayTime(new Date());
                        prescriptionDao.save(prescriptionDO);
                        realOrder = prescriptionDO.getRealOrder();
                        logger.info("变更处方结算状态成功");
                String realOrder = msgInfoJson.getString("xtgzh0");
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    String title = "";
                    if (wlyyOutpatientDO.getHisStatus()==null){
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
                    }else {
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!";
                    }
                    if (hisState){
                        wlyyOutpatientDO.setHisStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                    }
                    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.setPayTime(new Date());
                    prescriptionDao.save(prescriptionDO);
                    logger.info("变更处方结算状态成功");
                    String fee = ylzMedicalRelationDO.getTotalAmount();
                    String pushPayLog =  payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,ylzMedicalRelationDO.getMedicalPrice(),ylzMedicalRelationDO.getPersonCash(),title,null);
                    logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
                    //2.6.1	电子处方订单接收
                    logger.info("医保电子处方订单");
                    if (ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0){
                        List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(ylzMedicalRelationDO.getRelationCode());
                        if (expressageDOList!=null&&expressageDOList.size()!=0){
                            WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
                            if (expressageDO.getOneselfPickupFlg()==1){
                                healthCareService.electronicPrescriptionReceiving(ylzMedicalRelationDO.getRelationCode());
                            }
                        }
                    }
                }
                logger.info("电子发票开具开始");
                try {
                /*try {
                    entranceService.dzpjServer(patientMappingDO.getMappingCode(),realOrder);
                }catch (Exception e){
                    e.printStackTrace();
                }
                }*/
                logger.info("电子发票开具结束");
            }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 89 - 24
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


+ 5 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1600,6 +1600,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(1);
        businessOrderDO.setPayTime(new Date());
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
@ -1933,7 +1934,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(code);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        Double fee = Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())-Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())-Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
        BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getTotalAmount());//总金额
        BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
        BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
        Double fee = b1.subtract(b2).subtract(b3).doubleValue();
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";

+ 20 - 9
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -404,16 +404,27 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        }
        Boolean flag = healthCareService.isHospitalFlag();
        if (flag){
            String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
            JSONObject object = JSONObject.parseObject(result);
            if (object.getString("flag").equalsIgnoreCase("1")){
                JSONObject encryptData = object.getJSONObject("encrypt_data");
                String state = encryptData.getString("state");
                String auth_date = encryptData.getString("auth_date");
                basePatientDO.setMedicalState(state);
                basePatientDO = basePatientDao.save(basePatientDO);
            if(wxId.equalsIgnoreCase("xm_xzzx_wx")){
                String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                JSONObject object = JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                }
            }else {
                String result = healthCareService.authorized(basePatientDO.getId());
                JSONObject object = JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                }
            }
        }
        return basePatientDO;
    }

+ 2 - 2
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java

@ -14,9 +14,9 @@ import org.springframework.stereotype.Service;
@Service
public class YkyyINSMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyyINSMSService.class);
    private final String usrCode ="300643";
    private final String usrCode ="301312";
    private final String pw ="T9IHN69DDF";
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    @Autowired

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
/*    @GeneratedValue(generator = "generator")
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)*/
    @Column(name = "id", unique = true, nullable = false)
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java

@ -91,6 +91,17 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private String hisDesc;//his结算描述
    private String balance;//预交金余额
    private String medicalPrice;//医保基金总额
    private Date settleDate;//his结算时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="settle_date")
    public Date getSettleDate() {
        return settleDate;
    }
    public void setSettleDate(Date settleDate) {
        this.settleDate = settleDate;
    }
    public String getMedicalPrice() {
        return medicalPrice;

+ 13 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java

@ -232,6 +232,19 @@ public class WlyyHisSettleVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "险种",example = "险种")
    private String insutype;
    /**
     * 医保结算时间
     */
    @ApiModelProperty(value = "医保结算时间",example = "医保结算时间")
    private String setlTime;
    public String getSetlTime() {
        return setlTime;
    }
    public void setSetlTime(String setlTime) {
        this.setlTime = setlTime;
    }
    public String getPsnNo() {
        return psnNo;

+ 9 - 15
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java

@ -204,23 +204,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "电子处方订单接收", notes = "电子处方订单接收")
    public ObjEnvelop electronicPrescriptionReceiving(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                                     @RequestParam(value = "outpatientId",required = true) String outpatientId)throws Exception{
        try {
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
            String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            }else {
                return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionReceiving(outpatientId));
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }else {
            return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionReceiving(outpatientId));
        }
    }

+ 2 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1198,7 +1198,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        prescriptionLogDO.setUserType(1);
                                        prescriptionLogDO.setDatajson("处方结算");
                                        prescriptionLogDao.save(prescriptionLogDO);
                                        prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());
                                        /*prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());*/
                                        BusinessOrderDO orderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getId());
                                        orderDO.setStatus(1);
                                        businessOrderDao.save(orderDO);
@ -1298,7 +1298,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                logger.info("更新门诊结算状态");
                                            }
                                        }
                                        prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());
                                        /*prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());*/
                                    }else {
                                        WlyyOutpatientDO wlyyOutpatientDO1 = outpatientDao.findByRealOrder(waitPayDetailVO.getRecipeNo());
                                        if (wlyyOutpatientDO1!=null){

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

@ -3668,5 +3668,44 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("/selectMedicareStatus")
    @ApiOperation(value = "查询是否有医保已结算", notes = "查询是否有医保已结算")
    public Envelop selectMedicareStatus(
            @ApiParam(name = "outpateintId", value = "outpateintId")
            @RequestParam(value = "outpateintId", required = false) String outpateintId) {
        try {
            return success("操作成功", prescriptionService.selectByOutpatientId(outpateintId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/testDzpj")
    @ApiOperation(value = "测试电子票据", notes = "测试电子票据")
    public Envelop testDzpj(
            @ApiParam(name = "pateintId", value = "pateintId")
            @RequestParam(value = "pateintId", required = false) String pateintId,
            @ApiParam(name = "realNo", value = "realNo")
            @RequestParam(value = "realNo", required = false) String realNo) {
        try {
            return success("操作成功", entranceService.dzpjServer(pateintId,realNo));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/testElectronicPrescriptionReceiving")
    @ApiOperation(value = "测试医保物流信息上传", notes = "测试医保物流信息上传")
    public Envelop electronicPrescriptionReceiving(
            @ApiParam(name = "outpateintId", value = "outpateintId")
            @RequestParam(value = "outpateintId", required = false) String outpateintId) {
        try {
            return success("操作成功", prescriptionService.electronicPrescriptionReceiving(outpateintId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
}