Explorar o código

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

humingfen %!s(int64=4) %!d(string=hai) anos
pai
achega
c7ac2ff992
Modificáronse 33 ficheiros con 1155 adicións e 1307 borrados
  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. 392 482
      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. 1 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/MqSdkUtil.java
  7. 8 1
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  8. 168 0
      business/base-service/src/main/java/com/yihu/jw/utils/AES.java
  9. 5 0
      common/common-entity/sql记录
  10. 42 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceOrderDO.java
  11. 19 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java
  12. 0 94
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  13. 0 83
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  14. 0 83
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java
  15. 0 126
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java
  16. 0 116
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java
  17. 53 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  18. 3 0
      common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java
  19. 3 3
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  20. 10 4
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  21. 16 4
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  22. 57 6
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  23. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java
  24. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  25. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  26. 61 38
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  27. 42 47
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  28. 24 16
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  29. 95 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  30. 128 151
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  31. 6 20
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  32. 2 3
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java
  33. 0 12
      svr/svr-wlyy-specialist/src/main/resources/application.yml

+ 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 用户名 (不能为空)

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

@ -78,12 +78,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 +271,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 +8264,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 +8362,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 +10457,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 +10544,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 +10564,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 +10582,209 @@ 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= baseNatAppointmentDao.save(baseNatAppointmentDO);
            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){
        try {
            savePayStatusByHis(patientId);
            logger.info("同步结束");
        } catch (Exception e) {
            e.printStackTrace();
        }
        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 +10797,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 +10806,28 @@ 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(isSuccess)){
            sql+=" and t.appointment_time ="+isSuccess;
        }
        if (StringUtils.isNoneBlank(appointmentTime)){
            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,6 +10840,33 @@ 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)){
@ -10782,12 +10900,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 +10918,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 +10960,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;

+ 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")){

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

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

@ -71,3 +71,8 @@ CREATE TABLE `wlyy_followup_drugs` (
ALTER TABLE wlyy_door_fee_detail ADD pay_status TINYINT(1) COMMENT '付款状态:0未付款 1已付款' ;
ALTER TABLE wlyy_door_fee_detail ADD pay_status TINYINT(1) COMMENT '付款状态:0未付款 1已付款' ;
-- 2021-01-28 skj 上门服务添加护理人员相关
alter table base.wlyy_door_service_order add `nursing_staff` varchar(50) DEFAULT NULL COMMENT '护理人员code';
alter table base.wlyy_door_service_order add `nursing_staff_name` varchar(50) DEFAULT NULL COMMENT '护理人员name';
alter table base.wlyy_door_service_order add `nursing_staff_type` varchar(50) DEFAULT NULL COMMENT '接单的医生类型:医生,健管师,护士等';

+ 42 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceOrderDO.java

@ -356,6 +356,21 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
     */
     */
    private String doctorType;
    private String doctorType;
    /**
     * 接单的护理人员code
     */
    private String nursingStaff;
    /**
     * 接单的护理人员姓名
     */
    private String nursingStaffName;
    /**
     * 接单的护理人员类型:医生,健管师,护士等
     */
    private String nursingStaffType;
    /**
    /**
     * 医生预计到达时间
     * 医生预计到达时间
     */
     */
@ -1214,4 +1229,31 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
    public void setFollowupDate(String followupDate) {
    public void setFollowupDate(String followupDate) {
        this.followupDate = followupDate;
        this.followupDate = followupDate;
    }
    }
    @Column(name = "nursing_staff")
    public String getNursingStaff() {
        return nursingStaff;
    }
    public void setNursingStaff(String nursingStaff) {
        this.nursingStaff = nursingStaff;
    }
    @Column(name = "nursing_staff_name")
    public String getNursingStaffName() {
        return nursingStaffName;
    }
    public void setNursingStaffName(String nursingStaffName) {
        this.nursingStaffName = nursingStaffName;
    }
    @Column(name = "nursing_staff_type")
    public String getNursingStaffType() {
        return nursingStaffType;
    }
    public void setNursingStaffType(String nursingStaffType) {
        this.nursingStaffType = nursingStaffType;
    }
}
}

+ 19 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java

@ -54,6 +54,9 @@ 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;
    public String getMedicare() {
    public String getMedicare() {
        return medicare;
        return medicare;
@ -399,4 +402,20 @@ 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;
    }
}
}

+ 0 - 94
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -1,94 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label")
//public class PatientLabelDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类型:1.装病类型;2.健康情况;3.自定义',
//    @Column(name = "sort")
//    private Integer sort;//排序',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//    @Column(name = "del")
//    private String del;//1:有效;0:删除',
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public Integer getSort() {
//        return sort;
//    }
//
//    public void setSort(Integer sort) {
//        this.sort = sort;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 0 - 83
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -1,83 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label_info")
//public class PatientLabelInfoDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民code',
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类别',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//}

+ 0 - 83
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java

@ -1,83 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_Article")
//public class SpecialistArticleDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民
//    @Column(name = "patient_name")
//    private String patientName;//居民
//    @Column(name = "doctor")
//    private String doctor;//医生
//    @Column(name = "doctor_name")
//    private String doctorName;//医生
//    @Column(name = "article")
//    private String article;//文章
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getPatientName() {
//        return patientName;
//    }
//
//    public void setPatientName(String patientName) {
//        this.patientName = patientName;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getArticle() {
//        return article;
//    }
//
//    public void setArticle(String article) {
//        this.article = article;
//    }
//}

+ 0 - 126
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java

@ -1,126 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_consult")
//public class SpecialistConsultDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "consult")
//    private String consult;//关联咨询code
//    @Column(name = "doctor")
//    private String doctor;//专科医生
//    @Column(name = "doctor_name")
//    private String doctorName;//专科医生姓名
//    @Column(name = "type")
//    private String type;//类型:1.家庭医生咨询,2.居民咨询
//    @Column(name = "member")
//    private String member;//咨询对象
//    @Column(name = "member_name")
//    private String memberName;//咨询对象
//    @Column(name = "status")
//    private String status;// 1.咨询完成,0.咨询进行中
//    @Column(name = "reply")
//    private String reply;// 1.专科医生已经参与;0.~未参与
//    @Column(name = "content")
//    private String content;//咨询内容
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getConsult() {
//        return consult;
//    }
//
//    public void setConsult(String consult) {
//        this.consult = consult;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getType() {
//        return type;
//    }
//
//    public void setType(String type) {
//        this.type = type;
//    }
//
//
//    public String getMember() {
//        return member;
//    }
//
//    public void setMember(String member) {
//        this.member = member;
//    }
//
//
//    public String getMemberName() {
//        return memberName;
//    }
//
//    public void setMemberName(String memberName) {
//        this.memberName = memberName;
//    }
//
//
//    public String getStatus() {
//        return status;
//    }
//
//    public void setStatus(String status) {
//        this.status = status;
//    }
//
//
//    public String getReply() {
//        return reply;
//    }
//
//    public void setReply(String reply) {
//        this.reply = reply;
//    }
//
//
//    public String getContent() {
//        return content;
//    }
//
//    public void setContent(String content) {
//        this.content = content;
//    }
//}

+ 0 - 116
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java

@ -1,116 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist")
//public class SpecialistDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "name")
//    private String name; //专科医生姓名
//    @Column(name = "profession")
//    private String profession; //专业
//    @Column(name = "profession_name")
//    private String professionName; // 专业名称
//    @Column(name = "dept")
//    private String dept; //科室
//    @Column(name = "dept_name")
//    private String deptName; //科室名称
//
//    @Column(name = "hospital")
//    private String hospital;//医院
//    @Column(name = "hospital_name")
//    private String hospitalName;//医院名称
//    @Column(name = "del")
//    private String del;//1:有效;0:删除
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//
//    public String getProfession() {
//        return profession;
//    }
//
//    public void setProfession(String profession) {
//        this.profession = profession;
//    }
//
//
//    public String getProfessionName() {
//        return professionName;
//    }
//
//
//    public void setProfessionName(String professionName) {
//        this.professionName = professionName;
//    }
//
//
//    public String getDept() {
//        return dept;
//    }
//
//    public void setDept(String dept) {
//        this.dept = dept;
//    }
//
//
//    public String getDeptName() {
//        return deptName;
//    }
//
//    public void setDeptName(String deptName) {
//        this.deptName = deptName;
//    }
//
//    public String getHospital() {
//        return hospital;
//    }
//
//    public void setHospital(String hospital) {
//        this.hospital = hospital;
//    }
//
//
//    public String getHospitalName() {
//        return hospitalName;
//    }
//
//    public void setHospitalName(String hospitalName) {
//        this.hospitalName = hospitalName;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 53 - 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;
/**
/**
 * 前后端数据传输加密工具类
 * 前后端数据传输加密工具类
@ -21,6 +24,56 @@ public class AesEncryptUtils {
    //AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
    //AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
    public static String decryptMysql(String name,String alias){
        return decryptMysql(name)+" as "+alias+" ";
    }
    public static String decryptMysql(String name){
        return ","+decryptMysqlNo(name);
    }
    public static String decryptMysqlNo(String name){
        return "CAST(AES_DECRYPT(from_base64("+name+"), '"+KEY+"') AS char)";
    }
    /**
     * 针对 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 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java

@ -198,6 +198,9 @@ public class IdCardUtil {
     */
     */
    public static String getSexForIdcard(String CardCode)
    public static String getSexForIdcard(String CardCode)
            throws Exception {
            throws Exception {
        if(StringUtils.isEmpty(CardCode)){
            return level_sex_3_name;
        }
        String sex = level_sex_3_name;
        String sex = level_sex_3_name;
        try {
        try {
            if (CardCode.length() == 18) {
            if (CardCode.length() == 18) {

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

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

@ -196,9 +196,12 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "当前医生姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "dispathcherName", value = "当前医生姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @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 = 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);
            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) {
                return error( -1,result.getString(ResponseContant.resultMsg));
                return error( -1,result.getString(ResponseContant.resultMsg));
            }
            }
@ -901,9 +904,12 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @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 = 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);
            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) {
                return error( -1,result.getString(ResponseContant.resultMsg));
                return error( -1,result.getString(ResponseContant.resultMsg));
            }
            }

+ 16 - 4
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -717,7 +717,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        if(StringUtils.isNoneBlank(orderDO.getDoctor())){
        if(StringUtils.isNoneBlank(orderDO.getDoctor())){
            //服务医生修改,直接转派
            //服务医生修改,直接转派
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
            BaseDoctorDO transNursingStaff = doctorDao.findById(orderDO.getNursingStaff());
            sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName(),transNursingStaff.getId(),transNursingStaff.getName(),transNursingStaff.getJobTitleName());
        }
        }
        return result;
        return result;
@ -2214,7 +2215,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
     * @return
     * @return
     */
     */
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public JSONObject sendOrderToDoctor(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
    public JSONObject sendOrderToDoctor(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName,String nursingStaff,String nursingStaffName,String nursingStaffType){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
@ -2247,6 +2248,11 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setNursingStaff(nursingStaff);
        doorServiceOrderDO.setNursingStaffName(nursingStaffName);
        doorServiceOrderDO.setNursingStaffType(nursingStaffType);
        this.save(doorServiceOrderDO);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息
        // 给医生发派单消息
@ -2290,7 +2296,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
     * @return
     * @return
     */
     */
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public JSONObject transferOrder(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
    public JSONObject transferOrder(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName,String nursingStaff,String nursingStaffName,String nursingStaffType){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        if(null == doorServiceOrderDO){
        if(null == doorServiceOrderDO){
@ -2322,6 +2328,11 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setNursingStaff(nursingStaff);
        doorServiceOrderDO.setNursingStaffName(nursingStaffName);
        doorServiceOrderDO.setNursingStaffType(nursingStaffType);
        this.save(doorServiceOrderDO);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息
        // 给医生发派单消息
@ -2872,7 +2883,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            //服务医生修改,直接转派
            //服务医生修改,直接转派
            BaseDoctorDO doctor = doctorDao.findById(doctorCode);
            BaseDoctorDO doctor = doctorDao.findById(doctorCode);
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            transferOrder(orderDO.getId(),null,doctor.getId(),doctor.getName(),transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
            BaseDoctorDO transNursingStaff = doctorDao.findById(orderDO.getNursingStaff());
            transferOrder(orderDO.getId(),null,doctor.getId(),doctor.getName(),transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName(),transNursingStaff.getId(),transNursingStaff.getName(),transNursingStaff.getJobTitleName());
        }
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultFlag, ResponseContant.success);

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

+ 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");
			}
			}

+ 61 - 38
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,19 @@ 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) {
        return  prescriptionService.getNatRecords(patientId,id,page,pageSize);
        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());
        }
        }
    }
    }
}
}

+ 24 - 16
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -266,14 +266,7 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql1.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
            list.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getQualityLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        List<IotDeviceQualityInspectionPlanDO> list = transfor(sql1.toString(),args);
        long count = list.size();
        long count = list.size();
@ -283,6 +276,26 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,qualityInspectionPlanVOList, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,qualityInspectionPlanVOList, page, size,count);
    }
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(String sql,List<Object> args){
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        return transfor(list);
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(String sql){
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        return transfor(list);
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(List<IotDeviceQualityInspectionPlanDO> list){
        for (int i=0;i<list.size();i++){
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
            list.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getQualityLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        return list;
    }
    /**
    /**
     * 质检计划时间提醒
     * 质检计划时间提醒
     * @param time
     * @param time
@ -314,7 +327,7 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
            args.add(time);
            args.add(time);
        }
        }
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        List<IotDeviceQualityInspectionPlanDO> list = transfor(sql.toString(),args);
        return list;
        return list;
@ -332,13 +345,8 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        sql.append(" and c.order_no = ").append(orderNo);
        sql.append(" and c.order_no = ").append(orderNo);
        sql.append("  ORDER BY c.plan_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        sql.append("  ORDER BY c.plan_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        for (int i=0;i<listOrderNo.size();i++){
            listOrderNo.get(i).setQualityLeader(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeader()));
            listOrderNo.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeaderPhone()));
            listOrderNo.get(i).setCreateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getCreateUserName()));
            listOrderNo.get(i).setUpdateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getUpdateUserName()));
        }
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = transfor(sql.toString());
        List<IotDeviceQualityInspectionPlanVO> list = transforList(listOrderNo);
        List<IotDeviceQualityInspectionPlanVO> list = transforList(listOrderNo);
        long count = list.size();
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,list,page,size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,list,page,size,count);

+ 95 - 1
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;
@ -506,6 +507,15 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return list;
        return list;
    }
    }
@ -549,12 +559,63 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            list.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        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){
@ -599,9 +660,23 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
        }
    }
    }
@ -616,7 +691,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        }
        if(StringUtils.isNotBlank(patientName)){
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
//            sql += "and d.patient_name like '%" + patientName + "%' ";
            sql += "and AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a') like '%" + patientName + "%' ";
        }
        }
        if(StringUtils.isNotBlank(deviceName)){
        if(StringUtils.isNotBlank(deviceName)){
            sql += "and d.device_name like '%" + deviceName + "%' ";
            sql += "and d.device_name like '%" + deviceName + "%' ";
@ -638,9 +714,27 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
        }
    }
    }

+ 128 - 151
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -51,8 +52,6 @@ public class SpecialistService{
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Value("${basedb.name}")
    @Value("${basedb.name}")
    private String basedb;
    private String basedb;
    @Value("${encrypt.key}")
    private String key;
    @Autowired
    @Autowired
    private StringRedisTemplate redisTemplate;
    private StringRedisTemplate redisTemplate;
    @Autowired
    @Autowired
@ -74,18 +73,18 @@ public class SpecialistService{
    public MixEnvelop<SpecialistPatientRelationVO, SpecialistPatientRelationVO> findSpecialistPatientRelation(String doctor, Integer page, Integer size)throws ParseException {
    public MixEnvelop<SpecialistPatientRelationVO, SpecialistPatientRelationVO> findSpecialistPatientRelation(String doctor, Integer page, Integer size)throws ParseException {
        String sql = "SELECT " +
        String sql = "SELECT " +
                " r.id, " +
                " r.id, " +
                " r.doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char) AS doctor_name, " +
                " r.saas_id AS sassId, " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patient_name, " +
                " r.health_doctor AS healthDoctor, " +
                " CAST(AES_DECRYPT(from_base64(r.health_doctor_name), '" + key + "') AS char) AS healthDoctorName, " +
                " r.sign_code AS signCode, " +
                " r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctor_name") +
                " ,r.saas_id AS sassId, " +
                " r.patient " +
                 AesEncryptUtils.decryptMysql("r.patient_name","patient_name") +
                " ,r.health_doctor AS healthDoctor " +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                " ,r.sign_code AS signCode, " +
                " r.sign_year AS signYear, " +
                " r.sign_year AS signYear, " +
                " r.sign_doctor AS sign_doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.sign_doctor_name), '" + key + "') AS char) AS signDoctorName, " +
                " r.create_time AS createTime," +
                " r.sign_doctor AS sign_doctor " +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                " ,r.create_time AS createTime," +
                " r.status " +
                " r.status " +
                "FROM " +
                "FROM " +
                " wlyy_specialist_patient_relation r " +
                " wlyy_specialist_patient_relation r " +
@ -135,9 +134,9 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findNoLabelPatientRelation(String doctor){
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findNoLabelPatientRelation(String doctor){
        String sql ="SELECT " +
        String sql ="SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo, " +
                " p.photo, " +
                " rd.create_time AS createTime ," +
                " rd.create_time AS createTime ," +
                " p.sex " +
                " p.sex " +
@ -175,9 +174,9 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findPatientRelatioByAssistant(String doctor , String assistant, Integer page, Integer size){
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findPatientRelatioByAssistant(String doctor , String assistant, Integer page, Integer size){
        String sql ="SELECT " +
        String sql ="SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo ," +
                " p.photo ," +
                " p.sex," +
                " p.sex," +
                " h.label_name as health, " +
                " h.label_name as health, " +
@ -207,8 +206,8 @@ public class SpecialistService{
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
        String sql="SELECT " +
        String sql="SELECT " +
                " CAST(AES_DECRYPT(from_base64(s.patient_name), '" + key + "') AS char)  AS name, " +
                " p. CODE, " +
                " p. CODE " +
                AesEncryptUtils.decryptMysql("s.patient_name","name") +
                " p.sex," +
                " p.sex," +
                " IFNULL( " +
                " IFNULL( " +
                "  YEAR ( " +
                "  YEAR ( " +
@ -222,10 +221,10 @@ public class SpecialistService{
                " p.photo, " +
                " p.photo, " +
                " lb.labelName as health, " +
                " lb.labelName as health, " +
                " lb.label AS healthcode ," +
                " lb.label AS healthcode ," +
                " s.health_assistant AS healthAssistant," +
                " CAST(AES_DECRYPT(from_base64(s.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " s.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("s.health_assistant_name","healthAssistantName") +
//                " s.health_assistant_name AS healthAssistantName," +
//                " s.health_assistant_name AS healthAssistantName," +
                " s.is_manage AS isManage," +
                " ,s.is_manage AS isManage," +
                " s.id AS specialCode" +
                " s.id AS specialCode" +
                " FROM " +
                " FROM " +
                " ( " +
                " ( " +
@ -252,19 +251,19 @@ public class SpecialistService{
        System.out.print("日志:"+sql);
        System.out.print("日志:"+sql);
        if("7".equals(labelType)){
        if("7".equals(labelType)){
            sql = "SELECT " +
            sql = "SELECT " +
                    "c.CODE," +
                    " CAST(AES_DECRYPT(from_base64(a.patient_name), '" + key + "') AS char)  AS name, " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
//                    "c.NAME," +
//                    "c.NAME," +
                    "c.sex," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "c.photo,b.disease AS label," +
                    "c.photo,b.disease AS label," +
                    "b.disease_name AS labelName," +
                    "b.disease_name AS labelName," +
                    "d.label_name AS health," +
                    "d.label_name AS health," +
                    "d.label AS healthcode," +
                    "d.label AS healthcode," +
                    "a.health_assistant AS healthAssistant," +
                    " CAST(AES_DECRYPT(from_base64(a.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
//                    "a.health_assistant_name AS healthAssistantName, " +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    "a.is_manage AS isManage, " +
                    ",a.is_manage AS isManage, " +
                    "a.id AS specialCode " +
                    "a.id AS specialCode " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
@ -281,16 +280,16 @@ public class SpecialistService{
        
        
        if("pending".equals(labelType)){
        if("pending".equals(labelType)){
            sql = "SELECT " +
            sql = "SELECT " +
                    "c.CODE," +
                    " CAST(AES_DECRYPT(from_base64(a.patient_name), '" + key + "') AS char)  AS name, " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
//                    "c.NAME," +
//                    "c.NAME," +
                    "c.sex," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "c.photo," +
                    "c.photo," +
                    "a.health_assistant AS healthAssistant," +
                    " CAST(AES_DECRYPT(from_base64(a.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
//                    "a.health_assistant_name AS healthAssistantName, " +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    "a.is_manage AS isManage " +
                    ",a.is_manage AS isManage " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND (a.is_manage = 0 or a.is_manage is null)" +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND (a.is_manage = 0 or a.is_manage is null)" +
@ -346,10 +345,10 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
        String sql ="SELECT " +
                " p.code AS patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS patientName, " +
//                " p.`name` AS patientName, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex ," +
                " p.sex ," +
                " h.label_name as health, " +
                " h.label_name as health, " +
@ -372,7 +371,7 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND CAST(AES_DECRYPT(from_base64 (r.patient_name),'" + key + "') AS CHAR) LIKE '%"+nameKey+"%' "+
                " AND " + AesEncryptUtils.decryptMysqlNo("r.patient_name") + " LIKE '%"+nameKey+"%' "+
                " LIMIT "+(page-1)*size+","+size;
                " LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -383,10 +382,10 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByNameOrIdCard(String doctor, String filter,String teamCode, Integer page, Integer size){
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByNameOrIdCard(String doctor, String filter,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
        String sql ="SELECT " +
                " p.code AS code, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS code " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS name, " +
//                " p.`name` AS name, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex ," +
                " p.sex ," +
                " p.idcard ," +
                " p.idcard ," +
@ -410,7 +409,7 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND (CAST(AES_DECRYPT(from_base64 (r.patient_name),'" + key + "') AS CHAR) LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " AND (" +  AesEncryptUtils.decryptMysqlNo("r.patient_name")  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " LIMIT "+(page-1)*size+","+size;
                " LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -449,10 +448,10 @@ public class SpecialistService{
        }
        }
        String sql ="SELECT " +
        String sql ="SELECT " +
                " p.code AS patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS patientName, " +
//                " p.`name` AS patientName, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex, " +
                " p.sex, " +
                " h.label_name as health, " +
                " h.label_name as health, " +
@ -487,14 +486,14 @@ public class SpecialistService{
        //1.查询该居民是否已经与该专科医生签约
        //1.查询该居民是否已经与该专科医生签约
        String checkDoctorSql = "SELECT " +
        String checkDoctorSql = "SELECT " +
                " r.id AS relationCode," +
                " r.id AS relationCode," +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
                " t.`name`, " +
                " d.photo ," +
                " d.photo ," +
                " d.code AS doctor," +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName " +
                " d.code AS doctor" +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " d.name AS doctorName" +
//                " d.name AS doctorName" +
                " FROM " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " wlyy_specialist_patient_relation r " +
@ -511,17 +510,7 @@ public class SpecialistService{
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.`name`), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            }
            return MixEnvelop.getSuccess(SpecialistMapping.doctor_exist,specialistTeamVOs.get(0));
            return MixEnvelop.getSuccess(SpecialistMapping.doctor_exist,specialistTeamVOs.get(0));
@ -530,10 +519,10 @@ public class SpecialistService{
        //验证团队是否已经签约
        //验证团队是否已经签约
        String checkTeamSql = "SELECT " +
        String checkTeamSql = "SELECT " +
                " r.id AS relationCode," +
                " r.id AS relationCode," +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
                " t.`name`, " +
                " d.photo " +
                " d.photo " +
                " FROM " +
                " FROM " +
@ -550,17 +539,7 @@ public class SpecialistService{
        if(teamVOs!=null&&teamVOs.size()>0){
        if(teamVOs!=null&&teamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:teamVOs){
            for(SpecialistTeamVO specialistTeamVO:teamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.`name`), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            }
            return MixEnvelop.getSuccess(SpecialistMapping.team_exist,teamVOs.get(0));
            return MixEnvelop.getSuccess(SpecialistMapping.team_exist,teamVOs.get(0));
@ -583,6 +562,20 @@ public class SpecialistService{
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,relationDO.getId());
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,relationDO.getId());
    }
    }
    public List<AdminTeamMemberVO> findTeamMember(Long teamId){
        String menberSql = "SELECT " +
                " m.doctor_code AS doctorCode " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                        " d.`name` AS doctorName " +
                " FROM " +
                " "+basedb+".wlyy_admin_team_member m " +
                " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                " WHERE  " +
                " m.available='1' " +
                " AND m.team_id="+teamId;
        return jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
    }
    public MixEnvelop<Boolean, Boolean> agreeSpecialistTeam(String state, String relationCode, String remark,String health_assistant,String health_assistant_name){
    public MixEnvelop<Boolean, Boolean> agreeSpecialistTeam(String state, String relationCode, String remark,String health_assistant,String health_assistant_name){
        SpecialistPatientRelationDO relation = specialistPatientRelationDao.findOne(relationCode);
        SpecialistPatientRelationDO relation = specialistPatientRelationDao.findOne(relationCode);
@ -607,13 +600,13 @@ public class SpecialistService{
    public MixEnvelop<PatientSignInfoVO, PatientSignInfoVO> findPatientSigninfo(String code){
    public MixEnvelop<PatientSignInfoVO, PatientSignInfoVO> findPatientSigninfo(String code){
        String sql = "SELECT " +
        String sql = "SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
                " r.doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName, " +
                " ,r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " r.doctor_name AS doctorName, " +
//                " r.doctor_name AS doctorName, " +
                " d.hospital, " +
                " ,d.hospital, " +
                " d.hospital_name AS hospitalName, " +
                " d.hospital_name AS hospitalName, " +
                " d.photo, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept, " +
@ -638,16 +631,16 @@ public class SpecialistService{
    public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){
    public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){
        String sql = "SELECT " +
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
                " r.team_code,r.sign_date , " +
                " ,r.team_code,r.sign_date , " +
                " t.`name` AS name," +
                " t.`name` AS name," +
                " d.photo," +
                " d.photo," +
                " md.code AS doctor," +
                " CAST(AES_DECRYPT(from_base64(md.name), '" + key + "') AS char)  AS doctorName, " +
                " md.code AS doctor" +
                AesEncryptUtils.decryptMysql("md.name","doctorName") +
//                " md.name AS doctorName," +
//                " md.name AS doctorName," +
                "d.hospital,d.hospital_name " +
                ",d.hospital,d.hospital_name " +
                " FROM " +
                " FROM " +
                " wlyy_specialist_patient_relation r  " +
                " wlyy_specialist_patient_relation r  " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
@ -661,17 +654,7 @@ public class SpecialistService{
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            }
        }
        }
@ -682,12 +665,12 @@ public class SpecialistService{
        String sql = "SELECT " +
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.patient, " +
                " r.team_code AS teamCode," +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
//                " d.name AS doctorName, " +
//                " d.name AS doctorName, " +
                " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName, " +
                " d.code AS doctor, " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
                " d.dept_name AS deptName, " +
@ -714,16 +697,16 @@ public class SpecialistService{
                "(SELECT " +
                "(SELECT " +
                " r.id AS relationCode," +
                " r.id AS relationCode," +
                " r.patient, " +
                " r.patient, " +
                " r.team_code AS teamCode," +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " r.patient_name AS patientName, " +
                " r.health_assistant AS healthAssistant," +
                " CAST(AES_DECRYPT(from_base64(r.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " ,r.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
//                " r.health_assistant_name AS healthAssistantName," +
//                " r.health_assistant_name AS healthAssistantName," +
                " r.create_time AS createTime," +
                " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName, " +
                " ,r.create_time AS createTime" +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                " d.name AS doctorName, " +
//                " d.name AS doctorName, " +
                " d.code AS doctor, " +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
                " d.dept_name AS deptName, " +
@ -753,10 +736,10 @@ public class SpecialistService{
        
        
        if(StringUtils.isNotBlank(name)){
        if(StringUtils.isNotBlank(name)){
            sql = "SELECT " +
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    " CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  AS NAME, " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
//                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.mobile AS mobile," +
@ -778,13 +761,14 @@ public class SpecialistService{
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode and CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  like '%"+name+"%'";
                    "t ON doctor.CODE=t.doctorcode and " + AesEncryptUtils.decryptMysqlNo("doctor.name")  + "  like '%"+name+"%'";
        }else{
        }else{
            sql = "SELECT " +
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    " CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  AS NAME, " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
//                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.mobile AS mobile," +
@ -832,10 +816,10 @@ public class SpecialistService{
    
    
    public MixEnvelop<PatientRelationVO,PatientRelationVO> getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) {
    public MixEnvelop<PatientRelationVO,PatientRelationVO> getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) {
        String sql ="SELECT " +
        String sql ="SELECT " +
                "p.CODE AS patient," +
                " CAST(AES_DECRYPT(from_base64(p.`name`), '" + key + "') AS char)  AS patientName, " +
                "p.CODE AS patient" +
                AesEncryptUtils.decryptMysql("p.name","patientName") +
//                "p.`name` AS patientName," +
//                "p.`name` AS patientName," +
                "p.photo," +
                ",p.photo," +
                "IFNULL(YEAR (from_days(datediff(now(),p.birthday))),'未知') age," +
                "IFNULL(YEAR (from_days(datediff(now(),p.birthday))),'未知') age," +
                "p.sex " +
                "p.sex " +
                "FROM wlyy.wlyy_patient p " +
                "FROM wlyy.wlyy_patient p " +
@ -845,7 +829,8 @@ public class SpecialistService{
                "  AND doctor='"+specialdoctor+"') " +
                "  AND doctor='"+specialdoctor+"') " +
                "  AND (a.doctor='"+familydoctor+"' OR a.doctor_health='"+familydoctor+"') ";
                "  AND (a.doctor='"+familydoctor+"' OR a.doctor_health='"+familydoctor+"') ";
        if(StringUtils.isNotBlank(nameKey)){
        if(StringUtils.isNotBlank(nameKey)){
            sql= sql + " AND CAST(AES_DECRYPT(from_base64(a.`name`), '" + key + "') AS char) LIKE '%"+nameKey+"%' ";
            sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
        }
        }
        sql= sql +" AND a.`status`=1 AND a.expenses_status=1) s ON p.CODE=s.patient" +
        sql= sql +" AND a.`status`=1 AND a.expenses_status=1) s ON p.CODE=s.patient" +
                " LIMIT "+(page-1)*size+","+size;
                " LIMIT "+(page-1)*size+","+size;
@ -862,7 +847,7 @@ public class SpecialistService{
                "IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                "IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                "p.birthday, " +
                "p.birthday, " +
                "p.photo " +
                "p.photo " +
                "FROM (SELECT s.disease,s.disease_name,s.patient,CAST(AES_DECRYPT(from_base64(s.patient_name), '" + key + "') AS char) as patient_name,r.team_code from " +
                "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
                "(SELECT id, team_code FROM wlyy_specialist_patient_relation WHERE doctor='" + doctor + "' and sign_status > 0 and `status` >= 0) r " +
                "(SELECT id, team_code FROM wlyy_specialist_patient_relation WHERE doctor='" + doctor + "' and sign_status > 0 and `status` >= 0) r " +
                "JOIN "+basedb+".wlyy_patient_disease_server s on r.id = s.specialist_relation_code WHERE s.del = 1) s " +
                "JOIN "+basedb+".wlyy_patient_disease_server s on r.id = s.specialist_relation_code WHERE s.del = 1) s " +
                "JOIN "+basedb+".wlyy_patient p on s.patient = p.`code` where p.`status` >0 ";
                "JOIN "+basedb+".wlyy_patient p on s.patient = p.`code` where p.`status` >0 ";
@ -878,21 +863,6 @@ public class SpecialistService{
    }
    }
//    public Envelop<Boolean> createSpecialists(List<SpecialistDO> info){
//        specialistDao.save(info);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
//    public Envelop<Boolean> createSpecialistArticle(SpecialistArticleDO articleDO){
//        specialistArticleDao.save(articleDO);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
//
//    public Envelop<Boolean> createSpscialistConsult(SpecialistConsultDO consultDO){
//        specialistConsultDao.save(consultDO);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
    /**
    /**
     * 专科-模糊搜索注册居民(未与该医生所在团队医生签约的居民)
     * 专科-模糊搜索注册居民(未与该医生所在团队医生签约的居民)
     * @param doctorCode
     * @param doctorCode
@ -997,7 +967,7 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql));
        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql));
        //3、获取该医生所属团队及团队成员信息
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code,  CAST(AES_DECRYPT(from_base64(wd.NAME), '" + key + "') AS char)  AS doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1048,7 +1018,7 @@ public class SpecialistService{
        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate());
        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate());
        //1、获取居民基础信息
        //1、获取居民基础信息
        String preSql = "SELECT CAST(AES_DECRYPT(from_base64(p.name ), '" + key + "') AS char) as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
        String preSql = "SELECT p.photo as photo" +  AesEncryptUtils.decryptMysql("p.name","name") + ", p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
        String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
        String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
@ -1069,9 +1039,9 @@ public class SpecialistService{
        jsonObject.put("patientInfo", map);
        jsonObject.put("patientInfo", map);
        //2、获取医生信息(所属医院、科室、姓名)
        //2、获取医生信息(所属医院、科室、姓名)
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        if("0".equals(signStatus)){
        if("0".equals(signStatus)){
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
        }
        }
        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql);
        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql);
        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) {
        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) {
@ -1082,7 +1052,8 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", result);
        jsonObject.put("doctorInfo", result);
        //3、获取该医生所属团队及团队成员信息
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code,  CAST(AES_DECRYPT(from_base64(wd.NAME), '" + key + "') AS char) as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1201,12 +1172,14 @@ public class SpecialistService{
     * @return
     * @return
     */
     */
    public List<SpecialistPatientRelationDO> selectByAssistant(String patient,String doctor){
    public List<SpecialistPatientRelationDO> selectByAssistant(String patient,String doctor){
        String sql = "select *,CAST(AES_DECRYPT(from_base64(r.patient_name ), '" + key + "') AS char) as patientName," +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " CAST(AES_DECRYPT(from_base64(r.health_doctor_name), '" + key + "') AS char)  AS healthDoctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.sign_doctor_name), '" + key + "') AS char)  AS signDoctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.create_user_name), '" + key + "') AS char)  AS createUserName " +
        String sql = "select *" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                AesEncryptUtils.decryptMysql("r.create_user_name","createUserName") +
                " from wlyy_specialist_patient_relation r where r.health_assistant = '"+doctor+"' and r.patient = '"+patient+"' ";
                " from wlyy_specialist_patient_relation r where r.health_assistant = '"+doctor+"' and r.patient = '"+patient+"' ";
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        return relationDOS;
        return relationDOS;
@ -1219,7 +1192,8 @@ public class SpecialistService{
     */
     */
    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
        String sql1 = " select count(1) as num ";
        String sql1 = " select count(1) as num ";
        String sql2 = " select CAST(AES_DECRYPT(from_base64(p.name ), '" + key + "') AS char) as name,p.idcard,p.code,p.photo";
        String sql2 = " select p.idcard" + AesEncryptUtils.decryptMysql("p.name","name")  + ",p.code,p.photo";
        String whereSql ="";
        String whereSql ="";
        if(!StringUtils.isEmpty(keywords)){
        if(!StringUtils.isEmpty(keywords)){
            whereSql+=" and  p.mobile ='"+keywords+"'";
            whereSql+=" and  p.mobile ='"+keywords+"'";
@ -1334,10 +1308,12 @@ public class SpecialistService{
        if (!teamCode.equals(toTeamCode)){//跨团队
        if (!teamCode.equals(toTeamCode)){//跨团队
            flag=true;
            flag=true;
        }
        }
        String sql =" select CAST(AES_DECRYPT(from_base64(name), '" + key + "') AS char) as name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        sql =" select CAST(AES_DECRYPT(from_base64(name), '" + key + "') AS char) as name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        String doctorName = jdbcTemplate.queryForObject(sql,String.class);
        String doctorName = jdbcTemplate.queryForObject(sql,String.class);
        doctorName = AesEncryptUtils.decrypt(doctorName);
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        JSONArray planObject = new JSONArray();
        JSONArray planObject = new JSONArray();
        JSONArray planDetailObject = new JSONArray();
        JSONArray planDetailObject = new JSONArray();
@ -1346,6 +1322,7 @@ public class SpecialistService{
        for (String patientCode:patient){
        for (String patientCode:patient){
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            patientName = AesEncryptUtils.decrypt(patientName);
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
                for (PatientRehabilitationPlanDO plan:planList){
                for (PatientRehabilitationPlanDO plan:planList){
                    plan.setCreateUser(toDoctorCode);
                    plan.setCreateUser(toDoctorCode);

+ 6 - 20
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -6,6 +6,7 @@ import com.yihu.jw.dao.SpecialistPatientRelationDao;
import com.yihu.jw.dao.rehabilitation.*;
import com.yihu.jw.dao.rehabilitation.*;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -34,8 +35,6 @@ public class RehabilitationManageService {
    @Value("${basedb.name}")
    @Value("${basedb.name}")
    private String basedb;
    private String basedb;
    @Value("${encrypt.key}")
    private String key;
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
@ -93,7 +92,8 @@ public class RehabilitationManageService {
//            leftSql += " left join "+basedb+".wlyy_patient_disease_server s on p.patient=s.patient and s.del=1 and s.disease ='"+diseaseCode+"'" ;
//            leftSql += " left join "+basedb+".wlyy_patient_disease_server s on p.patient=s.patient and s.del=1 and s.disease ='"+diseaseCode+"'" ;
//        }
//        }
        String leftSql = "";
        String leftSql = "";
        String sql = " select p.*,CAST(AES_DECRYPT(from_base64(p.name), '" + key + "') AS char) as patientName  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select p.*" + AesEncryptUtils.decryptMysql("p.name","patientName") + "  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        if(doctorType==2){//家医是根据签约关系过滤
        if(doctorType==2){//家医是根据签约关系过滤
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
@ -109,7 +109,8 @@ public class RehabilitationManageService {
            sql+=" and p.disease='"+diseaseCode+"'";
            sql+=" and p.disease='"+diseaseCode+"'";
        }
        }
        if(StringUtils.isNotEmpty(patientCondition)){
        if(StringUtils.isNotEmpty(patientCondition)){
            sql += " and CAST(AES_DECRYPT(from_base64(p.name), '" + key + "') AS char) like '%"+patientCondition+"%' ";
            sql += " and " + AesEncryptUtils.descryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        }
        }
        String finalSql = "";
        String finalSql = "";
@ -229,21 +230,6 @@ public class RehabilitationManageService {
            Map<String,Object> specialistMap = specialistRelationList.get(0);
            Map<String,Object> specialistMap = specialistRelationList.get(0);
            resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
            resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
            resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
            resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
//            Integer specialistUnfinishCount = null;
//            Integer specialistFinishCount = null;
//            Integer specialistServiceCount = null;
//            if(specialistMap.get("health_assistant")==null){
//
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
//            }else{
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//            }
//            resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
//            resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
            Integer specialistUnfinishCount1 = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
            Integer specialistUnfinishCount1 = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
            Integer specialistFinishCount1 = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
            Integer specialistFinishCount1 = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
@ -256,7 +242,7 @@ public class RehabilitationManageService {
            resultMap.put("specialistFinishItemCount",specialistFinishCount1-specialistUnfinishCount1+specialistFinishCount2-specialistUnfinishCount2);//完成项目
            resultMap.put("specialistFinishItemCount",specialistFinishCount1-specialistUnfinishCount1+specialistFinishCount2-specialistUnfinishCount2);//完成项目
            resultMap.put("specialistServiceRecordCount",specialistServiceCount1+specialistServiceCount2);//服务次数
            resultMap.put("specialistServiceRecordCount",specialistServiceCount1+specialistServiceCount2);//服务次数
            //家庭医生(包括全科医生、健管师)
            //家庭医生(包括全科医生、健管师)
            String signFamilySql = "SELECT f.*,t.name as teamName,CAST(AES_DECRYPT(from_base64(f.name), '" + key + "') AS char) as patientName FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
            String signFamilySql = "SELECT f.*,t.name as teamName" + AesEncryptUtils.decryptMysql("f.name","patientName") + " FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
            List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
            List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
            if(signFamilyList != null && signFamilyList.size() >0 ) {
            if(signFamilyList != null && signFamilyList.size() >0 ) {
                Map<String, Object> signFamilyMap = signFamilyList.get(0);
                Map<String, Object> signFamilyMap = signFamilyList.get(0);

+ 2 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.rehabilitation.RehabilitationPlanningDO;
import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -53,8 +54,6 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
    private String wechat_base_url;
    private String wechat_base_url;
    @Value("${wechat.appId}")
    @Value("${wechat.appId}")
    private String appId;
    private String appId;
    @Value("${encrypt.key}")
    private String key;
    @Autowired
    @Autowired
    private RehabilitationPlanTemplateDao templateDao;
    private RehabilitationPlanTemplateDao templateDao;
@ -380,7 +379,7 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        int result = 0;
        int result = 0;
        String name= "";
        String name= "";
        String sql ="SELECT rp.patient,CAST(AES_DECRYPT(from_base64(rp.name), '" + key + "') AS char) as name FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan rp ON pd.plan_id = rp.id WHERE pd.id='"+planDetailId+"'";
        String sql ="SELECT rp.patient" + AesEncryptUtils.decryptMysql("rp.name","name") + " FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan rp ON pd.plan_id = rp.id WHERE pd.id='"+planDetailId+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null && list.size()>0){
        if (list!=null && list.size()>0){
            if (String.valueOf(list.get(0).get("patient")).equals(patietCode)){
            if (String.valueOf(list.get(0).get("patient")).equals(patietCode)){

+ 0 - 12
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -104,8 +104,6 @@ im:
  #im_list_get: http://192.168.131.24:3000/
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
  data_base_name: ichat
encrypt:
  key: jkzl2021ZJXL*#%a
---
---
spring:
spring:
  profiles: jwtest
  profiles: jwtest
@ -142,8 +140,6 @@ im:
  im_list_get: http://172.26.0.118:3000/
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
---
spring:
spring:
  profiles: iotyanshi
  profiles: iotyanshi
@ -180,8 +176,6 @@ im:
  im_list_get: http://172.26.0.191:3000/
  im_list_get: http://172.26.0.191:3000/
  data_base_name: im_new
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
---
spring:
spring:
  profiles: jwdevtest
  profiles: jwdevtest
@ -217,9 +211,6 @@ wechat:
im:
im:
  im_list_get: http://172.26.0.118:3000/
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
---
spring:
spring:
  profiles: prod
  profiles: prod
@ -255,6 +246,3 @@ wechat:
im:
im:
  im_list_get: http://27.155.101.77:3000/
  im_list_get: http://27.155.101.77:3000/
  data_base_name: im
  data_base_name: im
encrypt:
  key: jkzl2021ZJXL*#%a