Browse Source

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
#	common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
wangzhinan 3 years ago
parent
commit
866a932a44

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

@ -12613,7 +12613,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setPatientId(patientId);
                baseNatAppointmentDO.setIsSuccess("0");
                baseNatAppointmentDO.setCardNoType(cardNoType);
                baseNatAppointmentDO.setPayStatus("0");
                if(itemPrice.equalsIgnoreCase("0")){
                    baseNatAppointmentDO.setPayStatus("1");
                }else {
                    baseNatAppointmentDO.setPayStatus("0");
                }
                baseNatAppointmentDO.setCreateTime(new Date());
                baseNatAppointmentDO.setMobile(mobile);
                baseNatAppointmentDO.setInspectionCode(chargeCode);
@ -12631,61 +12635,84 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                logger.info("BaseNatAppointmentDO保存结束"+baseNatAppointmentDO.getId());
                //添加订单
                BusinessOrderDO businessDO = new BusinessOrderDO();
                businessDO.setPatient(consumer);
                businessDO.setPatientName(basePatientDO.getName());
                businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessDO.setCreateTime(new Date());
                businessDO.setStatus(0);
                businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
                businessDO.setRelationName("核酸检测订单");
                businessDO.setOrderCategory("6");
                businessDO.setOrderType(12);
                businessDO.setPayPrice(natFee);
                businessDO.setRematk("核酸检测订单");
                businessDO.setDescription("核酸检测订单");
                businessDO.setPayType(1);
                businessDO.setUpdateTime(new Date());
                businessDO=businessOrderDao.save(businessDO);
                String openId="";
                List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
                if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
                    openId=basePatientWechatDo.get(0).getOpenid();
                }
                //亿同支付创建订单
                com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
                orderObj.put("payType",1);
                orderObj.put("tradeNo",businessDO.getOrderNo());
                orderObj.put("openId",openId);
                orderObj.put("name",name);
                orderObj.put("idNo",cardNo.trim());
                Map mapHis=tasyNatService.getPatientHisId(cardNo.trim(),mediaCard.trim());
                orderObj.put("patientId",mapHis.get("Patientid").toString());
                orderObj.put("mobile",mapHis.get("MobilePhone").toString());
                //orderObj.put("socialCard","");
                orderObj.put("icCard",mediaCard);
                BigDecimal b = new BigDecimal(itemPrice);
                b=b.setScale(2, BigDecimal.ROUND_DOWN);
                System.out.println("amount"+b);
                orderObj.put("amount",b);
                String orderRes=tasyNatService.placeOrder(orderObj);
                if (StringUtils.isNoneBlank(orderRes)){
                    com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
                    if (jsonObject!=null){
                        if("0".equalsIgnoreCase(jsonObject.getString("code"))){
                            com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
                            businessDO.setTraceNo(dataObj.getString("orderNo"));
                            businessDO.setRematk(dataObj.toJSONString());
                            businessDO=businessOrderDao.save(businessDO);
                if(!itemPrice.equalsIgnoreCase("0")){
                    //添加订单
                    BusinessOrderDO businessDO = new BusinessOrderDO();
                    businessDO.setPatient(consumer);
                    businessDO.setPatientName(basePatientDO.getName());
                    businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                    businessDO.setCreateTime(new Date());
                    businessDO.setStatus(0);
                    businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
                    businessDO.setRelationName("核酸检测订单");
                    businessDO.setOrderCategory("6");
                    businessDO.setOrderType(12);
                    businessDO.setPayPrice(natFee);
                    businessDO.setRematk("核酸检测订单");
                    businessDO.setDescription("核酸检测订单");
                    businessDO.setPayType(1);
                    businessDO.setUpdateTime(new Date());
                    businessDO=businessOrderDao.save(businessDO);
                    String openId="";
                    List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
                    if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
                        openId=basePatientWechatDo.get(0).getOpenid();
                    }
                    //亿同支付创建订单
                    com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
                    orderObj.put("payType",1);
                    orderObj.put("tradeNo",businessDO.getOrderNo());
                    orderObj.put("openId",openId);
                    orderObj.put("name",name);
                    orderObj.put("idNo",cardNo.trim());
                    Map mapHis=tasyNatService.getPatientHisId(cardNo.trim(),mediaCard.trim());
                    orderObj.put("patientId",mapHis.get("Patientid").toString());
                    orderObj.put("mobile",mapHis.get("MobilePhone").toString());
                    //orderObj.put("socialCard","");
                    orderObj.put("icCard",mediaCard);
                    BigDecimal b = new BigDecimal(itemPrice);
                    b=b.setScale(2, BigDecimal.ROUND_DOWN);
                    System.out.println("amount"+b);
                    orderObj.put("amount",b);
                    String orderRes=tasyNatService.placeOrder(orderObj);
                    if (StringUtils.isNoneBlank(orderRes)){
                        com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
                        if (jsonObject!=null){
                            if("0".equalsIgnoreCase(jsonObject.getString("code"))){
                                com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
                                businessDO.setTraceNo(dataObj.getString("orderNo"));
                                businessDO.setRematk(dataObj.toJSONString());
                                businessDO=businessOrderDao.save(businessDO);
                            }
                        }
                    }
                }
                try {
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszftx",baseNatAppointmentDO.getId().toString());
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hsyycg",baseNatAppointmentDO.getId().toString());
                }catch (Exception e){
                    e.printStackTrace();
                    try {
                        tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszftx",baseNatAppointmentDO.getId().toString());
                        tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hsyycg",baseNatAppointmentDO.getId().toString());
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }else {
                    com.alibaba.fastjson.JSONObject chargeObj=new com.alibaba.fastjson.JSONObject();
                    chargeObj.put("hisTradeNo",baseNatAppointmentDO.getRealOrder());
                    chargeObj.put("icCardNo",baseNatAppointmentDO.getMedicare().trim());
                    chargeObj.put("patientName",baseNatAppointmentDO.getName());
                    //调用扣费接口
                    String feeRes=tasyNatService.ChargenucleicBill(chargeObj);
                    com.alibaba.fastjson.JSONObject feeObj = com.alibaba.fastjson.JSONObject.parseObject(feeRes);
                    if (feeObj!=null){
                        if ("1".equalsIgnoreCase(feeObj.getString("ReturnCode"))){
                            com.alibaba.fastjson.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);
                                }
                            }
                        }
                    }
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszfcgtx",baseNatAppointmentDO.getId().toString());
                }
                logger.info("开单结束");
                returnMap.put("msg","预约成功");