Browse Source

医保结算流程

wangzhinan 1 year ago
parent
commit
22a08df1b3
18 changed files with 517 additions and 22 deletions
  1. 1 1
      app/app-iot-server/pom.xml
  2. 7 2
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareNewService.java
  3. 1 1
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  4. 157 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  6. 9 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  7. 202 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  8. 7 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 28 0
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  10. 1 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  11. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  12. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java
  13. 28 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  14. 4 1
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  15. 29 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java
  16. 20 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  17. 13 6
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  18. 4 4
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 1 - 1
app/app-iot-server/pom.xml

@ -1,4 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
st<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

+ 7 - 2
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareNewService.java

@ -1346,6 +1346,11 @@ public class HealthCareNewService {
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        BaseDoctorDO doctorDO = new BaseDoctorDO();
        if (outpatientDO!=null){
            doctorDO = doctorDao.findById(outpatientDO.getDoctor());
        }
        JSONObject data = new JSONObject();
        data.put("region_code",ylzMedicalRelationDO.getRegionCode());//参保地区划代码
        data.put("name",ylzMedicalRelationDO.getName());//姓名
@ -1392,7 +1397,7 @@ public class HealthCareNewService {
                infoObj.put("his_dept_code",ylzMedicalMxDO.getHisDeptCode());//his内部科室编码
                infoObj.put("his_dept_name",ylzMedicalMxDO.getHisDeptName());//his内部科室名称
                infoObj.put("medical_per_name",ylzMedicalMxDO.getMedicalPerName());//医疗服务人员姓名
                infoObj.put("medical_per_id",ylzMedicalMxDO.getMedicalPerId());//医疗服务人员证件号码
                infoObj.put("medical_per_id",doctorDO.getAtddrNo());//医疗服务人员证件号码
                infoObj.put("limit_type",ylzMedicalMxDO.getLimitType());//限制范围类别
                infoObj.put("actg_date",DateUtil.dateToStr(ylzMedicalMxDO.getActgDate(),DateUtil.YYYYMMDD));//记帐日期
                infoObj.put("his_item_name",ylzMedicalMxDO.getHisItemName());//HIS院内项目名称
@ -2239,7 +2244,7 @@ public class HealthCareNewService {
    }
    public Boolean isHospitalFlag(){
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("medicalFlag");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("medicalFlagTest");
        if (hospitalSysDictDO!=null){
            if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                return true;

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

@ -2127,7 +2127,7 @@ public class HealthCareService {
    }
    public Boolean isHospitalFlag(){
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("medicalFlag");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("medicalFlagTest");
        if (hospitalSysDictDO!=null){
            if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                return true;

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

@ -14822,6 +14822,161 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                ylzMedicalRelationDO =  healthCareNewService.preSettlement(outpatientId);
                logger.info("医保预结算信息结束!");
                if (flag==1){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrl = healthCareNewService.getSettlementResultUrl(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrl",getSettlementResultUrl);
                }else if (flag==2){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
                }
                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 {
                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 if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            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);
                    }
                    /*String payDateStr = object1.getString("pay_date");
                    Date payDate = DateUtil.strToDate(payDateStr);
                    Date now = DateUtil.getDateShort(new Date());
                    if (payDate.compareTo(now) == 0) {
                        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 {
                    }
*/
                }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());
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                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);
                return object;
            }
           /* try {*/
                ylzMedicalRelationDO = ykyyEntranceService.getSettlementInfo(outpatientDO.getCardNo(), outpatientDO.getId());
          /*  } catch (Exception e) {
                throw new Exception(e.getMessage());
            }*/
            if (ylzMedicalRelationDO==null){
                throw new Exception("无待结算信息");
            }
            /*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","核对金额无误!");
            }*/
            if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
                logger.info("医保挂号开始!");
                String register = healthCareNewService.register(outpatientId);
                logger.info("医保挂号结束!");
                logger.info("医保费用明细上传开始!");
                String feeDetailUpload= healthCareNewService.feeDetailUpload(outpatientId);
                logger.info("医保费用明细上传结束!");
                logger.info("医保预结算信息开始!");
                ylzMedicalRelationDO =  healthCareNewService.preSettlement(outpatientId);
                logger.info("医保预结算信息结束!");
                if (flag==1){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrl = healthCareNewService.getSettlementResultUrl(outpatientId);
@ -15175,6 +15330,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHisSettleVO.setSfrq00(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
            wlyyHisSettleVO.setSfsj00("");
            wlyyHisSettleVO.setSfrxm0("");
            wlyyHisSettleVO.setYljzjj(ylzMedicalRelationDO.getYljzPay());
            wlyyHisSettleVO.setTcjjzf(ylzMedicalRelationDO.getTcjjPay());
            wlyyHisSettleVO.setBzjjzf(ylzMedicalRelationDO.getYljzPay());
            wlyyHisSettleVO.setGrzhye(ylzMedicalRelationDO.getAccountBalance());
            wlyyHisSettleVO.setYlzfje(ylzMedicalRelationDO.getOwnPay());

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

@ -670,6 +670,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文
            object.put("stock_amount",map.get("kcsl"));//库存
            object.put("gjbm",map.get("gjbm"));//国家编码
            object.put("gjmc",map.get("gjmc"));//国家编码名称
            array.add(object);
        }
        return array;

+ 9 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -3432,6 +3432,15 @@ public class EntranceService {
                sbs.append("<bqbm00>"+hisSettleVO.getBqbm00()+"</bqbm00>");
            }
            if (StringUtils.isNotEmpty(hisSettleVO.getTcjjzf())){
                sbs.append("<tcjjzf>"+hisSettleVO.getTcjjzf()+"</tcjjzf>");
            }
            if (StringUtils.isNotEmpty(hisSettleVO.getYljzjj())){
                sbs.append("<yljzjj>"+hisSettleVO.getYljzjj()+"</yljzjj>");
            }
            sbs.append("<isMedicalNewInterface>1</isMedicalNewInterface>");
            sbs.append("</root>]]></Msg>");

+ 202 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -19,6 +19,9 @@ import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
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.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -27,6 +30,9 @@ import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
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.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
@ -163,6 +169,12 @@ public class YkyyEntranceService {
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private YlzMedicailIcdDao ylzMedicailIcdDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -1576,10 +1588,12 @@ public class YkyyEntranceService {
                "yp.ypmc2 AS \"ypmc2\"," +
                "yp.gyffmc as \"gyffmc\"," +
                "yp.pzwh as \"pzwh\","+
                "yp.gjbm as \"gjbm\","+
                "yp.gjmc as \"gjmc\","+
                "yp.yfsb as \"yfsb\""+" FROM " +
                "V_hlwyy_MZ_YPXX yp where 1=1 and yp.yfsb in(3,6)  ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and lower(yp.ypdm) like '%"+ypdm.toLowerCase()+"%' ";
            sql+=" and lower(yp.ypxh) like '%"+ypdm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and lower(yp.ypmc) like '%"+ypmc.toLowerCase()+"%' ";
@ -2631,6 +2645,8 @@ public class YkyyEntranceService {
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        String outpatientId = wlyyPrescriptionVO.getOutpatientId();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
@ -2743,6 +2759,8 @@ public class YkyyEntranceService {
            }
        }
        outpatientDO.setRegisterNo(GHXH+"");
        outpatientDao.save(outpatientDO);
        Integer icd10Flag = 0;
        //诊断删除v_hlwys_mz_jzls
        if (!StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
@ -3670,6 +3688,17 @@ public class YkyyEntranceService {
        return null;
    }
    //获取调用hospital-entrance createSQLQuery
    public String getSql(String sql) throws Exception {
        Map<String, Object> params = new HashedMap();
        params.put("sql", sql);
        HttpResponse response = HttpUtils.doGet(url, params);
        String content = response.getContent();
        logger.info("sql:" + sql);
        logger.info("response:" + content);
        return content;
    }
    //判断居民是否建过档,没有就建档
    public JSONObject patientJDKH(String idcard, String name, String phoneNum, String medicare,String clinicId) throws Exception {
        JSONObject res = new JSONObject();
@ -3792,4 +3821,176 @@ public class YkyyEntranceService {
        return res;
    }
    //医保结算==================================
    public YlzMedicalRelationDO getSettlementInfo(String cardno, String outpatientId) throws Exception {
        YlzMedicalRelationDO ylzMedicalRelationDO =new YlzMedicalRelationDO();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
        WlyyPrescriptionDO wlyyPrescriptionDO = new WlyyPrescriptionDO();
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
        }else {
            throw new Exception("无待结算数据");
        }
        //查询余额
        String balance = "0";
       /* JSONObject jsonObject = selectCardInfo(cardno);
        if (jsonObject!=null){
            balance = jsonObject.getString("ZHYE");
        }*/
        String deptSql = " select code as \"code\",name as \"name\" from V_HLW_KSXX where code='"+wlyyPrescriptionDO.getDept()+"' ";
        String res = getSql(deptSql);
        String dept= wlyyPrescriptionDO.getDept();
        String deptName = "";
        if (StringUtils.isNoneBlank(res)) {
            JSONObject rs = JSONObject.parseObject(res);
            Integer status = rs.getInteger("status");
            if (status != null && status == 200) {
                JSONArray array = rs.getJSONArray("detailModelList");
                if (array!=null&&array.size()!=0){
                    JSONObject object = array.getJSONObject(0);
                    deptName = object.getString("name");
                }
            }
        }
        ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(wlyyPrescriptionDO.getDoctor());
        if (ylzMedicalRelationDO==null){
            ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO.setLogNo(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
            ylzMedicalRelationDO.setRelationCode(outpatientId);
            ylzMedicalRelationDO.setName(wlyyPrescriptionDO.getPatientName());
            ylzMedicalRelationDO.setTotalAmount(wlyyPrescriptionDO.getDrugFee()+"");
            ylzMedicalRelationDO.setPersonCash(wlyyPrescriptionDO.getDrugFee()+"");
            ylzMedicalRelationDO.setHisSerial(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setHisBillSerial(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setDeptCode(dept);
            ylzMedicalRelationDO.setDeptName(deptName);
            ylzMedicalRelationDO.setHisDeptCode(dept);
            ylzMedicalRelationDO.setHisDeptName(deptName);
            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(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setCardNo(outpatientDO.getCardNo());
            ylzMedicalRelationDO.setDate(wlyyPrescriptionDO.getCreateTime());
            ylzMedicalRelationDO.setBcwkje(wlyyPrescriptionDO.getDrugFee()+"");
        }else {
            ylzMedicalRelationDO.setLogNo(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setRelationCode(outpatientId);
            ylzMedicalRelationDO.setDataSource("54");
            ylzMedicalRelationDO.setDel(1);
            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
            ylzMedicalRelationDO.setName(wlyyPrescriptionDO.getPatientName());
            ylzMedicalRelationDO.setTotalAmount(wlyyPrescriptionDO.getDrugFee()+"");
            ylzMedicalRelationDO.setPersonCash(wlyyPrescriptionDO.getDrugFee()+"");
            ylzMedicalRelationDO.setHisSerial(outpatientDO.getRegisterNo());
            ylzMedicalRelationDO.setHisBillSerial(outpatientDO.getRealOrder());
            ylzMedicalRelationDO.setDeptCode(dept);
            ylzMedicalRelationDO.setDeptName(deptName);
            ylzMedicalRelationDO.setHisDeptCode(dept);
            ylzMedicalRelationDO.setHisDeptName(deptName);
            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(wlyyPrescriptionDO.getRealOrder());
            ylzMedicalRelationDO.setCardNo(outpatientDO.getCardNo());
            ylzMedicalRelationDO.setDate(wlyyPrescriptionDO.getCreateTime());
            ylzMedicalRelationDO.setBcwkje(wlyyPrescriptionDO.getDrugFee()+"");
        }
        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
        ylzMedicailMxDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
      /*  //获取结算明细
        String infoSql = "select * from v_ms_dd02 where cfsb ='"+wlyyPrescriptionDO.getRealOrder()+"' ";
        String infoRes = getSql(infoSql);*/
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
        List<YlzMedicalMxDO> mxDOList = new ArrayList<>();
        for (WlyyPrescriptionInfoDO infoDO:wlyyPrescriptionInfoDOS){
            YlzMedicalMxDO medicalMxDO = new YlzMedicalMxDO();
            medicalMxDO.setDel(1);
            medicalMxDO.setMedicalId(ylzMedicalRelationDO.getId());
            medicalMxDO.setCreateTime(new Date());
            medicalMxDO.setInvoiceType("01");
            medicalMxDO.setItemName(infoDO.getGjmc());
            medicalMxDO.setHisDetailSn(infoDO.getHisCode()+"");
            medicalMxDO.setItemCode(infoDO.getGjbm());
            medicalMxDO.setPrescriptionCode(wlyyPrescriptionDO.getRealOrder());
            medicalMxDO.setChargeUnit(infoDO.getUnit());
            medicalMxDO.setSpecificationType(infoDO.getSpecification());
            medicalMxDO.setAmount(infoDO.getQuantity());
            medicalMxDO.setPrice(infoDO.getPackRetprice()+"");
            medicalMxDO.setPrescriptionCode(wlyyPrescriptionDO.getRealOrder());
            medicalMxDO.setDosageForm(infoDO.getDosage());//剂型
            medicalMxDO.setPrescriptionDate(wlyyPrescriptionDO.getCreateTime());
            medicalMxDO.setActgDate(wlyyPrescriptionDO.getCreateTime());
            medicalMxDO.setClerkDays(wlyyPrescriptionDO.getCreateTime());
            medicalMxDO.setPeopleType(null);
            medicalMxDO.setSingleDose(infoDO.getDosage()+infoDO.getUnit());
            medicalMxDO.setUseFrequency(infoDO.getFrequency());
            medicalMxDO.setMedicationDays(infoDO.getDays());
            medicalMxDO.setMedicalWay(infoDO.getSupplyName());
            medicalMxDO.setDeptCode(dept);
            medicalMxDO.setDeptName(deptName);
            medicalMxDO.setHisDeptCode(dept);
            medicalMxDO.setHisDeptName(deptName);
            medicalMxDO.setMedicalPerId(doctorDO.getIdcard());
            medicalMxDO.setMedicalPerName(doctorDO.getName());
            if (StringUtils.isNoneBlank(infoDO.getSfybxm())){
                medicalMxDO.setLimitType(infoDO.getSfybxm());
            }
            medicalMxDO.setHisItemCode(infoDO.getGjbm());
            medicalMxDO.setHisItemName(infoDO.getGjmc());
            medicalMxDO.setTotalMoney((Integer.parseInt(infoDO.getQuantity())*infoDO.getPackRetprice())+"");
            medicalMxDO = ylzMedicailMxDao.save(medicalMxDO);
            mxDOList.add(medicalMxDO);
        }
        Integer itemCount = wlyyPrescriptionInfoDOS.size();
        ylzMedicalRelationDO.setItemCount(itemCount+"");
        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
        List<YlzMedicalIcdDO> icdDOS = new ArrayList<>();
        ylzMedicailIcdDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
        //获取诊断
        for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
            YlzMedicalIcdDO icdDO = new YlzMedicalIcdDO();
            icdDO.setCreateTime(new Date());
            icdDO.setDel(1);
            icdDO.setDiseaseCodeIcd10(diagnosisDO.getCode());
            icdDO.setDiseaseNameIcd10(diagnosisDO.getName());
            icdDO.setDiseaseType(diagnosisDO.getType()+"");
            icdDO.setDiseaseOrder(diagnosisDO.getType()+"");
            icdDO.setMedicalId(ylzMedicalRelationDO.getId());
            icdDO = ylzMedicailIcdDao.save(icdDO);
            icdDOS.add(icdDO);
        }
        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOS);
        return  ylzMedicalRelationDO;
    }
}

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

@ -941,7 +941,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                        wlyyOutpatientDO.setPayStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                        prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                        logger.info("图文咨询发送===");
                        BaseDoctorDO baseDoctorDO= doctorDao.findById(wlyyOutpatientDO.getDoctor());
                        if (baseDoctorDO!=null){
                            ykyySMSService.sendSmsByTempcode("consult_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                            prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                        }
                        if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            type="1";
                        }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){

+ 28 - 0
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -160,6 +160,34 @@ public class YkyySMSService {
                        }
                    }
                }
            }else if ("consult_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息专家咨询
                smsTemplateDO = smsTemplateDao.findByClientId("consult_remind");
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }
                }
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
                smsTemplateDO = smsTemplateDao.findByClientId("message_remind_paitent");

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -624,7 +624,7 @@ public class WxTemplateService {
                        config.setKeyword2(DateUtil.dateToStrLong(new Date()));
                        if (StringUtils.isNoneBlank(config.getPagepath())){
                            String path = URLEncoder.encode(url.replace("https://intel.yanketong.com/ims-wx/index.html#/",""));
                            config.setPagepath(config.getPagepath()+path);
                            config.setPagepath("pages/patient/index?redirectUrl="+path);
                        }
                        config.setUrl(url);
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);

+ 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;

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

@ -413,7 +413,7 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="date")
    @Column(name="reality_date")
    public Date getDate() {
        return date;
    }

+ 28 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -169,6 +169,34 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
     */
    private String sfybxm;
    /**
     * 国家编码
     */
    private String gjbm;
    /**
     * 国家编码名称
     */
    private String gjmc;
    @Column(name = "gjbm")
    public String getGjbm() {
        return gjbm;
    }
    public void setGjbm(String gjbm) {
        this.gjbm = gjbm;
    }
    @Column(name = "gjmc")
    public String getGjmc() {
        return gjmc;
    }
    public void setGjmc(String gjmc) {
        this.gjmc = gjmc;
    }
    @Column(name = "sfybxm")
    public String getSfybxm() {
        return sfybxm;

+ 4 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.order;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -15,8 +16,10 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_business_order_pay")
/*
@SequenceGenerator(name="id_generated", sequenceName="SEQ_BASE_BUSINESS_ORDER_PAY")
public class BusinessOrderDO extends IntegerIdentityEntity {
*/
public class BusinessOrderDO extends UuidIdentityEntity {
    private String patient;//居民code
    private String patientName;//居民名字

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

@ -244,6 +244,35 @@ public class WlyyHisSettleVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "特殊病种",example = "特殊病种")
    private String bqbm00;
    /**
     * 医疗救助基金
     */
    @ApiModelProperty(value = "医疗救助基金",example = "医疗救助基金")
    private String yljzjj;
    /**
     * 统筹基金支付
     */
    @ApiModelProperty(value = "统筹基金支付",example = "统筹基金支付")
    private String tcjjzf;
    public String getYljzjj() {
        return yljzjj;
    }
    public void setYljzjj(String yljzjj) {
        this.yljzjj = yljzjj;
    }
    public String getTcjjzf() {
        return tcjjzf;
    }
    public void setTcjjzf(String tcjjzf) {
        this.tcjjzf = tcjjzf;
    }
    public String getBqbm00() {
        return bqbm00;
    }

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

@ -155,6 +155,10 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "眼科hisCode", example = "眼科hisCode")
    private Integer HisCode;
    private String gjbm;
    private String gjmc;
    private String comm;
@ -162,6 +166,22 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    private String sfybxm;
    public String getGjbm() {
        return gjbm;
    }
    public void setGjbm(String gjbm) {
        this.gjbm = gjbm;
    }
    public String getGjmc() {
        return gjmc;
    }
    public void setGjmc(String gjmc) {
        this.gjmc = gjmc;
    }
    public String getSfybxm() {
        return sfybxm;
    }

+ 13 - 6
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -1122,13 +1122,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        String isNeedGeet= "0";//1需要 0不需要
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO1= wlyyhospitalSysdictDao.findDictById("isNeedGeet");
        if (wlyyHospitalSysDictDO1!=null){
            isNeedGeet=wlyyHospitalSysDictDO1.getDictValue();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String geetestChallenge = parameters.get("geetestChallenge");
            String geetestValidate = parameters.get("geetestValidate");
            String geetestSeccode = parameters.get("geetestSeccode");
            JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1".equalsIgnoreCase(isDoctor)?"2":"1");
            if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
                throw new  Exception("验证失败");
            if ("1".equalsIgnoreCase(isNeedGeet)) {
                String geetestChallenge = parameters.get("geetestChallenge");
                String geetestValidate = parameters.get("geetestValidate");
                String geetestSeccode = parameters.get("geetestSeccode");
                JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1".equalsIgnoreCase(isDoctor)?"2":"1");
                if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
                    throw new  Exception("验证失败");
                }
            }
        }
        //验证请求间隔超时,防止频繁获取验证码

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

@ -494,8 +494,8 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
  im_list_get: http://127.0.0.1:3000/
  data_base_name: hlwyy
# 上传文件临时路径配置
FileTempPath:
@ -509,8 +509,8 @@ es:
    Statistics: hlw_quota_prod
  type:
    Statistics: hlw_quota_prod
  host:  http://192.168.33.198:9200
  tHost: 192.168.33.198:9300
  host:  http://192.168.33.67:9200
  tHost: 192.168.33.67:9300
  clusterName: jkzl
  securityUser: lion:jkzlehr
  user: lion