浏览代码

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

yeshijie 4 年之前
父节点
当前提交
02120bfe40
共有 29 个文件被更改,包括 1587 次插入631 次删除
  1. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  2. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNatAppointmentDao.java
  3. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  4. 414 485
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 6 10
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 267 6
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  7. 1 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/MqSdkUtil.java
  8. 11 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 8 1
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  10. 168 0
      business/base-service/src/main/java/com/yihu/jw/utils/AES.java
  11. 3 4
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  12. 29 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java
  13. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkEmrJcsqDO.java
  14. 325 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj01DO.java
  15. 46 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj02DO.java
  16. 40 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  17. 3 3
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  18. 15 6
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  19. 23 3
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java
  20. 8 2
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  21. 1 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/followup/FollowUpService.java
  22. 57 6
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  23. 4 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  24. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java
  25. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  26. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  27. 64 40
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  28. 42 47
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  29. 37 3
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

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

@ -90,6 +90,10 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                }
                }
                basePatientDO.setMobile(phoneNum);
                basePatientDO.setMobile(phoneNum);
            }
            }
        }else{
            if(basePatientDO==null){
                basePatientDO = new BasePatientDO();
            }
        }
        }
        Map<String,Object> resultMap = new HashMap<>();
        Map<String,Object> resultMap = new HashMap<>();
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);

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

@ -13,6 +13,9 @@ public interface BaseNatAppointmentDao extends PagingAndSortingRepository<BaseNa
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 ")
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 ")
    List<BaseNatAppointmentDO> findByPayStatus();
    List<BaseNatAppointmentDO> findByPayStatus();
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    List<BaseNatAppointmentDO> findPayStatusByPatientId(String patientId);
    @Query("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")
    @Query("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")
    List<BaseNatAppointmentDO> findByRealOrderList(String realOrder);
    List<BaseNatAppointmentDO> findByRealOrderList(String realOrder);

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

@ -53,7 +53,7 @@ public class PayInfoNoticeService {
        return null;
        return null;
    }
    }
    public String pushPrescriptionPayAndHsjc(String patient,String doctorName,String orderNo,String id,String total,String title,String url){
    public String pushPrescriptionPayAndHsjc(String patient,String doctorName,String orderNo,String id,String total,String title,String url,String realOrder){
        BasePatientDO patientDO = patientDao.findById(patient);
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
        if (patientDO!=null){
            String userName = patientDO.getName();
            String userName = patientDO.getName();
@ -62,7 +62,8 @@ public class PayInfoNoticeService {
            if (!StringUtils.isNotBlank(url)){
            if (!StringUtils.isNotBlank(url)){
                url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+id;
                url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+id;
            }
            }
            String remark = "结算方式:微信结算" +
            String remark = "结算方式:微信结算 \r\n" +
                    "发票流水号:"+realOrder+"\r\n"+
                    "点击查看核酸预约开单信息";
                    "点击查看核酸预约开单信息";
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,"0",total,orderNo,remark);
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,"0",total,orderNo,remark);
@ -70,6 +71,7 @@ public class PayInfoNoticeService {
        return null;
        return null;
    }
    }
    /**
    /**
     * 支付成功提醒
     * 支付成功提醒
     * @param userName 用户名 (不能为空)
     * @param userName 用户名 (不能为空)

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

@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.wx.*;
@ -78,12 +79,9 @@ import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.GenerateUserSig;
import com.yihu.jw.utils.PinYinUtils;
import com.yihu.jw.utils.*;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
@ -274,6 +272,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private YxTokenMappingDao yxTokenMappingDao;
    private YxTokenMappingDao yxTokenMappingDao;
    @Autowired
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
@ -8265,7 +8265,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if ("0".equals(rsCode)) {
                        if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                            free = res.getString("@total_charge");
                        }
                        }
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
                    }else {
                    }else {
                        throw new Exception(map.get("mes").toString());
                        throw new Exception(map.get("mes").toString());
                    }
                    }
@ -8363,7 +8363,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                if ("0".equals(rsCode)) {
                                if ("0".equals(rsCode)) {
                                    free = res.getString("@total_charge");
                                    free = res.getString("@total_charge");
                                }*/
                                }*/
                                ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, "", "");
                                ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, "", "","WX_PUB");
                            }
                            }
                        }
                        }
                    } catch (Exception e) {
                    } catch (Exception e) {
@ -10458,95 +10458,77 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return null;
        return null;
    }
    }
    public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
    public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
        BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
        baseNatAppointmentDO.setMedicare(mediaCard);
        baseNatAppointmentDO.setName(name);
        baseNatAppointmentDO.setCardNo(cardNo);
        baseNatAppointmentDO.setCardType(cardType);
        baseNatAppointmentDO.setAddress(address);
        baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
        baseNatAppointmentDO.setCityName(cityName);
        baseNatAppointmentDO.setFirstJobCode(firstJobCode);
        baseNatAppointmentDO.setFirstJobName(firstJobName);
        baseNatAppointmentDO.setSecondJobCode(secondJobCode);
        baseNatAppointmentDO.setSecondJobName(secondJobName);
        baseNatAppointmentDO.setProvinceName(provinceName);
        baseNatAppointmentDO.setTownName(townName);
        baseNatAppointmentDO.setStreetName(streetName);
        baseNatAppointmentDO.setPatientId(patientId);
        baseNatAppointmentDO.setIsSuccess("0");
        baseNatAppointmentDO.setPayStatus("0");
        baseNatAppointmentDO.setCreateTime(new Date());
        baseNatAppointmentDO.setMobile(mobile);
        baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
        baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
        baseNatAppointmentDO.setIcdCode("Z00.000");
        baseNatAppointmentDO.setChargeCode("361322");
        baseNatAppointmentDO.setWinNo("6");
        baseNatAppointmentDO.setDept("3150000");
        baseNatAppointmentDO.setDeptName("感染疾病科");
        baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType) throws Exception {
        Map returnMap = new HashMap();
        Map returnMap = new HashMap();
        net.sf.json.JSONObject jsondate = new JSONObject();
        jsondate.put("checkPart","鼻/咽拭子");
        jsondate.put("cardNo",mediaCard);
        jsondate.put("chargeFlag","2");
        jsondate.put("chargeCode","361322");
        jsondate.put("icdCode","Z00.000");
        jsondate.put("socialNo",cardNo);
        jsondate.put("tellPhone",mobile);
        jsondate.put("address1",provinceName);
        jsondate.put("address2",cityName);
        jsondate.put("address3",townName);
        jsondate.put("address4",streetName);
        jsondate.put("address5",2);
        jsondate.put("area",address);
        jsondate.put("winNo",6);
        jsondate.put("target",2);
        jsondate.put("quantity",1);
        Map<String,Object> map = findRandomDoctor();
        net.sf.json.JSONObject rs = new JSONObject();
        if (map!=null){
            //先进行核算检测预约
            String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,demoFlag);
            com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
            logger.info("核酸检测预约结束"+result);
            Boolean flag = false;
            if (object!=null){
                com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
                String Msg = jsonObject.getString("Msg");
                if (Msg.contains("Error")){
                    throw new Exception(Msg);
                }else {
                    flag = true;
                }
            }
            if (flag){
                try {
                    logger.info("挂号开始");
                    String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
                    List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(patientId, date,map.get("doctorCode").toString() ,1);
                    if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
                        WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
                        //判断是否已经挂号,如果已经挂号
                        if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                            net.sf.json.JSONObject res = new JSONObject();
                            res.put("@RESULT", "0");
                            logger.info("已经挂号 res: " + res.toString());
                            jsondate.put("serialNo",registerDO.getRegisterNo());
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setRegisterNo(registerDO.getRegisterNo());
                            baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                        }else {
                            returnMap.put("msg","已经挂号的数据有误");
                            returnMap.put("status","-1");
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            net.sf.json.JSONObject jsondate = new JSONObject();
            jsondate.put("checkPart","鼻/咽拭子");
            jsondate.put("cardNo",mediaCard);
            jsondate.put("chargeFlag","2");
            jsondate.put("chargeCode","361322");
            jsondate.put("icdCode","Z00.000");
            jsondate.put("socialNo",cardNo);
            jsondate.put("tellPhone",mobile);
            jsondate.put("address1",provinceName);
            jsondate.put("address2",cityName);
            jsondate.put("address3",townName);
            jsondate.put("address4",streetName);
            jsondate.put("address5",2);
            jsondate.put("area",address);
            jsondate.put("winNo",6);
            jsondate.put("target",2);
            jsondate.put("quantity",1);
            Map<String,Object> map = findRandomDoctor();
            net.sf.json.JSONObject rs = new JSONObject();
            if (map!=null){
                //先进行核算检测预约
                String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,pm,demoFlag);
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                logger.info("核酸检测预约结束"+result);
                Boolean flag = false;
                if (object!=null){
                    com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
                    String Msg = jsonObject.getString("Msg");
                    if (Msg.contains("Error")){
                        returnMap.put("msg",Msg);
                        returnMap.put("status","-1");
                        return  returnMap;
                    }else {
                    }else {
                        flag = true;
                    }
                }
                if (flag){
                    BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                    baseNatAppointmentDO.setMedicare(mediaCard);
                    baseNatAppointmentDO.setName(name);
                    baseNatAppointmentDO.setCardNo(cardNo);
                    baseNatAppointmentDO.setCardType(cardType);
                    baseNatAppointmentDO.setAddress(address);
                    baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                    baseNatAppointmentDO.setCityName(cityName);
                    baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                    baseNatAppointmentDO.setFirstJobName(firstJobName);
                    baseNatAppointmentDO.setSecondJobCode(secondJobCode);
                    baseNatAppointmentDO.setSecondJobName(secondJobName);
                    baseNatAppointmentDO.setProvinceName(provinceName);
                    baseNatAppointmentDO.setTownName(townName);
                    baseNatAppointmentDO.setStreetName(streetName);
                    baseNatAppointmentDO.setPatientId(patientId);
                    baseNatAppointmentDO.setIsSuccess("0");
                    baseNatAppointmentDO.setCardNoType(cardNoType);
                    baseNatAppointmentDO.setPayStatus("0");
                    baseNatAppointmentDO.setCreateTime(new Date());
                    baseNatAppointmentDO.setMobile(mobile);
                    baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
                    baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
                    baseNatAppointmentDO.setIcdCode("Z00.000");
                    baseNatAppointmentDO.setChargeCode("361322");
                    baseNatAppointmentDO.setWinNo("6");
                    baseNatAppointmentDO.setDept("3150000");
                    baseNatAppointmentDO.setDeptName("感染疾病科");
                    baseNatAppointmentDO.setAmpm(pm);
                    baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                    try {
                        rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
                        rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
                        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
                        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
                        logger.info("挂号结果 res: " + res.toString());
                        logger.info("挂号结果 res: " + res.toString());
@ -10563,24 +10545,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setRegisterNo(serialNo);
                            baseNatAppointmentDO.setRegisterNo(serialNo);
                            //存储就诊记录
                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
                            // 存储挂号医生与挂号科室
                            registerDO.setDoctor(map.get("doctorCode").toString());
                            registerDO.setDoctorName(map.get("doctorName").toString());
                            registerDO.setDept(map.get("deptCode").toString());
                            registerDO.setDeptName(map.get("deptName").toString());
                            registerDO.setRealOrder(realOrder);
                            registerDO.setXtgzh(xtgzh);
                            registerDO.setPatient(patientId);
                            registerDO.setPatientName(name);
                            //挂号流水号与挂号次数
                            registerDO.setRegisterNo(serialNo);
                            registerDO.setConNo(conNo);
                            registerDO.setCreateTime(new Date());
                            registerDO.setDel(1);
                            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                            patientRegisterDao.save(registerDO);
                            //保存日志
                            //保存日志
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            log.setCode("registerOutPatient");
                            log.setCode("registerOutPatient");
@ -10601,22 +10565,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
                            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
                            //存储就诊记录
                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
                            registerDO.setDoctor(map.get("doctorCode").toString());
                            registerDO.setDoctorName(map.get("doctorName").toString());
                            registerDO.setDept(map.get("deptCode").toString());
                            registerDO.setDeptName(map.get("deptName").toString());
                            registerDO.setRealOrder(realOrder);
                            registerDO.setXtgzh(xtgzh);
                            registerDO.setPatient(patientId);
                            registerDO.setPatientName(name);
                            registerDO.setRegisterNo(serialNo);
                            registerDO.setConNo(conNo);
                            registerDO.setCreateTime(new Date());
                            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                            patientRegisterDao.save(registerDO);
                            //保存日志
                            //保存日志
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            log.setCode("registerOutPatient");
                            log.setCode("registerOutPatient");
@ -10635,86 +10583,225 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }
                        }
                        baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                        baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                        baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                        baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    }
                    logger.info("开单开始");
                    logger.info("saveNatAppointment params:"+jsondate.toString());
                    com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                    array.add(jsondate);
                    try {
                        JSONObject jsonObject  = entranceService.BS10112(array.toString(),demoFlag);
                        //判断返回结果
                        String prers = jsonObject.getString("@RESULT");
                        //保存日志
                        WlyyHttpLogDO log = new WlyyHttpLogDO();
                        log.setCode("saveNatAppointment");
                        log.setName("核酸检测开方");
                        log.setPatient(patientId);
                        log.setDoctor(map.get("doctorCode").toString());
                        log.setResponse(jsonObject.toString());
                        log.setRequest(jsondate.toString());
                        log.setCreateTime(new Date());
                        wlyyHttpLogDao.save(log);
                        if ("0".equals(prers)) {
                            String realOrder = jsonObject.getString("@real_order");
                            String voucherNo = jsonObject.getString("@xtgzh0");
                            baseNatAppointmentDO.setRealOrder(realOrder);
                            baseNatAppointmentDO.setIsSuccess("1");
                            baseNatAppointmentDO.setVoucherNo(voucherNo);
                            baseNatAppointmentDO =baseNatAppointmentDao.save(baseNatAppointmentDO);
                            /*logger.info("模板消息推送标识pushFlag"+pushFlag);
                            if (!StringUtils.isNoneBlank(pushFlag)){
                                String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
                                String applyDepaName = map.get("deptName").toString();
                                String applyDoctorName = map.get("doctorName").toString();
                                BasePatientDO patientDO = basePatientDao.findById(patientId);
                                String userName = null;
                                String idcard = null;
                                if (patientDO != null) {
                                    userName = patientDO.getName();
                                    idcard = patientDO.getIdcard();
                                }
                                String hisId = patientMappingService.findHisPatNoByPatient(patientId,mediaCard);
                                logger.info("cardNo:" + cardNo);
                                JSONObject jsonObject1 =entranceService.BS15054(hisId,realOrder,demoFlag);
                                net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
                                logger.info("获取待结算数据 res: " + res.toString());
                                String rsCode = res.getString("@RESULT");
                                String free= 0+"";
                                if ("0".equals(rsCode)) {
                                    free = res.getString("@total_charge");
                                }
                                ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", hisId, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1",pushChannel);
                            }else {
                } catch (Exception e) {
                    e.printStackTrace();
                }
                logger.info("开单开始");
                logger.info("saveNatAppointment params:"+jsondate.toString());
                com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                array.add(jsondate);
                try {
                    JSONObject jsonObject  = entranceService.BS10112(array.toString(),demoFlag);
                    //判断返回结果
                    String prers = jsonObject.getString("@RESULT");
                    //保存日志
                    WlyyHttpLogDO log = new WlyyHttpLogDO();
                    log.setCode("saveNatAppointment");
                    log.setName("核酸检测开方");
                    log.setPatient(patientId);
                    log.setDoctor(map.get("doctorCode").toString());
                    log.setResponse(jsonObject.toString());
                    log.setRequest(jsondate.toString());
                    log.setCreateTime(new Date());
                    wlyyHttpLogDao.save(log);
                    if ("0".equals(prers)) {
                        String realOrder = jsonObject.getString("@real_order");
                        String voucherNo = jsonObject.getString("@xtgzh0");
                        baseNatAppointmentDO.setRealOrder(realOrder);
                        baseNatAppointmentDO.setIsSuccess("1");
                        baseNatAppointmentDO.setVoucherNo(voucherNo);
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                        String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
                        String applyDepaName = map.get("deptName").toString();
                        String applyDoctorName = map.get("doctorName").toString();
                        BasePatientDO patientDO = basePatientDao.findById(patientId);
                        String userName = null;
                        String idcard = null;
                        if (patientDO != null) {
                            userName = patientDO.getName();
                            idcard = patientDO.getIdcard();
                        }
                        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientId);
                        String userNo = null;
                        if (patientMappingDO != null) {
                            userNo = patientMappingDO.getMappingCode();
                        }
                            String title="您在厦门大学附属中山医院有一笔交易已支付完成!";
                            String pushPayLog = payInfoNoticeService.pushPrescriptionPayAndHsjc(baseNatAppointmentDO.getPatientId(),baseNatAppointmentDO.getDoctorName(),waitPayDetailVO.getVoucherNo(),natAppointmentDO.getId()+"",fee,title,null,waitPayDetailVO.getRecipeNo());
                            }*/
                        logger.info("cardNo:" + cardNo);
                        JSONObject jsonObject1 =entranceService.BS15054(patientMappingDO.getMappingCode(),realOrder,demoFlag);
                        net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
                        logger.info("获取待结算数据 res: " + res.toString());
                        String rsCode = res.getString("@RESULT");
                        String free= 0+"";
                        if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                        }
                        ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                        /*//成功后发送模板消息
                        /*//成功后发送模板消息
                        sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
                        sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
                    }else{
                        returnMap.put("msg","核酸检测开方失败");
                        returnMap.put("status","-1");
                        returnMap.put("id",baseNatAppointmentDO.getId());
                        return returnMap;
                        }else{
                            returnMap.put("msg","核酸检测开方失败");
                            returnMap.put("status","-1");
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
                    returnMap.put("msg","预约成功");
                    returnMap.put("status","200");
                    returnMap.put("id",baseNatAppointmentDO.getId());
                    returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
                }
            }
            return returnMap;
        }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
            baseNatAppointmentDO.setMedicare(mediaCard);
            baseNatAppointmentDO.setName(name);
            baseNatAppointmentDO.setCardNo(cardNo);
            baseNatAppointmentDO.setCardType(cardType);
            baseNatAppointmentDO.setAddress(address);
            baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
            baseNatAppointmentDO.setCityName(cityName);
            baseNatAppointmentDO.setFirstJobCode(firstJobCode);
            baseNatAppointmentDO.setFirstJobName(firstJobName);
            baseNatAppointmentDO.setSecondJobCode(secondJobCode);
            baseNatAppointmentDO.setSecondJobName(secondJobName);
            baseNatAppointmentDO.setProvinceName(provinceName);
            baseNatAppointmentDO.setTownName(townName);
            baseNatAppointmentDO.setStreetName(streetName);
            baseNatAppointmentDO.setPatientId(patientId);
            baseNatAppointmentDO.setIsSuccess("0");
            baseNatAppointmentDO.setPayStatus("0");
            baseNatAppointmentDO.setCreateTime(new Date());
            baseNatAppointmentDO.setMobile(mobile);
            baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
            baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
            baseNatAppointmentDO.setIcdCode("Z00.000");
            baseNatAppointmentDO.setChargeCode("361322");
            baseNatAppointmentDO.setWinNo("6");
            baseNatAppointmentDO.setDept("3150000");
            baseNatAppointmentDO.setDeptName("感染疾病科");
            baseNatAppointmentDO.setAmpm(pm);
            baseNatAppointmentDO.setHospitalFlag(pushFlag);
            baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
            //添加订单
            BusinessOrderDO businessDO = new BusinessOrderDO();
            businessDO.setPatient(patientId);
            businessDO.setPatientName(name);
            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(8000.0);
            businessDO.setRematk("核酸检测订单");
            businessDO.setDescription("核酸检测订单");
            businessDO.setPayType(1);
            businessDO.setUpdateTime(new Date());
            businessOrderDao.save(businessDO);
            //同步眼科医院
            logger.info("开始同步眼科医院");
            ykyyEntranceService.saveKsjc(baseNatAppointmentDO,demoFlag);
            logger.info("结束同步眼科医院");
            returnMap.put("msg","预约成功");
            returnMap.put("msg","预约成功");
            returnMap.put("status","200");
            returnMap.put("status","200");
            returnMap.put("id",baseNatAppointmentDO.getId());
            returnMap.put("id",baseNatAppointmentDO.getId());
            returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
            return returnMap;
        }
        }
        return returnMap;
        return returnMap;
    }
    }
    public MixEnvelop getNatRecords(String patientId,String id,Integer page ,Integer pageSize){
    public String sendMessage(Integer id,String pushChannel,String pushFlag) throws Exception {
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
        if (baseNatAppointmentDO==null){
            throw new Exception("预约记录不存在");
        }
        if (!StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
            throw new Exception("核酸项目不存在");
        }
        logger.info("模板消息推送标识pushFlag"+pushFlag);
        if (!StringUtils.isNoneBlank(pushFlag)){
            String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
            String applyDepaName = baseNatAppointmentDO.getDeptName();
            String applyDoctorName = baseNatAppointmentDO.getDoctorName();
            BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
            String userName = null;
            String idcard = null;
            if (patientDO != null) {
                userName = patientDO.getName();
                idcard = patientDO.getIdcard();
            }
            String hisId = patientMappingService.findHisPatNoByPatient(baseNatAppointmentDO.getPatientId(),baseNatAppointmentDO.getMedicare());
            logger.info("cardNo:" + baseNatAppointmentDO.getMedicare());
            JSONObject jsonObject1 =entranceService.BS15054(hisId,baseNatAppointmentDO.getRealOrder(),demoFlag);
            net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
            logger.info("获取待结算数据 res: " + res.toString());
            String rsCode = res.getString("@RESULT");
            String free= 0+"";
            if ("0".equals(rsCode)) {
                free = res.getString("@total_charge");
            }
            ylzPayService.msgPush("01", baseNatAppointmentDO.getMedicare(), "01", patientDO.getMobile(), "00", hisId, userName, idcard, baseNatAppointmentDO.getVoucherNo(), applyDepaName, applyDoctorName, recipeTime, free, "1",pushChannel);
        }else {
            if (pushChannel.equalsIgnoreCase("WX_PUB")){
                String first="尊敬的用户"+baseNatAppointmentDO.getName()+",您已完成线上自助核酸检测预约申请";
                String responseMsg="";
                String url="";
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                String contentMsg="申请人:"+baseNatAppointmentDO.getName()+"\r\n预约时间:"+date;
                String remark = "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\r\n" +
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                        "3、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
                    responseMsg = entranceService.ehospitalNotice(
                            baseNatAppointmentDO.getName(),
                            baseNatAppointmentDO.getCardNo(),
                            baseNatAppointmentDO.getMobile(),
                            first,
                            url,
                            contentMsg,
                            remark);
                    logger.info("中山发送模板消息返回结果="+responseMsg);
                    System.out.println("结束发送模板消息");
                }
            }else if (pushChannel.equalsIgnoreCase("ALI_PUB")){
                BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
                com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
                jsonObject.put("code","13");
                jsonObject.put("open_id",patientDO.getAlipayId());
                jsonObject.put("first","尊敬的用户"+baseNatAppointmentDO.getName()+",您已完成线上自助核酸检测预约申请");
                jsonObject.put("keyword1",DateUtil.getStringDate());
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                jsonObject.put("keyword2","申请人:"+baseNatAppointmentDO.getName()+"\n预约时间:"+date);
                String remark =  "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\n" +
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
                        "3、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                jsonObject.put("remark",remark);
                jsonObject.put("url","111111");
                String url = "https://xmzsyyfwc.xmpbinfo.cn/weixin/1/notification/push/nucleictest";
                logger.info("jsonObject"+jsonObject.toJSONString());
                String encdata = AES.encrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",jsonObject.toJSONString());
                Map<String, String> params = new HashedMap();
                params.put("encdata",encdata);
                String reponse = httpClientUtil.httpPost(url,params);
                logger.info("支付宝模板消息"+reponse);
            }
         }
         return "发送成功!";
    }
    public MixEnvelop getNatRecords(String patientId,String id,String payStatus,String appointmentTime, String isSuccess,Integer page ,Integer pageSize){
        String sql = "select t.name as \"name\"," +
        String sql = "select t.name as \"name\"," +
                "t.card_no as \"cardNo\"," +
                "t.card_no as \"cardNo\"," +
                "t.card_type as \"cardType\"," +
                "t.card_type as \"cardType\"," +
@ -10727,6 +10814,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.medicare as \"medicare\","+
                "t.medicare as \"medicare\","+
                "t.voucher_no as \"voucherNo\","+
                "t.voucher_no as \"voucherNo\","+
                "t.id as \"id\"," +
                "t.id as \"id\"," +
                "t.card_no_type as \"cardNoType\"," +
                "t.appointment_time as \"appointmentTime\" " +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
                " from base_nat_appointment t where 1=1 ";
        if (StringUtils.isNoneBlank(patientId)){
        if (StringUtils.isNoneBlank(patientId)){
@ -10735,8 +10823,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNoneBlank(id)){
        if (StringUtils.isNoneBlank(id)){
            sql+=" and t.id ='"+id+"'";
            sql+=" and t.id ='"+id+"'";
        }
        }
        if (StringUtils.isNoneBlank(payStatus)){
            sql+=" and t.pay_status ='"+payStatus+"'";
            sql+=" and t.is_success =1 ";
        }
        if (StringUtils.isNoneBlank(isSuccess)){
            sql+=" and t.is_success ="+isSuccess;
        }
        if (StringUtils.isNoneBlank(appointmentTime)){
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                sql+=" and t.appointment_time >= to_date('" + appointmentTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss')";
                sql+=" and t.appointment_time <= to_date('" + appointmentTime + " 23:59:59', 'yyyy-mm-dd hh24:mi:ss')";
            }else {
                sql+=" and t.appointment_time >='"+appointmentTime+" 00:00:00'";
                sql+=" and t.appointment_time <='"+appointmentTime+" 23:59:59'";
            }
        }
        sql+=" order by t.appointment_time desc ";
        List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
        List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
        logger.info("查询数据"+sql);
        MixEnvelop mixnvelop = new MixEnvelop();
        MixEnvelop mixnvelop = new MixEnvelop();
        if (listCount!=null&&listCount.size()>0){
        if (listCount!=null&&listCount.size()>0){
            mixnvelop.setCurrPage(page);
            mixnvelop.setCurrPage(page);
@ -10749,16 +10859,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    }
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
            String hisId = patientMappingService.findHisPatNoByPatient(patientId,baseNatAppointmentDO.getMedicare());
            logger.info("cardNo:" + baseNatAppointmentDO.getMedicare());
            JSONObject jsonObject1 =entranceService.BS15054(hisId,baseNatAppointmentDO.getRealOrder(),demoFlag);
            net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
            logger.info("获取待结算数据 res: " + res.toString());
            String rsCode = res.getString("@RESULT");
            String free= 0+"";
            String settleFlag = "";
            if ("0".equals(rsCode)) {
                free = res.getString("@total_charge");
                settleFlag = res.getString("@settle_flag");
                if (StringUtils.isNoneBlank(settleFlag)&&settleFlag.equalsIgnoreCase("Y")){
                    baseNatAppointmentDO.setPayStatus("1");
                }
                if (StringUtils.isNoneBlank(free)&&free.equalsIgnoreCase("0")){
                    baseNatAppointmentDO.setPayStatus("1");
                }
                baseNatAppointmentDao.save(baseNatAppointmentDO);
            }
        }
    }
    public List<Map<String,Object>> findBaseAddress(String addressFlag,String parentName){
    public List<Map<String,Object>> findBaseAddress(String addressFlag,String parentName){
        String sql="";
        String sql="";
        if ("1".equalsIgnoreCase(addressFlag)){
        if ("1".equalsIgnoreCase(addressFlag)){
            sql+="select  t.province_name as \"provinceName\" from base_address_mapping t group by t.province_name ";
            sql+="select  t.province_name as \"provinceName\" from base_address_mapping t group by t.province_name ";
        }else if("2".equalsIgnoreCase(addressFlag)){
        }else if("2".equalsIgnoreCase(addressFlag)){
            sql+="select  t.city_name as \"cityName\" from base_address_mapping t where t.province_name ='"+parentName+"' and city_name <> '' and city_name is not null group by t.city_name ";
            sql+="select  t.city_name as \"cityName\" from base_address_mapping t where t.province_name ='"+parentName+"'  and city_name is not null group by t.city_name ";
        }else if("3".equalsIgnoreCase(addressFlag)){
        }else if("3".equalsIgnoreCase(addressFlag)){
            sql+="select  t.town_name as \"townName\" from base_address_mapping t  where t.city_name ='"+parentName+"' and town_name <> '' and town_name is not null group by t.town_name";
            sql+="select  t.town_name as \"townName\" from base_address_mapping t  where t.city_name ='"+parentName+"'  and town_name is not null group by t.town_name";
        }else if("4".equalsIgnoreCase(addressFlag)){
        }else if("4".equalsIgnoreCase(addressFlag)){
            sql+="select  t.street_name as \"streetName\" from base_address_mapping t  where t.town_name ='"+parentName+"' and street_name <> '' and street_name is not null";
            sql+="select  t.street_name as \"streetName\" from base_address_mapping t  where t.town_name ='"+parentName+"'  and street_name is not null";
        }
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        list.stream().forEach(one->{
        list.stream().forEach(one->{
@ -10782,12 +10919,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        String res = "";
        String res = "";
        if (patientDO!=null){
        if (patientDO!=null){
            String patientCode = null;
            try {
            try {
                patientCode = patientMappingService.findHisPatNoByIdCard(patientDO.getIdcard());
                BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
                BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
                if (null!=baseNatAppointmentDO){
                if (null!=baseNatAppointmentDO){
                    res = entranceService.BS10145("3150000","0001",DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),demoFlag);
                    res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
                    logger.info("核酸检测预约取消"+res);
                    logger.info("核酸检测预约取消"+res);
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
                    Boolean flag = false;
                    Boolean flag = false;
@ -10802,33 +10937,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            baseNatAppointmentDO.setCancelBy(patientId);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            //删除处方
                            logger.info("删除处方开始");
                            net.sf.json.JSONObject jsondate = new JSONObject();
                            jsondate.put("checkPart","鼻/咽拭子");
                            jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                            jsondate.put("chargeFlag","2");
                            jsondate.put("chargeCode","361322");
                            jsondate.put("icdCode","Z00.000");
                            jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                            jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                            jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                            jsondate.put("address2",baseNatAppointmentDO.getCityName());
                            jsondate.put("address3",baseNatAppointmentDO.getTownName());
                            jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                            jsondate.put("address5",2);
                            jsondate.put("area",baseNatAppointmentDO.getAddress());
                            jsondate.put("winNo",6);
                            jsondate.put("target",2);
                            jsondate.put("quantity",1);
                            jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                            jsondate.put("dept",baseNatAppointmentDO.getDept());
                            jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
                            jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
                            JSONArray array = new JSONArray();
                            array.add(jsondate);
                            JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
                            logger.info("删除处方结束");
                            if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                                //删除处方
                                logger.info("删除处方开始");
                                net.sf.json.JSONObject jsondate = new JSONObject();
                                jsondate.put("checkPart","鼻/咽拭子");
                                jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                                jsondate.put("chargeFlag","2");
                                jsondate.put("chargeCode","361322");
                                jsondate.put("icdCode","Z00.000");
                                jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                                jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                                jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                                jsondate.put("address2",baseNatAppointmentDO.getCityName());
                                jsondate.put("address3",baseNatAppointmentDO.getTownName());
                                jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                                jsondate.put("address5",2);
                                jsondate.put("area",baseNatAppointmentDO.getAddress());
                                jsondate.put("winNo",6);
                                jsondate.put("target",2);
                                jsondate.put("quantity",1);
                                jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                                jsondate.put("dept",baseNatAppointmentDO.getDept());
                                jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
                                jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
                                JSONArray array = new JSONArray();
                                array.add(jsondate);
                                JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
                                logger.info("删除处方结束");
                            }
                        }
                        }
                    }
                    }
@ -10841,267 +10979,58 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        }
        return res;
        return res;
    }
    }
    //先调预约核酸检测的接口
    public Map natAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                  String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
        BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
        baseNatAppointmentDO.setMedicare(mediaCard);
        baseNatAppointmentDO.setName(name);
        baseNatAppointmentDO.setCardNo(cardNo);
        baseNatAppointmentDO.setCardType(cardType);
        baseNatAppointmentDO.setAddress(address);
        baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
        baseNatAppointmentDO.setCityName(cityName);
        baseNatAppointmentDO.setFirstJobCode(firstJobCode);
        baseNatAppointmentDO.setFirstJobName(firstJobName);
        baseNatAppointmentDO.setSecondJobCode(secondJobCode);
        baseNatAppointmentDO.setSecondJobName(secondJobName);
        baseNatAppointmentDO.setProvinceName(provinceName);
        baseNatAppointmentDO.setTownName(townName);
        baseNatAppointmentDO.setStreetName(streetName);
        baseNatAppointmentDO.setPatientId(patientId);
        baseNatAppointmentDO.setIsSuccess("0");
        baseNatAppointmentDO.setPayStatus("0");
        baseNatAppointmentDO.setCreateTime(new Date());
        baseNatAppointmentDO.setMobile(mobile);
        baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
        baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
        baseNatAppointmentDO.setIcdCode("Z00.000");
        baseNatAppointmentDO.setChargeCode("361322");
        baseNatAppointmentDO.setWinNo("6");
        baseNatAppointmentDO.setDept("3150000");
        baseNatAppointmentDO.setDeptName("感染疾病科");
        baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
        Map<String,Object> returnMap = new HashMap();
        //先进行核算检测预约
        String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,demoFlag);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
        logger.info("核酸检测预约结束"+result);
        if (object!=null){
            com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
            String Msg = jsonObject.getString("Msg");
            if (Msg.contains("Error")){
                throw new Exception(Msg);
            }else {
                baseNatAppointmentDO.setIsSuccess("1");
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                returnMap.put("id",baseNatAppointmentDO.getId());
                returnMap.put("msg","预约成功");
            }
        }else {
            returnMap.put("id",baseNatAppointmentDO.getId());
            returnMap.put("msg","预约失败");
        }
        return  returnMap;
    }
    //预约核酸成功后通过订单id去挂号生成订单
    public Map<String,Object> registerAndNatPre(Integer id) throws Exception{
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
        Map<String,Object> map = findRandomDoctor();
        Map<String,Object> returnMap = new HashMap<>();
        if (baseNatAppointmentDO!=null){
            net.sf.json.JSONObject jsondate = new JSONObject();
            jsondate.put("checkPart","鼻/咽拭子");
            jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
            jsondate.put("chargeFlag","2");
            jsondate.put("chargeCode","361322");
            jsondate.put("icdCode","Z00.000");
            jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
            jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
            jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
            jsondate.put("address2",baseNatAppointmentDO.getCityName());
            jsondate.put("address3",baseNatAppointmentDO.getTownName());
            jsondate.put("address4",baseNatAppointmentDO.getStreetName());
            jsondate.put("address5","");
            jsondate.put("area",baseNatAppointmentDO.getAddress());
            jsondate.put("winNo","6");
            jsondate.put("target","1");
            jsondate.put("quantity","1");
            if("1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
                logger.info("挂号开始");
                String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
                if (map!=null){
                    List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(baseNatAppointmentDO.getPatientId(), date,map.get("doctorCode").toString() ,1);
                    net.sf.json.JSONObject rs = new JSONObject();
                    if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
                        WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
                        //判断是否已经挂号,如果已经挂号
                        if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                            net.sf.json.JSONObject res = new JSONObject();
                            res.put("@RESULT", "0");
                            logger.info("已经挂号 res: " + res.toString());
                            jsondate.put("serialNo",registerDO.getRegisterNo());
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                        }else {
                            returnMap.put("msg","已经挂号的数据有误");
                            returnMap.put("status","-1");
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                    }else {
                        rs = entranceService.BS10111(baseNatAppointmentDO.getMedicare(), map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
                        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
                        logger.info("挂号结果 res: " + res.toString());
                        String rsCode = res.getString("@RESULT");
                        if ("0".equals(rsCode)) {
                            //存储挂号号
                            // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
                            String serialNo = (String) res.get("@serial_no");
                            String conNo = (String) res.get("@times");
                            String xtgzh = (String) res.get("@xtgzh");
                            String realOrder = (String) res.get("@real_order");
                            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
                            jsondate.put("serialNo",serialNo);
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            //存储就诊记录
                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
                            // 存储挂号医生与挂号科室
                            registerDO.setDoctor(map.get("doctorCode").toString());
                            registerDO.setDoctorName(map.get("doctorName").toString());
                            registerDO.setDept(map.get("deptCode").toString());
                            registerDO.setDeptName(map.get("deptName").toString());
                            registerDO.setRealOrder(realOrder);
                            registerDO.setXtgzh(xtgzh);
                            registerDO.setPatient(baseNatAppointmentDO.getPatientId());
                            registerDO.setPatientName(baseNatAppointmentDO.getName());
                            //挂号流水号与挂号次数
                            registerDO.setRegisterNo(serialNo);
                            registerDO.setConNo(conNo);
                            registerDO.setCreateTime(new Date());
                            registerDO.setDel(1);
                            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                            patientRegisterDao.save(registerDO);
                            //保存日志
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            log.setCode("registerNat");
                            log.setName("挂号");
                            log.setPatient(baseNatAppointmentDO.getPatientId());
                            log.setDoctor(map.get("doctorCode").toString());
                            log.setResponse(rs.toString());
                            log.setStatus(rsCode);
                            log.setCreateTime(new Date());
                            wlyyHttpLogDao.save(log);
                        } else if ("-2".equals(rsCode)) {
                            String serialNo = (String) res.get("@serial_no");
                            String xtgzh = (String) res.get("@xtgzh");
                            String realOrder = (String) res.get("@real_order");
                            String conNo = (String) res.get("@times");
                            jsondate.put("serialNo",serialNo);
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
                            //存储就诊记录
                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
                            registerDO.setDoctor(map.get("doctorCode").toString());
                            registerDO.setDoctorName(map.get("doctorName").toString());
                            registerDO.setDept(map.get("deptCode").toString());
                            registerDO.setDeptName(map.get("deptName").toString());
                            registerDO.setRealOrder(realOrder);
                            registerDO.setXtgzh(xtgzh);
                            registerDO.setPatient(baseNatAppointmentDO.getPatientId());
                            registerDO.setPatientName(baseNatAppointmentDO.getName());
                            registerDO.setRegisterNo(serialNo);
                            registerDO.setConNo(conNo);
                            registerDO.setCreateTime(new Date());
                            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                            patientRegisterDao.save(registerDO);
                            //保存日志
                            WlyyHttpLogDO log = new WlyyHttpLogDO();
                            log.setCode("registerOutPatient");
                            log.setName("挂号");
                            log.setPatient(baseNatAppointmentDO.getPatientId());
                            log.setDoctor(map.get("doctorCode").toString());
                            log.setResponse(rs.toString());
                            log.setStatus(rsCode);
                            log.setCreateTime(new Date());
                            wlyyHttpLogDao.save(log);
                        }else {
                            returnMap.put("msg","请求挂号失败");
                            returnMap.put("status","-1");
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                        baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                    }
                    logger.info("开单开始");
                    logger.info("NatPre params:"+jsondate.toString());
                    com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                    array.add(jsondate);
                    try {
                        JSONObject jsonObject  = entranceService.BS10112(array.toString(),demoFlag);
                        //判断返回结果
                        String prers = jsonObject.getString("@RESULT");
                        //保存日志
                        WlyyHttpLogDO log = new WlyyHttpLogDO();
                        log.setCode("NatAppointment");
                        log.setName("核酸检测开方");
                        log.setPatient(baseNatAppointmentDO.getPatientId());
                        log.setDoctor(map.get("doctorCode").toString());
                        log.setResponse(jsonObject.toString());
                        log.setRequest(jsondate.toString());
                        log.setCreateTime(new Date());
                        wlyyHttpLogDao.save(log);
                        if ("0".equals(prers)) {
                            String realOrder = jsonObject.getString("@real_order");
                            baseNatAppointmentDO.setRealOrder(realOrder);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
                            String applyDepaName = map.get("deptName").toString();
                            String voucherNo = jsonObject.getString("@xtgzh0");
                            String applyDoctorName = map.get("doctorName").toString();
                            BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
                            String userName = null;
                            String idcard = null;
                            if (patientDO != null) {
                                userName = patientDO.getName();
                                idcard = patientDO.getIdcard();
                            }
                            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(baseNatAppointmentDO.getPatientId());
                            String userNo = null;
                            if (patientMappingDO != null) {
                                userNo = patientMappingDO.getMappingCode();
                            }
                        /*JSONObject jsonObject1 =entranceService.BS15054(patientMappingDO.getMappingCode(),realOrder,demoFlag);
                        net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
                        logger.info("获取待结算数据 res: " + res.toString());
                        String rsCode = res.getString("@RESULT");*/
                            String free= 80+"";
                        /*if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                        }*/
                            ylzPayService.msgPush("01", baseNatAppointmentDO.getMedicare(), "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                        /*//成功后发送模板消息
                        sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
                        }else{
                            returnMap.put("msg","核酸检测开方失败");
                            returnMap.put("status","-1");
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    returnMap.put("msg","预约成功");
                    returnMap.put("status","200");
                    returnMap.put("id",baseNatAppointmentDO.getId());
                }else {
                    returnMap.put("msg","医生映射表找不到对应信息");
                    returnMap.put("status","-1");
                    returnMap.put("id",baseNatAppointmentDO.getId());
                }
            }else{
                returnMap.put("msg","该单状态出错:"+baseNatAppointmentDO.getIsSuccess());
                returnMap.put("status","-1");
                returnMap.put("id",baseNatAppointmentDO.getId());
            }
    public String sendAlipayMessage(String patientId,String code,String fee,String redirdctUrl,String reserverTime,String realorder) throws Exception {
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
      /*  ⽀付提醒通知:
        code: 通知代码,⽀付提醒为“2” open_id:⽀付宝⽤户ID user_name: 姓名 order_id: 订单号
        create_time: 订单创建时间 fee: ⾦额 url:通知详情跳转链接*/
        /*预约成功通知:
        code: 通知代码,预约为“4” open_id: ⽀付宝⽤户ID user_name: 姓名 unit_name: 科室名
        doctor_name: 医⽣名 order_time: 预约时间 order_no: 预约号*/
        /* ⽀付成功通知:
        code:通知代码,⽀付成功为“3” open_id:⽀付宝⽤户ID first: 您好,恭喜⽀付成功! fee: ⾦额
        fee_type_name: 费⽤类型 url: 通知详情跳转链接 remark: 备注,以\n换⾏*/
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        if (code.equalsIgnoreCase("3")){
            jsonObject.put("code",code);
            jsonObject.put("open_id",patientDO.getAlipayId());
            jsonObject.put("first",patientDO.getName()+"您好,您有一笔交易支付成功!支付明细如下:");
            jsonObject.put("fee_type_name","核酸预约申请");
            jsonObject.put("fee",fee);
            jsonObject.put("url",redirdctUrl);
            String remark = "发票流水号:"+realorder+"\n" +
                    "点击查看核酸预约开单信息\n" ;
            jsonObject.put("remark",remark);
        }else if (code.equalsIgnoreCase("13")){
           /* code: 通知代码,预约为“13” open_id: ⽀付宝⽤户ID first: 第⼀⾏ keyword1: 第⼆⾏ keyword2: 第三⾏
            remark: 备注 url: 详情链接*/
            jsonObject.put("code",code);
            jsonObject.put("open_id",patientDO.getAlipayId());
            jsonObject.put("first","尊敬的用户"+patientDO.getName()+",您已完成线上自助核酸检测预约申请");
            jsonObject.put("keyword1",DateUtil.getStringDate());
            jsonObject.put("keyword2","申请人:"+patientDO.getName()+"\n" +
                    "预约时间:"+reserverTime+"\n" +
                    "发票流水号:"+realorder+"");
            String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
                    "2、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
            jsonObject.put("remark",remark);
            jsonObject.put("url",redirdctUrl);
        }
        String url = "https://xmzsyyfwc.xmpbinfo.cn/weixin/1/notification/push/nucleictest";
        logger.info("jsonObject"+jsonObject.toJSONString());
        String encdata = AES.encrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",jsonObject.toJSONString());
        Map<String, String> params = new HashedMap();
        params.put("encdata",encdata);
        String reponse = httpClientUtil.httpPost(url,params);
        logger.info("支付宝模板消息"+reponse);
        return reponse;
        }
        return returnMap;
    }
    }
}
}

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

@ -1906,7 +1906,6 @@ public class EntranceService {
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
            logger.info("resp"+resp);
        }
        }
        return ConvertUtil.convertListEnvelopInBodyRow(resp);
        return ConvertUtil.convertListEnvelopInBodyRow(resp);
    }
    }
@ -1918,7 +1917,7 @@ public class EntranceService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public JSONArray BS10143(String day,boolean demoFlag) throws Exception {
    public JSONArray BS10143(String day,String pm,boolean demoFlag) throws Exception {
        String fid = "BS10143";
        String fid = "BS10143";
        String resp = "";
        String resp = "";
        if (demoFlag) {
        if (demoFlag) {
@ -1932,12 +1931,11 @@ public class EntranceService {
            //查询信息拼接
            //查询信息拼接
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            if (StringUtils.isNotBlank(day)) {
            if (StringUtils.isNotBlank(day)) {
                sbs.append("<![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest request_day=\""+day+"\" ampm=\"a\" ></resquest></root>]]>");
                sbs.append("<![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest request_day=\""+day+"\" ampm=\""+pm+"\" ></resquest></root>]]>");
            }
            }
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
            logger.info("resp"+resp);
        }
        }
        return ConvertUtil.convertListEnvelopInBodyRow(resp);
        return ConvertUtil.convertListEnvelopInBodyRow(resp);
    }
    }
@ -1956,7 +1954,7 @@ public class EntranceService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String BS10144(String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone, boolean demoFlag) throws Exception {
    public String BS10144(String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone,String pm, boolean demoFlag) throws Exception {
        String fid = "BS10144";
        String fid = "BS10144";
        String resp = "";
        String resp = "";
        if (demoFlag) {
        if (demoFlag) {
@ -1969,11 +1967,10 @@ public class EntranceService {
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
            //查询信息拼接
            //查询信息拼接
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            sbs.append("<as_xml><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest DeptCode=\""+deptCode+"\" DocCode=\""+docCode+"\" ampm=\"a\" StartTime=\""+startTime+"\" SSID=\""+sSID+"\" PatientName=\""+patientName+"\" PatientID=\""+patientID+"\" PatientPhone=\""+patientPhone+"\"></resquest></root>]]></as_xml>");
            sbs.append("<as_xml><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest DeptCode=\""+deptCode+"\" DocCode=\""+docCode+"\" ampm=\""+pm+"\" StartTime=\""+startTime+"\" SSID=\""+sSID+"\" PatientName=\""+patientName+"\" PatientID=\""+patientID+"\" PatientPhone=\""+patientPhone+"\"></resquest></root>]]></as_xml>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRowBS10144(resp);
            resp = MqSdkUtil.xml2jsonArrayRootRowBS10144(resp);
            logger.info("resp"+resp);
        }
        }
        return resp;
        return resp;
    }
    }
@ -1991,7 +1988,7 @@ public class EntranceService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String BS10145(String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone, boolean demoFlag) throws Exception {
    public String BS10145(String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone,String pm, boolean demoFlag) throws Exception {
        String fid = "BS10145";
        String fid = "BS10145";
        String resp = "";
        String resp = "";
        if (demoFlag) {
        if (demoFlag) {
@ -2004,11 +2001,10 @@ public class EntranceService {
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
            //查询信息拼接
            //查询信息拼接
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg>");
            sbs.append("<as_xml><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest DeptCode=\""+deptCode+"\" DocCode=\""+docCode+"\" ampm=\"a\" StartTime=\""+startTime+"\" SSID=\""+sSID+"\" PatientName=\""+patientName+"\" PatientID=\""+patientID+"\" PatientPhone=\""+patientPhone+"\"></resquest></root>]]></as_xml>");
            sbs.append("<as_xml><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><resquest DeptCode=\""+deptCode+"\" DocCode=\""+docCode+"\" ampm=\""+pm+"\" StartTime=\""+startTime+"\" SSID=\""+sSID+"\" PatientName=\""+patientName+"\" PatientID=\""+patientID+"\" PatientPhone=\""+patientPhone+"\"></resquest></root>]]></as_xml>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            sbs.append("</Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRowBS10144(resp);
            resp = MqSdkUtil.xml2jsonArrayRootRowBS10144(resp);
            logger.info("resp"+resp);
        }
        }
        return resp;
        return resp;

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

@ -65,17 +65,17 @@ public class YkyyEntranceService {
    private static Logger logger = LoggerFactory.getLogger(YkyyEntranceService.class);
    private static Logger logger = LoggerFactory.getLogger(YkyyEntranceService.class);
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    private final static String url="http://192.168.33.197:10023/ykyy/createSQLQuery";
//    private final static String url="http://localhost:10023/ykyy/createSQLQuery";
//    private final static String url="http://localhost:10023/ykyy/createSQLQuery";
    private final static String saveUrl="http://192.168.20.55:10023/ykyy/save";
    private final static String orderUrl="http://192.168.20.55:10023/ykyy/outPatientOrder";
    private final static String saveUrl="http://192.168.33.197:10023/ykyy/save";
    private final static String orderUrl="http://192.168.33.197:10023/ykyy/outPatientOrder";
    private final static String updateUrl="http://192.168.20.55:10023/ykyy/updateBySql";
    private final static String updateUrl="http://192.168.33.197:10023/ykyy/updateBySql";
    private final static String updateEntityUrl="http://192.168.20.55:10023/ykyy/update";
    private final static String updateEntityUrl="http://192.168.33.197:10023/ykyy/update";
    private final static String jdbcUrl="http://192.168.20.55:10023/ykyy/jdbcSQLQuery";
    private final static String jdbcUrl="http://192.168.33.197:10023/ykyy/jdbcSQLQuery";
    private final static String orgCode ="350211A5004";
    private final static String orgCode ="350211A5004";
@ -141,6 +141,8 @@ public class YkyyEntranceService {
    private PrescriptionEmrDao prescriptionEmrDao;
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    @Autowired
    private FileUploadService fileUploadService;
    private FileUploadService fileUploadService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -1890,6 +1892,265 @@ public class YkyyEntranceService {
    }
    }
    public void saveKsjc(BaseNatAppointmentDO natAppointmentDO,Boolean demoFlag) throws Exception {
        //挂号
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        hlwGhmxDO.setSBXH(0);
        hlwGhmxDO.setGHCS(1);
        hlwGhmxDO.setGHJE(0);
        hlwGhmxDO.setZLJE(0);
        hlwGhmxDO.setZJFY(0);
        hlwGhmxDO.setBLJE(0);
        hlwGhmxDO.setXJJE(0);
        hlwGhmxDO.setZPJE(0);
        hlwGhmxDO.setZHJE(0);
        hlwGhmxDO.setHBWC(0);
        hlwGhmxDO.setQTYS(0);
        hlwGhmxDO.setTHBZ(0);
        hlwGhmxDO.setCZPB(0);
        hlwGhmxDO.setMZLB(0);
        hlwGhmxDO.setYSPB(0);
        hlwGhmxDO.setSFFS(0);
        hlwGhmxDO.setJZZT(2);
        hlwGhmxDO.setJZXH(0);
        hlwGhmxDO.setKSDM(map.get("deptCode").toString());
        hlwGhmxDO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
        hlwGhmxDO.setGHSJ(new Date());//挂号时间
        hlwGhmxDO.setGHLB(1);//挂号类别
        hlwGhmxDO.setYSDM(map.get("doctorCode").toString());//医生代码
        hlwGhmxDO.setJZYS(map.get("doctorCode").toString());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            hlwGhmxDO.setBRXZ(json.getInteger("brxz"));
        }
        //获取医生信息
        hlwGhmxDO.setCZGH(map.get("doctorMappingCode").toString());
        // 同一个医生同一个病人,一天一条挂号记录。
        JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),map.get("doctorCode").toString());
        if(ja!=null&&ja.size()>0){
            //更新
            JSONObject json = ja.getJSONObject(0);
            hlwGhmxDO.setSBXH(json.getInteger("SBXH"));
            hlwGhmxDO.setGHSJ(DateUtil.strToDate(json.getString("GHSJ")));
            GHXH = json.getInteger("SBXH");
            String jsonString = JSONObject.toJSONString(hlwGhmxDO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HlwGhmxDO");
            logger.info("HlwGhmxDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
            if (response.getStatus()==200){
                logger.info("content"+response.getContent());
                logger.info("表hlwGhmxDo更新成功!");
            }else {
                logger.info("表hlwGhmxDo更新失败!"+response.getErrorMsg());
            }
        }else{
            //新增
            String jsonString = JSONObject.toJSONString(hlwGhmxDO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HlwGhmxDO");
            logger.info("HlwGhmxDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(saveUrl,params);
            if (response.getStatus()==200){
                String content = response.getContent();
                logger.info("content"+content);
                JSONObject jsonObject = JSONObject.parseObject(content);
                JSONObject object = jsonObject.getJSONObject("obj");
                if (object!=null){
                    GHXH = object.getInteger("sbxh");
                    logger.info("GHXH=========="+GHXH);
                }
                logger.info("表hlwGhmxDo新增成功!");
            }
        }
        Integer icd10Flag = 0;
        //就诊历史表HLWYS_MZ_JZLS
        HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
        hlwYsMzJzLsDO.setJZXH(0);
        hlwYsMzJzLsDO.setGHXH(GHXH);
        hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
        hlwYsMzJzLsDO.setKSDM(Integer.parseInt(map.get("deptCode").toString()));
        hlwYsMzJzLsDO.setYSDM(map.get("doctorCode").toString());
        hlwYsMzJzLsDO.setKSSJ(DateUtil.getNowDate());
        hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
        hlwYsMzJzLsDO.setJZZT(9);
        hlwYsMzJzLsDO.setJZLX(3);//就诊类型
        hlwYsMzJzLsDO.setZDMC("健康查体");
        hlwYsMzJzLsDO.setMQZD("健康查体");
        /*if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }*/
        //V_HLW_ICD10.FLAG
        JSONArray jsonArray2 = findHisIcd10("Z00.001");
        if(jsonArray2!=null&&jsonArray2.size()>0){
            //获取居民信息
            JSONObject json = jsonArray2.getJSONObject(0);
            icd10Flag = json.getInteger("FLAG");
        }
        hlwYsMzJzLsDO.setZYZD(icd10Flag);
        String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
        Map<String,Object> params2 = new HashedMap();
        params2.put("json",jsonString2);
        params2.put("table","HlwYsMzJzLsDO");
        logger.info("HlwYsMzJzLsDO:"+jsonString2);
        HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
        Integer jzxh = null;
        if (response2.getStatus()==200) {
            String content = response2.getContent();
            logger.info("content" + content);
            //获取就诊序号,更新处方表数据
            JSONObject jsonObject = JSONObject.parseObject(content);
            JSONObject object = jsonObject.getJSONObject("obj");
            if (object != null) {
                jzxh = object.getInteger("jzxh");
                logger.info("JZXH==========" + jzxh);
            }
            logger.info("表hlwYsMzJzLsDO同步成功!");
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setYSDM(map.get("doctorCode").toString());
            hlwYsMzJbzdDO.setICD("Z00.001");
            hlwYsMzJbzdDO.setMSZD("健康查体");
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
            hlwYsMzJbzdDO.setZDLB(11);//诊断类别
            hlwYsMzJbzdDO.setZDSJ(DateUtil.getNowDate());//诊断时间
            hlwYsMzJbzdDO.setZFPB(0);//作废标志
            hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
            hlwYsMzJbzdDO.setQZSJ(DateUtil.getNowDate());//确诊时间
            hlwYsMzJbzdDO.setJBMC("健康查体");//诊断名称
            hlwYsMzJbzdDO.setZDLX(1);//诊断类型
            hlwYsMzJbzdDO.setTJBZ(1);//提交标志
            hlwYsMzJbzdDO.setJZXH(jzxh);
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String, Object> params1 = new HashedMap();
            params1.put("json", jsonString1);
            params1.put("table", "HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:" + jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl, params1);
            if (response1.getStatus() == 200) {
                String content1 = response1.getContent();
                logger.info("content" + content1);
                logger.info("表hlwYsMzJbzdDO同步成功!");
            }
        }
        //同步核酸检验
        List<YkEmrJcsqDO> ykEmrJcsqDOS = new ArrayList<>();
        YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
        ykEmrJcsqDO.setJzxh(jzxh);
        ykEmrJcsqDO.setXmid(Integer.valueOf("12220"));
        JSONArray jsonArray1 = this.findZlxm(null, "12220");
        String deptNo = null;
        if (jsonArray1 != null && jsonArray1.size() > 0) {
            JSONObject deptobject = jsonArray1.getJSONObject(0);
            deptNo = deptobject.getString("dept");
        }
        ykEmrJcsqDO.setZxks(deptNo == null ? 0 : Integer.parseInt(deptNo));
        ykEmrJcsqDO.setJcxm("新冠病毒核酸检测");
        ykEmrJcsqDO.setXmdj(new BigDecimal("80"));
        ykEmrJcsqDO.setSqsl(1);
        ykEmrJcsqDO.setJclx(1);
        ykEmrJcsqDO.setXmdw("人次");
        ykEmrJcsqDO.setKdsj(new Date());
        Integer brxb = 0;
        String brxm = "";
        Date csny =null;
        Integer brnl =0;
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        String mzhm="0";
        JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray3!=null&&jsonArray3.size()>0){
            //获取居民信息
            JSONObject json = jsonArray3.getJSONObject(0);
            brxb = json.getInteger("brxb");
            brxm = json.getString("brxm");
            csny = json.getDate("csny");
            brnl = this.getBrnl(csny);
            brid=json.getInteger("brid");
            mzhm = json.getString("mzhm");
        }
        //操作医生信息
        doctorHis=map.get("doctorCode").toString();
        kdks = Integer.parseInt(map.get("deptCode").toString());
        ykEmrJcsqDO.setBrid(brid);
        ykEmrJcsqDO.setJjbz(0);
        ykEmrJcsqDO.setJczt(1);
        ykEmrJcsqDO.setZfbz(0);
        ykEmrJcsqDO.setQxbz(0);
        ykEmrJcsqDO.setBrxb(brxb);
        ykEmrJcsqDO.setBrxm(natAppointmentDO.getName());
        ykEmrJcsqDO.setBrnl(brnl);
        ykEmrJcsqDO.setKdys(doctorHis);
        ykEmrJcsqDO.setBrks(kdks);
        ykEmrJcsqDO.setTjys(doctorHis);
        ykEmrJcsqDO.setJzhm(mzhm);
        ykEmrJcsqDOS.add(ykEmrJcsqDO);
        String jsonString = JSONObject.toJSONString(ykEmrJcsqDOS);
        Map<String,Object> params = new HashedMap();
        params.put("json",jsonString);
        params.put("table","ykEmrJcsqDO");
        logger.info("ykEmrJcsqDO:"+jsonString);
        HttpResponse response = HttpUtils.doGet(orderUrl,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        JSONArray array= new JSONArray();
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            JSONObject object = array.getJSONObject(0);
            String yjxh = object.getString("yjxh");
            natAppointmentDO.setRealOrder(yjxh);
            baseNatAppointmentDao.save(natAppointmentDO);
        }else {
        }
    }
    public Map<String,Object> findYkDoctor(String hospitalFlag){
        String sql = "select t.id as \"id\"," +
                "t.doctor_mapping_code as \"doctorMappingCode\"," +
                "t.doctor_code as \"doctorCode\"," +
                "t.dept_code as \"deptCode\"," +
                "t.start_time as \"startTime\"," +
                "t.end_time as \"endTime\"," +
                "t.doctor_name as \"doctorName\"," +
                "t.dept_name  as \"deptName\" from base_doctor_time_mapping t where 1=1 ";
        if (StringUtils.isNoneBlank(hospitalFlag)){
            sql+=" and t.hospital_flag = '"+hospitalFlag+"'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    /**
    /**
     * 诊断
     * 诊断
     * @param wlyyPrescriptionVO
     * @param wlyyPrescriptionVO

+ 1 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/MqSdkUtil.java

@ -135,7 +135,7 @@ public class MqSdkUtil {
            msgId = queueTools.putMsg(queueManager, xmlNodeName, reqMsg);
            msgId = queueTools.putMsg(queueManager, xmlNodeName, reqMsg);
            // 获取响应消息
            // 获取响应消息
            respMsg = queueTools.getMsgById(queueManager, xmlNodeName, msgId, 1200000000);
            respMsg = queueTools.getMsgById(queueManager, xmlNodeName, msgId, 1200000000);
            log.info("respMsg=="+respMsg);
            log.info("respMsg=="+reqMsg);
            return respMsg;
            return respMsg;
        } catch (MQException e) {
        } catch (MQException e) {
            // 2033表示队列中没有消息
            // 2033表示队列中没有消息
@ -244,7 +244,6 @@ public class MqSdkUtil {
    public static String xml2jsonArrayRootRow(String xmlString) throws Exception {
    public static String xml2jsonArrayRootRow(String xmlString) throws Exception {
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        JSON json = xmlSerializer.read(xmlString);
        JSON json = xmlSerializer.read(xmlString);
        log.info("json"+json.toString());
        Object retInfo=  ((JSONObject) json).get("RetInfo");
        Object retInfo=  ((JSONObject) json).get("RetInfo");
        Object retCode= ((JSONObject) retInfo).get("RetCode");
        Object retCode= ((JSONObject) retInfo).get("RetCode");
        if(retCode.equals("1")){
        if(retCode.equals("1")){

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -916,6 +916,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                    }
                }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("12")){
                    String price = Integer.parseInt(totalFee)/100+"";
                    BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(businessOrderDO.getRelationCode()));
                    baseNatAppointmentDO.setPayStatus("1");
                    baseNatAppointmentDao.save(baseNatAppointmentDO);
                    String updatesql = "update V_MS_YJ01 t set t.HLWJF=1 where t.yjxh='"+baseNatAppointmentDO.getRealOrder()+"'";
                    try {
                        ykyyEntranceService.updateHisStatus(updatesql);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                }
            }
            }
            if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")&&businessOrderDO.getStatus()!=1){
            if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")&&businessOrderDO.getStatus()!=1){

+ 8 - 1
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -252,10 +252,11 @@ public class YlzPayService {
     * @param recipeTime
     * @param recipeTime
     * @param fee
     * @param fee
     * @param recipeNum
     * @param recipeNum
     * @param pushChannel
     * @return
     * @return
     */
     */
    public String msgPush(String cardType,String cardNo,String accountType,String contactNumber,String feeType,String userNo,String userName,String idNo,String voucherNo,
    public String msgPush(String cardType,String cardNo,String accountType,String contactNumber,String feeType,String userNo,String userName,String idNo,String voucherNo,
                          String applyDepaName,String applyDoctorName,String recipeTime,String fee,String recipeNum){
                          String applyDepaName,String applyDoctorName,String recipeTime,String fee,String recipeNum,String pushChannel){
        String object  = null;
        String object  = null;
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String error = null;
        String error = null;
@ -283,6 +284,12 @@ public class YlzPayService {
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            if (StringUtils.isNoneBlank(pushChannel)){
                jsonObject.put("pushChannel",pushChannel);//推送渠道
            }else {
                jsonObject.put("pushChannel","WX_PUB");//推送渠道
            }
            if (StringUtils.isNoneBlank(fee)){
            if (StringUtils.isNoneBlank(fee)){
                Double free = Double.parseDouble(fee);
                Double free = Double.parseDouble(fee);
                jsonObject.put("fee",free);//总费用
                jsonObject.put("fee",free);//总费用

+ 168 - 0
business/base-service/src/main/java/com/yihu/jw/utils/AES.java

@ -0,0 +1,168 @@
package com.yihu.jw.utils;
import com.yihu.jw.utils.encode.Base64;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.NoSuchAlgorithmException;
public class AES {
    public static String encrypt(String strKey, String strIn) {
        try {
            SecretKeySpec skeySpec = getKey(strKey);
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
            IvParameterSpec iv = new IvParameterSpec(
                    "0102030405060708".getBytes());
            cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
            byte[] encrypted = cipher.doFinal(strIn.getBytes("UTF-8"));
            return Base64.encode(encrypted);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public static String decrypt(String strKey, String strIn) throws Exception {
        try {
            SecretKeySpec skeySpec = getKey(strKey);
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
            IvParameterSpec iv = new IvParameterSpec(
                    "0102030405060708".getBytes());
            cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
            byte[] encrypted1 = Base64.decode(strIn);
            byte[] original = cipher.doFinal(encrypted1);
            String originalString = new String(original, "UTF-8");
            return originalString;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    private static SecretKeySpec getKey(String strKey) throws Exception {
        byte[] arrBTmp = strKey.getBytes();
        byte[] arrB = new byte[16]; // 创建一个空的16位字节数组(默认值为0)
        for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
            arrB[i] = arrBTmp[i];
        }
        SecretKeySpec skeySpec = new SecretKeySpec(arrB, "AES");
        return skeySpec;
    }
    /**
     * 随机生成秘钥
     */
    public static void generateKey(){
        try {
            KeyGenerator kg = KeyGenerator.getInstance("AES");
            kg.init(128);//要生成多少位,只需要修改这里即可128, 192或256
            SecretKey sk = kg.generateKey();
            byte[] b = sk.getEncoded();
            String s = byteToHexString(b);
            System.out.println(s);
            System.out.println("十六进制密钥长度为"+s.length());
            System.out.println("二进制密钥的长度为"+s.length()*4);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            System.out.println("没有此算法。");
        }
    }
    /**
     * byte数组转化为16进制字符串
     * @param bytes
     * @return
     */
    public static String byteToHexString(byte[] bytes){
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            String strHex=Integer.toHexString(bytes[i]);
            if(strHex.length() > 3){
                sb.append(strHex.substring(6));
            } else {
                if(strHex.length() < 2){
                    sb.append("0" + strHex);
                } else {
                    sb.append(strHex);
                }
            }
        }
        return  sb.toString();
    }
    public static String signConvertToPara(String region) {
        String target = "";
        if (region != null) {
            target = region.replaceAll("\\+", "%2B").replaceAll("\\ ", "%20")
                    .replaceAll("\\/", "%2F").replaceAll("\\?", "%3F")
                    .replaceAll("\\#", "%23").replaceAll("\\&", "%26")
                    .replaceAll("\\=", "%3D");
        }
        return target;
    }
    public static String paraConvertsign(String region) {
        String target = "";
        if (region != null) {
            target = region.replaceAll("%2B", "+").replaceAll("%20", " ")
                    .replaceAll("%2F", "/").replaceAll("%3F", "?")
                    .replaceAll("%25", "%").replaceAll("%23", "#")
                    .replaceAll("%26", "&").replaceAll("%3D", "=");
        }
        return target;
    }
    //用于和c#互通的加解密
    //https://www.jianshu.com/p/9483c9ea3a04
    /**
     * AES的加密函数
     * @param str 传入需要加密的字符
     * @param key 传入一个16位长度的密钥。否则报错
     * @return 执行成功返回加密结果,否则报错
     * @throws Exception 抛出一个加密异常
     */
    public static String aesEncrypt(String str, String key) throws Exception {
        if (str == null || key == null) return null;
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
        cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes("utf-8"), "AES"));
        byte[] bytes = cipher.doFinal(str.getBytes("utf-8"));
        return new BASE64Encoder().encode(bytes);
    }
    /**
     * AES的解密函数
     * @param str 传入需要解密的字符
     * @param key 传入一个16位长度的密钥。否则报错
     * @return 执行成功返回加密结果,否则报错
     * @throws Exception 抛出一个解密异常
     */
    public static String aesDecrypt(String str, String key) throws Exception {
        if (str == null || key == null) return null;
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getBytes("utf-8"), "AES"));
        byte[] bytes = new BASE64Decoder().decodeBuffer(str);
        bytes = cipher.doFinal(bytes);
        return new String(bytes, "utf-8");
    }
    public static void main(String[] args) throws Exception {
        generateKey();
        String testKey = "xmxzzxtj";
        String testEn = AES.encrypt(testKey, "{'function':'healthExam','yyid00':'220006','userId':'','name':'','phone':'','identityCard':'','icCard':''}");
        System.out.println(testEn);
        String testDe = AES.decrypt(testKey, testEn);
        System.out.println(testDe);
    }
}

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

@ -1,6 +1,5 @@
package com.yihu.jw.entity;
package com.yihu.jw.entity;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.persistence.*;
@ -19,13 +18,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
    @Id
//==========mysql 环境 id策略======================================================
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
 /*   @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
    public Integer getId() {
        return id;
        return id;

+ 29 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java

@ -9,7 +9,7 @@ import java.util.Date;
@Entity
@Entity
@Table(name = "base_nat_appointment")
@Table(name = "base_nat_appointment")
@SequenceGenerator(name="id_generated", sequenceName="base_nat_appointment")
@SequenceGenerator(name="id_generated", sequenceName="BASE_NAT_APPOINTMENT_SEQ")
public class BaseNatAppointmentDO extends IntegerIdentityEntity {
public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String cardType;
    private String cardType;
    private String cardNo;
    private String cardNo;
@ -54,6 +54,10 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String doctorName;
    private String doctorName;
    private String voucherNo;
    private String voucherNo;
    private String registerNo;
    private String registerNo;
    private String ampm;
    private String cardNoType;
    private String hospitalFlag;
    public String getMedicare() {
    public String getMedicare() {
        return medicare;
        return medicare;
@ -399,4 +403,28 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    public void setRegisterNo(String registerNo) {
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
        this.registerNo = registerNo;
    }
    }
    public String getAmpm() {
        return ampm;
    }
    public void setAmpm(String ampm) {
        this.ampm = ampm;
    }
    public String getCardNoType() {
        return cardNoType;
    }
    public void setCardNoType(String cardNoType) {
        this.cardNoType = cardNoType;
    }
    public String getHospitalFlag() {
        return hospitalFlag;
    }
    public void setHospitalFlag(String hospitalFlag) {
        this.hospitalFlag = hospitalFlag;
    }
}
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkEmrJcsqDO.java

@ -289,4 +289,5 @@ public class YkEmrJcsqDO {
    public void setJzxh(Integer jzxh) {
    public void setJzxh(Integer jzxh) {
        this.jzxh = jzxh;
        this.jzxh = jzxh;
    }
    }
}
}

+ 325 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj01DO.java

@ -6,7 +6,7 @@ import javax.persistence.*;
import java.util.Date;
import java.util.Date;
/*
/*
* 检查主表
 * 检查主表
 */
 */
@Entity
@Entity
@Table(name = "V_MS_YJ01")
@Table(name = "V_MS_YJ01")
@ -21,19 +21,49 @@ public class YkMsYj01DO {
    private Integer ksdm;//医生科室
    private Integer ksdm;//医生科室
    private String ysdm;//VEMR_USER.ygdm 医生表中的员工代码
    private String ysdm;//VEMR_USER.ygdm 医生表中的员工代码
    private Integer zxks;//	执行科室VEMR_ORDER_ITEM zxks
    private Integer zxks;//	执行科室VEMR_ORDER_ITEM zxks
    private String zxys;//执行医生
    private Integer zxpb;//执行判别 默认0
    private Integer zxpb;//执行判别 默认0
    private Integer zfpb;//	作废判别  0正常  1作废
    private Integer zfpb;//	作废判别  0正常  1作废
    private Integer Cfbz;//	默认0
    private Integer Cfbz;//	默认0
    private Integer jzxh;//	就诊序号HLWYS_MZ_JZLS的JZXH对应
    private Integer jzxh;//	就诊序号HLWYS_MZ_JZLS的JZXH对应
    private Integer djzt;//默认0
    private Integer djzt;//默认0
    private Integer sqid;//去emr_jcsq里面sqdh
    private Integer qxbz;//取消标准  默认0
    private Integer sqid;//去emr_jcsq里面sqdh,申请ID
    private Integer qxbz;//取消标准  默认0 3、收费处取消  4、收费处取消后执行
    private String xmmc;//项目名称
    private String xmmc;//项目名称
    private Integer ztbh;//项目id  VEMR_ORDER_ITEM_MX
    private Integer ztbh;//项目id  VEMR_ORDER_ITEM_MX
    private Integer ygsf;//默认0
    private Integer ygsf;//默认0
    private Integer jcbw;//默认0
    private Integer jcbw;//默认0
    private Integer zjflag;//默认1
    private Integer ljlx;//默认0
    private Integer zxkslx;
    private Integer zlxz;//默认0
    private String zfgh;
    private Integer zjflag;//默认0,传输标记
    private Integer ljlx;//路径类型
    private String tjhm;//特检号码
    private Date ZXRQ;//执行日期
    private String hjgh;//划价工号
    private String zysx;//注意事项
    private Integer yjgl;//医技关联
    private String hymx;//化验明细
    private String yjph;//医技片号
    private Integer sqwh;//申请文号
    private Integer fjgl;//附加处方;MS_CF02的SBXH
    private Integer fjlb;//附加类别;附加类别(2:药品用法,3:皮试)
    private Integer bwid;//部位编号
    private Integer jbid;//疾病编号
    private String jzkh;//就诊卡号
    private String xml;//申请单XML
    private String sqdmc;//申请单名称
    private String fyly;//费用来源
    private Integer tjfl;//特检分类
    private Date zfsj;//作废时间
    private Integer jmpb;
    private String ssys;//视光手术医生
    private String ssqsl;//手术前视力
    private String sshsl;//手术后视力
    private Integer ghgl;//挂号关联,关联ms_ghmx的sbxh
    private Integer hlwjf;//互联网医院缴费(1已缴费0未缴费)
    private Integer sjly;//数据来源(1互联网医院0眼科通)
    @Basic
    @Basic
    @Id
    @Id
    @Column(name = "YJXH")
    @Column(name = "YJXH")
@ -234,4 +264,294 @@ public class YkMsYj01DO {
    public void setLjlx(Integer ljlx) {
    public void setLjlx(Integer ljlx) {
        this.ljlx = ljlx;
        this.ljlx = ljlx;
    }
    }
    @Basic
    @Column(name = "ZXYS")
    public String getZxys() {
        return zxys;
    }
    public void setZxys(String zxys) {
        this.zxys = zxys;
    }
    @Basic
    @Column(name = "ZXKSLX")
    public Integer getZxkslx() {
        return zxkslx;
    }
    public void setZxkslx(Integer zxkslx) {
        this.zxkslx = zxkslx;
    }
    @Basic
    @Column(name = "ZLXZ")
    public Integer getZlxz() {
        return zlxz;
    }
    public void setZlxz(Integer zlxz) {
        this.zlxz = zlxz;
    }
    @Basic
    @Column(name = "ZFGH")
    public String getZfgh() {
        return zfgh;
    }
    public void setZfgh(String zfgh) {
        this.zfgh = zfgh;
    }
    @Basic
    @Column(name = "TJHM")
    public String getTjhm() {
        return tjhm;
    }
    public void setTjhm(String tjhm) {
        this.tjhm = tjhm;
    }
    @Basic
    @Column(name = "ZXRQ")
    public Date getZXRQ() {
        return ZXRQ;
    }
    public void setZXRQ(Date ZXRQ) {
        this.ZXRQ = ZXRQ;
    }
    @Basic
    @Column(name = "HJGH")
    public String getHjgh() {
        return hjgh;
    }
    public void setHjgh(String hjgh) {
        this.hjgh = hjgh;
    }
    @Basic
    @Column(name = "ZYSX")
    public String getZysx() {
        return zysx;
    }
    public void setZysx(String zysx) {
        this.zysx = zysx;
    }
    @Basic
    @Column(name = "YJGL")
    public Integer getYjgl() {
        return yjgl;
    }
    public void setYjgl(Integer yjgl) {
        this.yjgl = yjgl;
    }
    @Basic
    @Column(name = "HYMX")
    public String getHymx() {
        return hymx;
    }
    public void setHymx(String hymx) {
        this.hymx = hymx;
    }
    @Basic
    @Column(name = "YJPH")
    public String getYjph() {
        return yjph;
    }
    public void setYjph(String yjph) {
        this.yjph = yjph;
    }
    @Basic
    @Column(name = "SQWH")
    public Integer getSqwh() {
        return sqwh;
    }
    public void setSqwh(Integer sqwh) {
        this.sqwh = sqwh;
    }
    @Basic
    @Column(name = "FJGL")
    public Integer getFjgl() {
        return fjgl;
    }
    public void setFjgl(Integer fjgl) {
        this.fjgl = fjgl;
    }
    @Basic
    @Column(name = "FJLB")
    public Integer getFjlb() {
        return fjlb;
    }
    public void setFjlb(Integer fjlb) {
        this.fjlb = fjlb;
    }
    @Basic
    @Column(name = "BWID")
    public Integer getBwid() {
        return bwid;
    }
    public void setBwid(Integer bwid) {
        this.bwid = bwid;
    }
    @Basic
    @Column(name = "JBID")
    public Integer getJbid() {
        return jbid;
    }
    public void setJbid(Integer jbid) {
        this.jbid = jbid;
    }
    @Basic
    @Column(name = "JZKH")
    public String getJzkh() {
        return jzkh;
    }
    public void setJzkh(String jzkh) {
        this.jzkh = jzkh;
    }
    @Basic
    @Column(name = "XML")
    public String getXml() {
        return xml;
    }
    public void setXml(String xml) {
        this.xml = xml;
    }
    @Basic
    @Column(name = "SQDMC")
    public String getSqdmc() {
        return sqdmc;
    }
    public void setSqdmc(String sqdmc) {
        this.sqdmc = sqdmc;
    }
    @Basic
    @Column(name = "FYLY")
    public String getFyly() {
        return fyly;
    }
    public void setFyly(String fyly) {
        this.fyly = fyly;
    }
    @Basic
    @Column(name = "TJFL")
    public Integer getTjfl() {
        return tjfl;
    }
    public void setTjfl(Integer tjfl) {
        this.tjfl = tjfl;
    }
    @Basic
    @Column(name = "ZFSJ")
    public Date getZfsj() {
        return zfsj;
    }
    public void setZfsj(Date zfsj) {
        this.zfsj = zfsj;
    }
    @Basic
    @Column(name = "JMPB")
    public Integer getJmpb() {
        return jmpb;
    }
    public void setJmpb(Integer jmpb) {
        this.jmpb = jmpb;
    }
    @Basic
    @Column(name = "SSYS")
    public String getSsys() {
        return ssys;
    }
    public void setSsys(String ssys) {
        this.ssys = ssys;
    }
    @Basic
    @Column(name = "SSQSL")
    public String getSsqsl() {
        return ssqsl;
    }
    public void setSsqsl(String ssqsl) {
        this.ssqsl = ssqsl;
    }
    @Basic
    @Column(name = "SSHSL")
    public String getSshsl() {
        return sshsl;
    }
    public void setSshsl(String sshsl) {
        this.sshsl = sshsl;
    }
    @Basic
    @Column(name = "GHGL")
    public Integer getGhgl() {
        return ghgl;
    }
    public void setGhgl(Integer ghgl) {
        this.ghgl = ghgl;
    }
    @Basic
    @Column(name = "HLWJF")
    public Integer getHlwjf() {
        return hlwjf;
    }
    public void setHlwjf(Integer hlwjf) {
        this.hlwjf = hlwjf;
    }
    @Basic
    @Column(name = "SJLY")
    public Integer getSjly() {
        return sjly;
    }
    public void setSjly(Integer sjly) {
        this.sjly = sjly;
    }
}
}

+ 46 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj02DO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.prescription;
import javax.persistence.*;
import javax.persistence.*;
import javax.persistence.criteria.From;
import javax.persistence.criteria.From;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.util.Date;
/*
/*
 * 检查明细
 * 检查明细
@ -21,7 +22,11 @@ public class YkMsYj02DO {
    private Integer fygb;//SELECT fygb From GY_YLSF Where FYXH =l l_fyxh  查询后结果写入
    private Integer fygb;//SELECT fygb From GY_YLSF Where FYXH =l l_fyxh  查询后结果写入
    private Integer zfbl;//	默认1
    private Integer zfbl;//	默认1
    private Integer zxpb;//默认0
    private Integer zxpb;//默认0
    private Integer zjflag;//	默认0
    private Integer zjflag;//	默认0 传输标记
    private String bzxx;
    private Integer tcylxh;
    private Integer czgh;
    private Date czrq;
    @Basic
    @Basic
    @Id
    @Id
    @Column(name = "SBXH")
    @Column(name = "SBXH")
@ -131,4 +136,44 @@ public class YkMsYj02DO {
    public void setZjflag(Integer zjflag) {
    public void setZjflag(Integer zjflag) {
        this.zjflag = zjflag;
        this.zjflag = zjflag;
    }
    }
    @Basic
    @Column(name = "BZXX")
    public String getBzxx() {
        return bzxx;
    }
    public void setBzxx(String bzxx) {
        this.bzxx = bzxx;
    }
    @Basic
    @Column(name = "TCYLXH")
    public Integer getTcylxh() {
        return tcylxh;
    }
    public void setTcylxh(Integer tcylxh) {
        this.tcylxh = tcylxh;
    }
    @Basic
    @Column(name = "CZGH")
    public Integer getCzgh() {
        return czgh;
    }
    public void setCzgh(Integer czgh) {
        this.czgh = czgh;
    }
    @Basic
    @Column(name = "CZRQ")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}
}

+ 40 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -6,6 +6,9 @@ import org.springframework.util.StringUtils;
import javax.crypto.Cipher;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
/**
 * 前后端数据传输加密工具类
 * 前后端数据传输加密工具类
@ -38,6 +41,43 @@ public class AesEncryptUtils {
        return decryptMysqlNo(name)+" as "+alias+" ";
        return decryptMysqlNo(name)+" as "+alias+" ";
    }
    }
    /**
     * 针对 GROUP_CONCAT 函数,逗号分隔符进行解密
     * @param str
     * @return
     */
    public static String DHFGF(String str){
        char searchChar = ',';
        int count = 0;
        char[] charArray = str.toCharArray();
        for (char item : charArray) {
            if (item == searchChar) {
                count++;
            }
        }
        StringBuffer sb = new StringBuffer();
        String[] ss = new String[count];
        if (count == 0){
            sb.append(AesEncryptUtils.decrypt(str)); ;
        }else {
            for (int i=0;i<count;i++){
                ss = str.split(",") ;
            }
            List<String> list = new ArrayList<String>();
            Collections.addAll(list,ss);
            for (int j=0;j<list.size();j++){
                str = AesEncryptUtils.decrypt(list.get(j));
                sb.append(str);
                if (j == (list.size()-1)){
                    break;
                }
                sb.append(",");
            }
        }
        return sb.toString();
    }
    /**
    /**
     * 加密
     * 加密
     * @param content 加密的字符串
     * @param content 加密的字符串

+ 3 - 3
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -119,7 +119,7 @@ public class HttpClientUtil {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public  String httpPost(String url, Map<String, String> params) throws Exception {
    public static String httpPost(String url, Map<String, String> params) throws Exception {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
        try {
            HttpPost httpPost = new HttpPost(url);
            HttpPost httpPost = new HttpPost(url);
@ -185,7 +185,7 @@ public class HttpClientUtil {
     *            POST参数。
     *            POST参数。
     * @return 所代表远程资源的响应结果
     * @return 所代表远程资源的响应结果
     */
     */
    public  String sendPost(String url, String param) {
    public static  String sendPost(String url, String param) {
        StringBuffer buffer = new StringBuffer();
        StringBuffer buffer = new StringBuffer();
        PrintWriter out = null;
        PrintWriter out = null;
        BufferedReader in = null;
        BufferedReader in = null;
@ -230,7 +230,7 @@ public class HttpClientUtil {
        return buffer.toString();
        return buffer.toString();
    }
    }
    
    
    public  String postBody(String url, com.alibaba.fastjson.JSONObject params) {
    public static   String postBody(String url, com.alibaba.fastjson.JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");

+ 15 - 6
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -197,9 +197,9 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = true) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = true) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = true) String nursingStaffType) {
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = false) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = false) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = false) String nursingStaffType) {
        try{
        try{
            JSONObject result = wlyyDoorServiceOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            JSONObject result = wlyyDoorServiceOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
@ -642,6 +642,15 @@ public class DoorOrderController extends BaseController {
                    if (doctor == null) {
                    if (doctor == null) {
                        continue;
                        continue;
                    }
                    }
                    List<BaseDoctorRoleDO> baseDoctorRoleDOS = baseDoctorRoleDao.findByDoctorCode(doctor.get("id").toString());
                    if (baseDoctorRoleDOS.size()<1){
                        continue;
                    }
                    if (baseDoctorRoleDOS.get(0).getRoleCode().equals("nurse")){
                        continue;
                    }
                    String status = wlyyDoorServiceOrderService.findDispatchStatusByDoctor(doctor.get("id").toString());
                    String status = wlyyDoorServiceOrderService.findDispatchStatusByDoctor(doctor.get("id").toString());
                    JSONObject json = new JSONObject();
                    JSONObject json = new JSONObject();
                    json.put("status", status);
                    json.put("status", status);
@ -905,9 +914,9 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = true) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = true) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = true) String nursingStaffType) {
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = false) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = false) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = false) String nursingStaffType) {
        try{
        try{
            JSONObject result = wlyyDoorServiceOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            JSONObject result = wlyyDoorServiceOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {

+ 23 - 3
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -6,12 +6,14 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.door.dao.*;
import com.yihu.jw.door.dao.*;
import com.yihu.jw.door.dao.followup.FollowUpDao;
import com.yihu.jw.door.dao.followup.FollowUpDao;
import com.yihu.jw.door.util.MessageUtil;
import com.yihu.jw.door.util.MessageUtil;
import com.yihu.jw.door.util.StreamUtil;
import com.yihu.jw.door.util.StreamUtil;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -150,6 +152,8 @@ public class DoorOrderService {
    private FollowUpDao followupDao;
    private FollowUpDao followupDao;
    @Autowired
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    /**
    /**
     * 互联网查询待服务工单数
     * 互联网查询待服务工单数
@ -321,8 +325,15 @@ public class DoorOrderService {
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> getDoorServiceDoctor(String orderId) {
    public List<Map<String, Object>> getDoorServiceDoctor(String orderId) {
        String sql = "SELECT dd.id as id,CONCAT(d.`name`,' (',dd.doctor_job_name,')') as name, dd.doctor from wlyy_door_doctor dd JOIN base_doctor d ON d.id = dd.doctor WHERE order_id=?";
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql, orderId);
        String sql = "SELECT dd.id as id,CONCAT(d.`name`,' (',d.job_title_name,')') as name, d.id \n" +
                "from wlyy_door_doctor dd INNER JOIN wlyy_door_service_order  sor on dd.order_id = sor.id\n" +
                "INNER JOIN base_doctor d ON d.id = sor.doctor WHERE order_id='"+orderId+"' \n" +
                "UNION\n" +
                "\n" +
                "SELECT dd.id as id,CONCAT(d.`name`,' (',d.job_title_name,')') as name, d.id \n" +
                "from wlyy_door_doctor dd INNER JOIN wlyy_door_service_order  sor on dd.order_id = sor.id\n" +
                "INNER JOIN base_doctor d ON d.id = sor.nursing_staff WHERE order_id='"+orderId+"';";
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
        return mapList;
    }
    }
@ -389,6 +400,7 @@ public class DoorOrderService {
        WlyyDoorServiceOrderDO doorServiceOrder = this.doorServiceOrderDao.findOne(orderId);
        WlyyDoorServiceOrderDO doorServiceOrder = this.doorServiceOrderDao.findOne(orderId);
        if(StringUtils.isEmpty(doorServiceOrder.getFollowupDate())){
        if(StringUtils.isEmpty(doorServiceOrder.getFollowupDate())){
            doorServiceOrder.setFollowupDate(DateUtil.getStringDate());
            doorServiceOrder.setFollowupDate(DateUtil.getStringDate());
            doorServiceOrder.setStatus(4);
            doorServiceOrderDao.save(doorServiceOrder);
            doorServiceOrderDao.save(doorServiceOrder);
        }
        }
    }
    }
@ -733,7 +745,15 @@ public class DoorOrderService {
        if(type != null && type == 3 ){
        if(type != null && type == 3 ){
            sql += " and o.type = " + type + " and o.proxy_patient = '" + doctorCode + "'";
            sql += " and o.type = " + type + " and o.proxy_patient = '" + doctorCode + "'";
        }else if(!StringUtils.isEmpty(doctorCode)){
        }else if(!StringUtils.isEmpty(doctorCode)){
            sql+=" and (d.doctor='"+doctorCode+"' or o.doctor='"+doctorCode+"')";
            List<BaseDoctorRoleDO> baseDoctorRoleDOS = baseDoctorRoleDao.findByDoctorCode(doctorCode);
            if (baseDoctorRoleDOS.get(0).getRoleCode().equals("nurse")){
//                sql+=" and (d.doctor='"+doctorCode+"' or o.nursing_staff='"+doctorCode+"')";
                sql+=" and  o.nursing_staff='"+doctorCode+"'";
            }else {
                sql+=" and (d.doctor='"+doctorCode+"' or o.doctor='"+doctorCode+"')";
            }
        }
        }
        if(examPaperStatus!=null){
        if(examPaperStatus!=null){
            sql+=" and o.conclusion_status =1 ";
            sql+=" and o.conclusion_status =1 ";

+ 8 - 2
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -2129,13 +2129,13 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String sql = "select ds.doctor,d.name, d.job_title_name as jobName, 1 as sortFlag " +
        String sql = "select ds.doctor,d.name, d.job_title_name as jobName, 1 as sortFlag " +
                " from wlyy_door_doctor_status ds " +
                " from wlyy_door_doctor_status ds " +
                "        JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "')  d on ds.doctor = d.id " +
                "        JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "')  d on ds.doctor = d.id " +
                " where ds.status in (1,2,3,4)" +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' " +
                " limit " + start + "," + end ;
                " limit " + start + "," + end ;
        String countSql = "select count(ds.id) " +
        String countSql = "select count(ds.id) " +
                "from wlyy_door_doctor_status ds " +
                "from wlyy_door_doctor_status ds " +
                "         JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
                "         JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
                "where ds.status in (1,2,3,4)";
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' ";
        List<Map<String,Object>> doctorList = new ArrayList<>();
        List<Map<String,Object>> doctorList = new ArrayList<>();
        try {
        try {
            doctorList = jdbcTemplate.queryForList(sql);
            doctorList = jdbcTemplate.queryForList(sql);
@ -2267,6 +2267,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        // 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
        // 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() + "_" + consult.getType();
        String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() + "_" + consult.getType();
        if (!StringUtils.isEmpty(nursingStaff)){
            imUtill.updateParticipantNew(sessionId,nursingStaff,null);
        }
        imUtill.updateParticipantNew(sessionId,doctor,null);
        imUtill.updateParticipantNew(sessionId,doctor,null);
        messageUtil.updateMessage(doorServiceOrderDO,new String[]{"402","403","430","435"},"431",dispatcher,dispatcher);
        messageUtil.updateMessage(doorServiceOrderDO,new String[]{"402","403","430","435"},"431",dispatcher,dispatcher);
@ -2348,6 +2351,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() + "_" + consult.getType();
        String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() + "_" + consult.getType();
        imUtill.updateParticipantNew(sessionId,doctor,null);
        imUtill.updateParticipantNew(sessionId,doctor,null);
        if (!StringUtils.isEmpty(nursingStaff)){
            imUtill.updateParticipantNew(sessionId,nursingStaff,null);
        }
        messageUtil.updateMessage(doorServiceOrderDO,new String[]{"402","403","430","435"},"431",dispatcher,dispatcher);
        messageUtil.updateMessage(doorServiceOrderDO,new String[]{"402","403","430","435"},"431",dispatcher,dispatcher);
        // 工单状态变更记录
        // 工单状态变更记录

+ 1 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/followup/FollowUpService.java

@ -178,6 +178,7 @@ public class FollowUpService {
        WlyyDoorServiceOrderDO orderDO = doorServiceOrderDao.findOne(relateCode);
        WlyyDoorServiceOrderDO orderDO = doorServiceOrderDao.findOne(relateCode);
        if(orderDO!=null){
        if(orderDO!=null){
            orderDO.setStatus(4);
            orderDO.setFollowupDate(DateUtil.getStringDate());
            orderDO.setFollowupDate(DateUtil.getStringDate());
        }
        }
    }
    }

+ 57 - 6
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.RegisterService;
import com.yihu.jw.hospital.prescription.service.entrance.RegisterService;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.register.RegisterAmVO;
import com.yihu.jw.restmodel.hospital.register.RegisterAmVO;
@ -43,6 +44,8 @@ public class MqSdkController extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    @Autowired
    private YlzPayService ylzPayService;
    @GetMapping(value = "/BS15017")
    @GetMapping(value = "/BS15017")
    @ApiOperation(value = "固定入参:门诊余额查询")
    @ApiOperation(value = "固定入参:门诊余额查询")
@ -400,8 +403,10 @@ public class MqSdkController extends EnvelopRestEndpoint {
    @GetMapping(value = "/BS10143")
    @GetMapping(value = "/BS10143")
    @ApiOperation(value = "核酸号源查询")
    @ApiOperation(value = "核酸号源查询")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "时间")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "时间")
                               @RequestParam(value = "day", required = true) String day) throws Exception{
        JSONArray  obj = entranceService.BS10143(day,demoFlag);
                               @RequestParam(value = "day", required = true) String day,
                               @ApiParam(name = "pm", value = "pm")
                                   @RequestParam(value = "pm",required = false)String pm) throws Exception{
        JSONArray  obj = entranceService.BS10143(day,pm,demoFlag);
        return success(obj);
        return success(obj);
    }
    }
@ -420,9 +425,11 @@ public class MqSdkController extends EnvelopRestEndpoint {
                               @ApiParam(name = "patientID", value = "患者身份证")
                               @ApiParam(name = "patientID", value = "患者身份证")
                                   @RequestParam(value = "patientID", required = true) String patientID,
                                   @RequestParam(value = "patientID", required = true) String patientID,
                               @ApiParam(name = "patientPhone", value = "患者手机号")
                               @ApiParam(name = "patientPhone", value = "患者手机号")
                                   @RequestParam(value = "patientPhone", required = true) String patientPhone) throws Exception{
                                   @RequestParam(value = "patientPhone", required = true) String patientPhone,
                           @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm", required = true) String pm) throws Exception{
        //String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone
        //String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone
        String   obj = entranceService.BS10144(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,demoFlag);
        String   obj = entranceService.BS10144(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,pm,demoFlag);
        return success(obj);
        return success(obj);
    }
    }
@ -441,9 +448,11 @@ public class MqSdkController extends EnvelopRestEndpoint {
                               @ApiParam(name = "patientID", value = "患者身份证")
                               @ApiParam(name = "patientID", value = "患者身份证")
                               @RequestParam(value = "patientID", required = true) String patientID,
                               @RequestParam(value = "patientID", required = true) String patientID,
                               @ApiParam(name = "patientPhone", value = "患者手机号")
                               @ApiParam(name = "patientPhone", value = "患者手机号")
                               @RequestParam(value = "patientPhone", required = true) String patientPhone) throws Exception{
                               @RequestParam(value = "patientPhone", required = true) String patientPhone,
                           @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm", required = true) String pm) throws Exception{
        //String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone
        //String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone
        String  obj = entranceService.BS10145(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,demoFlag);
        String  obj = entranceService.BS10145(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,pm,demoFlag);
        return success(obj);
        return success(obj);
    }
    }
@ -473,6 +482,48 @@ public class MqSdkController extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(object1.get("respMsg").toString());
            return ObjEnvelop.getError(object1.get("respMsg").toString());
        }
        }
    }
    }
    @GetMapping(value = "/ylzPushMessage")
    @ApiOperation(value = "易慧")
    public Envelop ylzPushMessage(@ApiParam(name = "cardType", value = "卡类型")
                           @RequestParam(value = "cardType", required = false) String cardType,
                           @ApiParam(name = "cardNo", value = "社保卡")
                           @RequestParam(value = "cardNo", required = false) String cardNo,
                           @ApiParam(name = "accountType", value = "预约时间")
                           @RequestParam(value = "accountType", required = false) String accountType,
                           @ApiParam(name = "contactNumber", value = "社保卡")
                           @RequestParam(value = "contactNumber", required = false) String contactNumber,
                           @ApiParam(name = "patientName", value = "患者姓名")
                           @RequestParam(value = "patientName", required = false) String patientName,
                           @ApiParam(name = "feeType", value = "患者身份证")
                           @RequestParam(value = "feeType", required = false) String feeType,
                           @ApiParam(name = "userNo", value = "患者手机号")
                           @RequestParam(value = "userNo", required = false) String userNo,
                           @ApiParam(name = "userName", value = "userName")
                           @RequestParam(value = "userName", required = false) String userName,
                            @ApiParam(name = "idNo", value = "idNo")
                            @RequestParam(value = "idNo", required = false) String idNo,
                            @ApiParam(name = "voucherNo", value = "voucherNo")
                            @RequestParam(value = "voucherNo", required = false) String voucherNo,
                            @ApiParam(name = "applyDepaName", value = "applyDepaName")
                            @RequestParam(value = "applyDepaName", required = false) String applyDepaName,
                            @ApiParam(name = "applyDoctorName", value = "applyDoctorName")
                            @RequestParam(value = "applyDoctorName", required = false) String applyDoctorName,
                            @ApiParam(name = "recipeTime", value = "recipeTime")
                            @RequestParam(value = "recipeTime", required = false) String recipeTime,
                              @ApiParam(name = "fee", value = "fee")
                                  @RequestParam(value = "fee", required = false) String fee,
                              @ApiParam(name = "recipeNum", value = "recipeNum")
                                  @RequestParam(value = "recipeNum", required = false) String recipeNum,
                                  @ApiParam(name = "pushChannel", value = "pushChannel")
                                      @RequestParam(value = "pushChannel", required = false) String pushChannel) throws Exception{
        //String deptCode,String docCode,String startTime,String sSID,String patientName,String patientID,String patientPhone
        String   obj = ylzPayService.msgPush(cardType,cardNo,accountType,contactNumber,feeType,userNo,userName,idNo,voucherNo,
                applyDepaName,applyDoctorName,recipeTime,fee,recipeNum,pushChannel);
        return success(obj);
    }
    @GetMapping(value = "/getUserInfoByOpenid")
    @GetMapping(value = "/getUserInfoByOpenid")
    @ApiOperation(value = "获取用户信息")
    @ApiOperation(value = "获取用户信息")
    public ObjEnvelop getUserInfoByOpenid(
    public ObjEnvelop getUserInfoByOpenid(

+ 4 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -305,6 +305,8 @@ public class YkyyController extends EnvelopRestEndpoint {
                ykMsYj01DO.setJcbw(0);
                ykMsYj01DO.setJcbw(0);
                ykMsYj01DO.setZjflag(1);
                ykMsYj01DO.setZjflag(1);
                ykMsYj01DO.setLjlx(0);
                ykMsYj01DO.setLjlx(0);
                ykMsYj01DO.setHlwjf(0);
                ykMsYj01DO.setSjly(1);
                System.out.println(ykMsYj01DO);
                System.out.println(ykMsYj01DO);
                ykyyEntranceService.save(ykMsYj01DO);
                ykyyEntranceService.save(ykMsYj01DO);
                String sqlCxzt = "Select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl as \"fysl\" from VEMR_ORDER_ITEM_MX t where t.zlxmid ='"+ykEmrJcsqDO.getXmid()+"'";
                String sqlCxzt = "Select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl as \"fysl\" from VEMR_ORDER_ITEM_MX t where t.zlxmid ='"+ykEmrJcsqDO.getXmid()+"'";
@ -325,7 +327,8 @@ public class YkyyController extends EnvelopRestEndpoint {
                        YkMsYj02DO ykMsYj02DO = new YkMsYj02DO();
                        YkMsYj02DO ykMsYj02DO = new YkMsYj02DO();
                        ykMsYj02DO.setSbxh(sbxh.intValue());
                        ykMsYj02DO.setSbxh(sbxh.intValue());
                        ykMsYj02DO.setYjxh(ykMsYj01DO.getYjxh());
                        ykMsYj02DO.setYjxh(ykMsYj01DO.getYjxh());
                        ykMsYj02DO.setYlxh(ykEmrJcsqDO.getXmid());
                        /*ykMsYj02DO.setYlxh(ykEmrJcsqDO.getXmid());*/
                        ykMsYj02DO.setYlxh(map.get("fyxh")!=null?Integer.parseInt(map.get("fyxh").toString()):0);
                        Integer sqsl = ykEmrJcsqDO.getSqsl();
                        Integer sqsl = ykEmrJcsqDO.getSqsl();
                        ykMsYj02DO.setYlsl(Integer.valueOf(map.get("fysl").toString())*sqsl);
                        ykMsYj02DO.setYlsl(Integer.valueOf(map.get("fysl").toString())*sqsl);
                        ykMsYj02DO.setYjzx(i==0?1:0);
                        ykMsYj02DO.setYjzx(i==0?1:0);

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java

@ -238,7 +238,7 @@ public class TimeoutOverDueService {
                    if (patientMappingDO != null) {
                    if (patientMappingDO != null) {
                        userNo = patientMappingDO.getMappingCode();
                        userNo = patientMappingDO.getMappingCode();
                    }
                    }
                    entranceService.BS10145(baseNatAppointmentDO.getDept(),baseNatAppointmentDO.getDoctorId(), DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),userNo,baseNatAppointmentDO.getMobile(),false);
                    entranceService.BS10145(baseNatAppointmentDO.getDept(),baseNatAppointmentDO.getDoctorId(), DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),userNo,baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),false);
                    //取消挂号
                    //取消挂号
                } catch (Exception e) {
                } catch (Exception e) {
                    e.printStackTrace();
                    e.printStackTrace();

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -533,7 +533,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
                    }
                    }
					if (!free.equalsIgnoreCase("0")){
					if (!free.equalsIgnoreCase("0")){
						ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1");
						ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1","WX_PUB");
					}
					}
					logger.info("发送诊查费支付模板消息end");
					logger.info("发送诊查费支付模板消息end");
				}
				}

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -693,7 +693,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				}
				}
				if (!free.equalsIgnoreCase("0")){
				if (!free.equalsIgnoreCase("0")){
					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1");
					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1","WX_PUB");
				}
				}
				logger.info("发送诊查费支付模板消息end");
				logger.info("发送诊查费支付模板消息end");
			}
			}

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

@ -883,6 +883,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        JSONObject object = param.getJSONObject("externalMap");
                        JSONObject object = param.getJSONObject("externalMap");
                        String cardNo = object.getString("cardNo");
                        String cardNo = object.getString("cardNo");
                        String traceNo = object.getString("traceNo");
                        String traceNo = object.getString("traceNo");
                        String channelId = object.getString("channelId");
                        String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
                        String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
                        JSONObject jsonObjectTotal = JSONObject.parseObject(result);
                        JSONObject jsonObjectTotal = JSONObject.parseObject(result);
                        logger.info("查询在线结算处方信息"+jsonObjectTotal);
                        logger.info("查询在线结算处方信息"+jsonObjectTotal);
@ -942,45 +943,61 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
                                        logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
                                    }
                                    }
                                }
                                }
                                //判断检查订单
                                List<BaseNatAppointmentDO> baseNatAppointmentDOS = baseNatAppointmentDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (BaseNatAppointmentDO natAppointmentDO:baseNatAppointmentDOS){
                                    natAppointmentDO.setPayStatus("1");
                                    baseNatAppointmentDao.save(natAppointmentDO);
                                    //发送支付成功通知
                                    String pushPayLog = null;
                                    String fee = waitPayDetailVO.getFee();
                                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                                        String title="您在厦门大学附属中山医院有一笔交易已支付完成!";
                                        pushPayLog = payInfoNoticeService.pushPrescriptionPayAndHsjc(natAppointmentDO.getPatientId(),natAppointmentDO.getDoctorName(),voucherNo,natAppointmentDO.getId()+"",fee,title,null);
                                    }
                                    //发送预约成功通知
                                    String name= natAppointmentDO.getName();
                                    String idcard = natAppointmentDO.getCardNo();
                                    String mobile = natAppointmentDO.getMobile();
                                    String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                    String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                    String first = "尊敬的用户"+name+",您已完成线上自助核酸检测开单预约";
                                    String contentMsg = "申请人:"+name+";预约时间:"+date+";发票流水号:"+waitPayDetailVO.getRecipeNo();
                                    String remark="备注:1、请您持核酸开单预约信息和发票流水号、医保卡/就诊卡/电子健康卡,提前15分钟至我院五号楼北侧(急诊部后侧)核酸检测点?号取管窗口绑定检测。" +
                                            "2、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                    String responseMsg="";
                                    if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                                        responseMsg = entranceService.ehospitalNotice(
                                                name,
                                                idcard,
                                                mobile,
                                                first,
                                                url,
                                                contentMsg,
                                                remark);
                                        logger.info("中山发送模板消息返回结果="+responseMsg);
                                        System.out.println("结束发送模板消息");
                                    }
                                }
                            }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().contains("鼻/咽拭子")){
                                    //判断检查订单
                                    List<BaseNatAppointmentDO> baseNatAppointmentDOS = baseNatAppointmentDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                    for (BaseNatAppointmentDO natAppointmentDO:baseNatAppointmentDOS){
                                        if (channelId.contains("WX")){
//发送支付成功通知
                                            String pushPayLog = null;
                                            String fee = waitPayDetailVO.getFee();
                                            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                                                String title="您在厦门大学附属中山医院有一笔交易已支付完成!";
                                                pushPayLog = payInfoNoticeService.pushPrescriptionPayAndHsjc(natAppointmentDO.getPatientId(),natAppointmentDO.getDoctorName(),waitPayDetailVO.getVoucherNo(),natAppointmentDO.getId()+"",fee,title,null,waitPayDetailVO.getRecipeNo());
                                            }
                                            //发送预约成功通知
                                            String name= natAppointmentDO.getName();
                                            String idcard = natAppointmentDO.getCardNo();
                                            String mobile = natAppointmentDO.getMobile();
                                            String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                            String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                            String first = "尊敬的用户"+name+",您已完成线上自助核酸检测预约申请";
                                            String contentMsg = "申请人:"+name+"\r\n 预约时间:"+date+" \r\n发票流水号:"+waitPayDetailVO.getRecipeNo();
                                            String remark="1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                                    "2、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                            String responseMsg="";
                                            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                                                responseMsg = entranceService.ehospitalNotice(
                                                        name,
                                                        idcard,
                                                        mobile,
                                                        first,
                                                        url,
                                                        contentMsg,
                                                        remark);
                                                logger.info("中山发送模板消息返回结果="+responseMsg);
                                                System.out.println("结束发送模板消息");
                                            }
                                        }else if (channelId.contains("ALI")){
                                            if (natAppointmentDO.getPayStatus().equalsIgnoreCase("0")){
                                                logger.info("支付宝发送模板消息开始111");
                                                String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                                String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"3",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo());
                                                logger.info("支付宝发送模板消息结束1111");
                                                logger.info("支付宝发送模板消息结束22222");
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"13",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo());
                                                logger.info("支付宝发送模板消息结束2222222");
                                            }
                                        }
                                        natAppointmentDO.setPayStatus("1");
                                        baseNatAppointmentDao.save(natAppointmentDO);
                                    }
                                }
                                if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
                                if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
                                    logger.info(waitPayDetailVO.getRecipeNo());
                                    logger.info(waitPayDetailVO.getRecipeNo());
                                    List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                    List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
@ -1471,13 +1488,20 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        @RequestParam(value = "patientId", required = false)String patientId,
                                        @RequestParam(value = "patientId", required = false)String patientId,
                                    @ApiParam(name = "id", value = "预约id")
                                    @ApiParam(name = "id", value = "预约id")
                                    @RequestParam(value = "id", required = false)String id,
                                    @RequestParam(value = "id", required = false)String id,
                                    @ApiParam(name = "payStatus", value = "支付状态1支付0未支付")
                                        @RequestParam(value = "payStatus", required = false)String payStatus,
                                    @ApiParam(name = "isSuccess", value = "预约成功状态1成功0失败")
                                        @RequestParam(value = "isSuccess", required = false)String isSuccess,
                                    @ApiParam(name = "appointmentTime", value = "appointmentTime")
                                        @RequestParam(value = "appointmentTime", required = false)String appointmentTime,
                                    @ApiParam(name = "page", value = "页数")
                                    @ApiParam(name = "page", value = "页数")
                                    @RequestParam(value = "page", required = false)Integer page,
                                    @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "pageSize", value = "每页大小")
                                    @ApiParam(name = "pageSize", value = "每页大小")
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) {
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) throws Exception {
        return  prescriptionService.getNatRecords(patientId,id,page,pageSize);
        prescriptionService.savePayStatusByHis(patientId);
        logger.info("同步数据成功");
        return  prescriptionService.getNatRecords(patientId,id,payStatus,appointmentTime,isSuccess,page,pageSize);
    }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findBaseAddress)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findBaseAddress)
    @ApiOperation(value = "查询地址", notes = "查询地址")
    @ApiOperation(value = "查询地址", notes = "查询地址")

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

@ -2514,8 +2514,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping("/BS10143")
    @GetMapping("/BS10143")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "day")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "day")
                               @RequestParam(value = "day",required = false)String day) throws Exception {
        return success(entranceService.BS10143(day,demoFlag));
                               @RequestParam(value = "day",required = false)String day,
                               @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        return success(entranceService.BS10143(day,pm,demoFlag));
    }
    }
    @GetMapping("/BS10144")
    @GetMapping("/BS10144")
    public Envelop BS10144(@ApiParam(name = "deptCode", value = "deptCode")
    public Envelop BS10144(@ApiParam(name = "deptCode", value = "deptCode")
@ -2531,8 +2533,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                           @ApiParam(name = "patientID", value = "patientID")
                           @ApiParam(name = "patientID", value = "patientID")
                               @RequestParam(value = "patientID",required = false)String patientID,
                               @RequestParam(value = "patientID",required = false)String patientID,
                           @ApiParam(name = "patientPhone", value = "patientPhone")
                           @ApiParam(name = "patientPhone", value = "patientPhone")
                               @RequestParam(value = "patientPhone",required = false)String patientPhone) throws Exception {
        return success(entranceService.BS10144(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,demoFlag));
                               @RequestParam(value = "patientPhone",required = false)String patientPhone,
                           @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        return success(entranceService.BS10144(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,pm,demoFlag));
    }
    }
    @GetMapping("/BS10145")
    @GetMapping("/BS10145")
    public Envelop BS10145(@ApiParam(name = "id", value = "id")
    public Envelop BS10145(@ApiParam(name = "id", value = "id")
@ -2578,66 +2582,57 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "townName", value = "townName")
                                      @ApiParam(name = "townName", value = "townName")
                                          @RequestParam(value = "townName",required = false)String townName,
                                          @RequestParam(value = "townName",required = false)String townName,
                                      @ApiParam(name = "streetName", value = "streetName")
                                      @ApiParam(name = "streetName", value = "streetName")
                                          @RequestParam(value = "streetName",required = false)String streetName){
                                          @RequestParam(value = "streetName",required = false)String streetName,
                                      @ApiParam(name = "pm", value = "pm")
                                          @RequestParam(value = "pm",required = false)String pm,
                                      @ApiParam(name = "pushChannel", value = "pushChannel")
                                          @RequestParam(value = "pushChannel",required = false)String pushChannel,
                                      @ApiParam(name = "pushFlag", value = "pushFlag")
                                          @RequestParam(value = "pushFlag",required = false)String pushFlag,
                                      @ApiParam(name = "cardNoType", value = "cardNoType")
                                          @RequestParam(value = "cardNoType",required = false)String cardNoType){
        try {
        try {
            return success(prescriptionService.saveNatAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName));
            return success(prescriptionService.saveNatAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName,pm,pushChannel,pushFlag,cardNoType));
        } catch (Exception e) {
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
        }
    }
    }
    @GetMapping("/natAppointment")
    @ApiOperation(value = "核酸检测预约接口New")
    public Envelop natAppointment(@ApiParam(name = "mediaCard", value = "mediaCard")
                                      @RequestParam(value = "mediaCard",required = false)String mediaCard,
                                      @ApiParam(name = "patientId", value = "patientId")
                                      @RequestParam(value = "patientId",required = false)String patientId,
                                      @ApiParam(name = "name", value = "name")
                                      @RequestParam(value = "name",required = false)String name,
                                      @ApiParam(name = "cardNo", value = "cardNo")
                                      @RequestParam(value = "cardNo",required = false)String cardNo,
                                      @ApiParam(name = "cardType", value = "cardType")
                                      @RequestParam(value = "cardType",required = false)String cardType,
                                      @ApiParam(name = "mobile", value = "mobile")
                                      @RequestParam(value = "mobile",required = false)String mobile,
                                      @ApiParam(name = "firstJobCode", value = "firstJobCode")
                                      @RequestParam(value = "firstJobCode",required = false)String firstJobCode,
                                      @ApiParam(name = "firstJobName", value = "firstJobName")
                                      @RequestParam(value = "firstJobName",required = false)String firstJobName,
                                      @ApiParam(name = "secondJobCode", value = "secondJobCode")
                                      @RequestParam(value = "secondJobCode",required = false)String secondJobCode,
                                      @ApiParam(name = "secondJobName", value = "secondJobName")
                                      @RequestParam(value = "secondJobName",required = false)String secondJobName,
                                      @ApiParam(name = "natTime", value = "natTime")
                                      @RequestParam(value = "natTime",required = false)String natTime,
                                      @ApiParam(name = "address", value = "address")
                                      @RequestParam(value = "address",required = false)String address,
                                      @ApiParam(name = "provinceName", value = "provinceName")
                                      @RequestParam(value = "provinceName",required = false)String provinceName,
                                      @ApiParam(name = "cityName", value = "cityName")
                                      @RequestParam(value = "cityName",required = false)String cityName,
                                      @ApiParam(name = "townName", value = "townName")
                                      @RequestParam(value = "townName",required = false)String townName,
                                      @ApiParam(name = "streetName", value = "streetName")
                                      @RequestParam(value = "streetName",required = false)String streetName){
    @GetMapping("/sendMessage")
    @ApiOperation(value = "预约成功发送模板消息")
    public Envelop sendMessage( @ApiParam(name = "pushChannel", value = "pushChannel")
                                          @RequestParam(value = "pushChannel",required = false)String pushChannel,
                                      @ApiParam(name = "pushFlag", value = "pushFlag")
                                          @RequestParam(value = "pushFlag",required = false)String pushFlag,
                                      @ApiParam(name = "id", value = "id")
                                          @RequestParam(value = "id",required = false)Integer id) throws Exception {
        try {
        try {
            return success(prescriptionService.natAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName));
            return success(prescriptionService.sendMessage(id,pushChannel,pushFlag));
        } catch (Exception e) {
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
        }
    }
    }
    @GetMapping("/registerAndNatPre")
    @ApiOperation(value = "核酸检测挂号接口New")
    public Envelop registerAndNatPre(@ApiParam(name = "id", value = "id")
                           @RequestParam(value = "id",required = false)Integer id) throws Exception {
    @GetMapping("/sendAlipayMessage")
    public Envelop sendAlipayMessage(@ApiParam(name = "code", value = "code")
                           @RequestParam(value = "code",required = false)String code,
                           @ApiParam(name = "patientId", value = "patientId")
                           @RequestParam(value = "patientId",required = false)String patientId,
                           @ApiParam(name = "fee", value = "fee")
                           @RequestParam(value = "fee",required = false)String fee,
                           @ApiParam(name = "redirdctUrl", value = "redirdctUrl")
                           @RequestParam(value = "redirdctUrl",required = false)String redirdctUrl,
                          @ApiParam(name = "realorder", value = "realorder")
                          @RequestParam(value = "realorder",required = false)String realorder,
                          @ApiParam(name = "reserverTime", value = "reserverTime")
                          @RequestParam(value = "reserverTime",required = false)String reserverTime) throws Exception {
        try {
        try {
            return success(prescriptionService.registerAndNatPre(id));
            return success(prescriptionService.sendAlipayMessage(patientId,code,fee,redirdctUrl,reserverTime,realorder));
        } catch (Exception e) {
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
        }
    }
    }
}
}

+ 37 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -1,5 +1,6 @@
package com.yihu.iot.service.device;
package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.elasticsearch.ElasticSearchHelper;
import com.yihu.elasticsearch.ElasticSearchHelper;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.company.IotCompanyDao;
@ -509,7 +510,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        list.forEach(one->{
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
@ -561,7 +562,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            list.forEach(one->{
            list.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
@ -573,7 +574,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        list.forEach(one->{
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
@ -582,6 +583,39 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
    }
    public static void main(String[] args) {
        String str = "wfL8T2aAmlBnZv2S8QwZXQ==,BFPvVzBHgwa7plBHhkcOQw==,BD4ExdUzPKini5xns11z6Q==,IJOA+Ug/mjvF+L64a/Dq5g==";
        char searchChar = ',';
        int count = 0;
        char[] charArray = str.toCharArray();
        for (char item : charArray) {
            if (item == searchChar) {
                count++;
            }
        }
        StringBuffer sb = new StringBuffer();
        String[] ss = new String[count];
        if (count == 0){
            sb.append(AesEncryptUtils.decrypt(str)); ;
        }else {
            for (int i=0;i<count;i++){
                ss = str.split(",") ;
            }
            List<String>list = new ArrayList<String>();
            Collections.addAll(list,ss);
            for (int j=0;j<list.size();j++){
                str = AesEncryptUtils.decrypt(list.get(j));
                sb.append(str);
                if (j == (list.size()-1)){
                    break;
                }
                sb.append(",");
            }
        }
        System.out.println(sb.toString());
    }
    public void deleteRepairDevice(String deviceSn) {
    public void deleteRepairDevice(String deviceSn) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findAllByDeviceSn(deviceSn);
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findAllByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){