ソースを参照

Merge branch 'baseCopy1' of wangjun/wlyy2.0 into dev

wangzhinan 3 年 前
コミット
03a9ce3a2b

+ 18 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -73,7 +73,16 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        MixEnvelop mixEnvelop = new MixEnvelop();
        try{
        BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        BasePatientDO basePatientDO = null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(phoneNum,"1");
            if (listpatients!=null&&listpatients.size()>0){
                basePatientDO=listpatients.get(0);
            }
        }else {
            basePatientDO= basePatientDao.findByIdcard(idCard);
        }
        List<BasePatientDO> list = basePatientDao.findByMobile(phoneNum);
        if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            if (list!=null&&list.size()>0&&basePatientDO!=null){
@ -380,9 +389,14 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                            System.out.println("==="+jsonArray.get(i).toString());
                            if (StringUtils.isNotEmpty(jsonObject1.getString("IDCARD"))){
                                System.out.println("同步的身份证号:"+jsonObject1.getString("IDCARD"));
                                BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(jsonObject1.getString("IDCARD"),"1");
                                if (patientDO==null){
                                    patientDO = new BasePatientDO();
                                BasePatientDO patientDO = null;
                                if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                                    List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(jsonObject1.getString("TEL"),"1");
                                    if (listpatients!=null&&listpatients.size()>0){
                                        patientDO=listpatients.get(0);
                                    }
                                }else {
                                    patientDO= basePatientDao.findByIdcard(jsonObject1.getString("IDCARD"));
                                }
                                patientDO.setMobile(jsonObject1.getString("TEL"));
                                if(StringUtils.isNotBlank(jsonObject1.getString("BIRTHDAY"))){

ファイルの差分が大きいため隠しています
+ 6 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java


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

@ -11756,6 +11756,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if ("0".equalsIgnoreCase(returnCode)){
                        returnMap.put("msg",object.getString("data"));
                        returnMap.put("status","-1");
                        tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        return  returnMap;
                    }else {
                        flag = true;
@ -11835,6 +11836,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                orderObj.put("openId",openId);
                orderObj.put("name",name);
                orderObj.put("idNo",cardNo);
                String hisPatientId=tasyNatService.getPatientHisId(cardNo,mediaCard);
                orderObj.put("hisPatientId",hisPatientId);
                orderObj.put("mediaCard",mediaCard);
                BigDecimal b = new BigDecimal(itemPrice);
                b=b.setScale(2, BigDecimal.ROUND_DOWN);
                System.out.println("amount"+b);
@ -12263,13 +12267,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            //取消号源
                            tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName());
                            baseNatAppointmentDO.setIsSuccess("-1");
                            baseNatAppointmentDO.setCancelReson("患者本人取消");
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");
                            String natCancel=tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName());
                            com.alibaba.fastjson.JSONObject jsonObject1 = JSON.parseObject(natCancel);
                            String returnCode=jsonObject1.getString("ReturnCode");
                            if ("1".equalsIgnoreCase(returnCode)&&"true".equalsIgnoreCase(isSuccess)){
                                System.out.println("11111");
                                baseNatAppointmentDO.setIsSuccess("-1");
                                baseNatAppointmentDO.setCancelReson("患者本人取消");
                                baseNatAppointmentDO.setCancelTime(new Date());
                                baseNatAppointmentDO.setCancelBy(patientId);
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                res="success";
                            }
                            /*String backMsg="";
                            if ("0".equalsIgnoreCase(returnCode)){
                                backMsg+=jsonObject1.getString("ReturnMsg");
                            }
                            if (!"true".equalsIgnoreCase(isSuccess)){
                                String data=jsonObject1.getString("data");
                                backMsg+=jsonObject1.getString("ReturnMsg");
                            }*/
                        }
                    }

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

@ -25,6 +25,7 @@ import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -336,6 +337,7 @@ public class TasyNatService {
        xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        saveHttpLog("ChargenucleicBill",jsonObject.toString(),json,"ChargenucleicBill");
        logger.info("ChargenucleicBill json:"+json);
        return json;
    }
@ -540,7 +542,7 @@ public class TasyNatService {
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key3.put("value",wxTemplateConfigDO1.getKeyword3());
            key3.put("color",wxTemplateConfigDO1.getKeyword6());
            key4.put("value",baseNatAppointmentD0.getDoctorName());
            key4.put("value",baseNatAppointmentD0.getChargeAmount());
            key4.put("color",wxTemplateConfigDO1.getKeyword6());
            key5.put("value",baseNatAppointmentD0.getVoucherNo());
            key5.put("color",wxTemplateConfigDO1.getKeyword6());
@ -798,6 +800,7 @@ public class TasyNatService {
        logger.info("QueryApplyInfo json:"+json);
        return json;
    }
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
@ -809,6 +812,11 @@ public class TasyNatService {
                        baseNatAppointmentDO.setVoucherNo(voucherNo);
                        if ("已扣费".equalsIgnoreCase(jsonObject.getString("Status"))){
                            baseNatAppointmentDO.setPayStatus("1");
                            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                            if (businessOrderDO!=null){
                                businessOrderDO.setStatus(1);
                                businessOrderDao.save(businessOrderDO);
                            }
                        }
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                    }
@ -830,7 +838,12 @@ public class TasyNatService {
            if (wechatList!=null&&wechatList.size()>0){
                openId=wechatList.get(0).getOpenid();
            }
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            if (StringUtils.isNoneBlank(businessOrderDO.getOrderNo())){
                String orderNo= businessOrderDO.getOrderNo();
                String newOrder="HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100;
                businessOrderDO.setOrderNo(newOrder);
                businessOrderDO.setHistoryOrder(orderNo+","+newOrder);
            }
            com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
            orderObj.put("payType",1);
            orderObj.put("tradeNo",businessOrderDO.getOrderNo());
@ -919,4 +932,106 @@ public class TasyNatService {
        logger.info("hdrQueryDataWS json:"+json);
        return json;
    }
    public  Map checkBalance(String relationCode) throws  Exception{
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("MzBalance");
        String tmpBalance="";
        if (wlyyHospitalSysDictDO!=null){
            tmpBalance=wlyyHospitalSysDictDO.getDictValue();
        }
        String res = findHisPatientCard(baseNatAppointmentDO.getCardNo());
        String mediacard=baseNatAppointmentDO.getMedicare();
        Map result=new HashMap();
        if (StringUtils.isNoneBlank(res)){
            JSONObject jsonObject = JSON.parseObject(res);
            if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
                String patients=jsonObject.getString("patients");
                if (patients.contains("[")){
                    JSONArray jsonArray = JSON.parseArray(patients);
                    if (jsonArray != null && jsonArray.size() > 0) {
                        for (int i = 0; i < jsonArray.size(); i++) {
                            JSONObject child = jsonArray.getJSONObject(i);
                            if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
                                String MzBalance = child.getString("MzBalance");
                                if (StringUtils.isNoneBlank(tmpBalance)){
                                    MzBalance=tmpBalance;
                                }
                                BigDecimal b = new BigDecimal(MzBalance);
                                b=b.setScale(2, BigDecimal.ROUND_DOWN);
                                System.out.println("MzBalance====="+MzBalance);
                                if (StringUtils.isNoneBlank(MzBalance) && b.compareTo(new BigDecimal("0")) < 0) {
                                    result.put("msgCode", "-1");
                                    result.put("msg", "余额不足");
                                    return result;
                                }
                            }
                        }
                    }
                }else {
                    try {
                        JSONObject jsonObject1= JSONObject.parseObject(patients);
                        if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
                            String MzBalance = jsonObject1.getString("MzBalance");
                            if (StringUtils.isNoneBlank(tmpBalance)){
                                MzBalance=tmpBalance;
                            }
                            System.out.println("MzBalance====="+MzBalance);
                            BigDecimal b = new BigDecimal(MzBalance);
                            b=b.setScale(2, BigDecimal.ROUND_DOWN);
                            System.out.println("MzBalance====="+b);
                            if (StringUtils.isNoneBlank(MzBalance) && b.compareTo(new BigDecimal("0")) < 0) {
                                result.put("msgCode", "-1");
                                result.put("msg", "余额不足");
                                return result;
                            }
                            return result;
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                        result.put("msgCode","-1000");
                        result.put("msg","json格式验证失败");
                    }
                }
            }
        }
        result.put("msgCode","200");
        result.put("msg","验证通过");
        return  result;
    }
    public String getPatientHisId(String idcard,String mediacard) throws Exception{
        String res = findHisPatientCard(idcard);
        JSONObject jsonObject = JSON.parseObject(res);
        if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
            String patients=jsonObject.getString("patients");
            if (patients.contains("[")) {
                JSONArray jsonArray = JSON.parseArray(patients);
                if (jsonArray != null && jsonArray.size() > 0) {
                    for (int i = 0; i < jsonArray.size(); i++) {
                        JSONObject child = jsonArray.getJSONObject(i);
                        if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
                            String Patientid = child.getString("Patientid");
                            return Patientid;
                        }
                    }
                }
            } else {
                try {
                    JSONObject jsonObject1 = JSONObject.parseObject(patients);
                    if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
                        String Patientid = jsonObject1.getString("Patientid");
                        return Patientid;
                    }
                } catch (Exception e) {
                   e.printStackTrace();
                }
            }
        }
        return "";
    }
}

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

@ -1206,3 +1206,11 @@ CREATE TABLE `voluntary_recruitment_people` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业人员表';
alter table base_job_category  add code varchar(50);
alter table base_nat_appointment  add oder_num varchar(50);
alter table base_business_order_pay  add history_order varchar(1000);

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -54,6 +54,15 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String ykOrderId;
    private String traceNo;//支付平台的订单号
    private Long lastPayTime;//订单截至支付日期 13位时间戳
    private String historyOrder;
    @Column(name = "history_order")
    public String getHistoryOrder() {
        return historyOrder;
    }
    public void setHistoryOrder(String historyOrder) {
        this.historyOrder = historyOrder;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)

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

@ -2258,6 +2258,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            if ("ChargenucleicBill".equalsIgnoreCase(api)){
                return success("操作成功",tasyNatService.ChargenucleicBill(jsonObject));
            }
            if ("QueryApplyInfo".equalsIgnoreCase(api)){
                return success("操作成功",tasyNatService.QueryApplyInfo(jsonObject.getString("realOrder")));
            }
            return success("");
        } catch (Exception e){
            return  failedException(e);
@ -2318,6 +2321,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                 @RequestParam(value = "traceNo", required = false) String traceNo,
                             @ApiParam(name = "msg", value = "msg", required = false)
                                 @RequestParam(value = "msg", required = false) String msg) throws Exception {
        System.out.println(" "+code);
        System.out.println("进入回调orderNo="+orderNo);
        System.out.println("进入回调traceNo="+traceNo);
        System.out.println("进入回调msg="+msg);
        if ("0".equalsIgnoreCase(code)){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByTraceNoAndorderNo(orderNo,traceNo);
            if (businessOrderDO!=null){
@ -2326,10 +2333,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                String res = tasyNatService.orderStatus(requestObj);
                JSONObject orderStatus=JSONObject.parseObject(res);
                if ("0".equalsIgnoreCase(orderStatus.getString("code"))){
                    JSONObject data = orderStatus.getJSONObject("data");
                    if ("1".equalsIgnoreCase(data.getString("payOrderStatus"))){
                        businessOrderDO.setStatus(1);
                        businessOrderDao.save(businessOrderDO);
                    System.out.println("开始同步状态");
                        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.valueOf(businessOrderDO.getRelationCode()));
                        if (baseNatAppointmentDO!=null){
                            if (baseNatAppointmentDO.getPayStatus().equalsIgnoreCase("0")){
@ -2342,22 +2346,33 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                JSONObject feeObj = JSONObject.parseObject(feeRes);
                                if (feeObj!=null){
                                    if ("1".equalsIgnoreCase(feeObj.getString("ReturnCode"))){
                                        String voucherNo = feeObj.getString("ApplyNo");
                                        baseNatAppointmentDO.setVoucherNo(voucherNo);
                                        JSONObject ApplyInfoObj = JSON.parseObject(feeObj.getString("ApplyInfo"));
                                        if (ApplyInfoObj!=null){
                                            String voucherNo = ApplyInfoObj.getString("ApplyNo");
                                            if(org.apache.commons.lang3.StringUtils.isNoneBlank(voucherNo)){
                                                System.out.println("ApplyNo:"+voucherNo);
                                                baseNatAppointmentDO.setVoucherNo(voucherNo);
                                            }
                                        }
                                    }else{
                                        return feeObj.getString("ReturnMsg");
                                    }
                                }else{
                                    return  "FAILED";
                                }
                                baseNatAppointmentDO.setPayStatus("1");
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),"hszfcgtx",baseNatAppointmentDO.getName(),baseNatAppointmentDO.getId().toString());
                                businessOrderDO.setStatus(1);
                                businessOrderDao.save(businessOrderDO);
                                tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszfcgtx",baseNatAppointmentDO.getId().toString());
                            }
                            return "SUCCESS";
                    }
                }
                }
            }
        }
        return  "failed";
        return  "FAILED";
    }
    @GetMapping("/saveNatAppointment")
@ -2522,7 +2537,17 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/checkBalance")
    public Envelop checkBalance(
            @ApiParam(name = "relationCode", value = "relationCode")
            @RequestParam(value = "relationCode",required = false)String relationCode) throws Exception {
        try {
            return success(tasyNatService.checkBalance(relationCode));
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
}