Explorar el Código

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

Shi Kejing hace 4 años
padre
commit
2664e0a4bf
Se han modificado 83 ficheros con 5734 adiciones y 705 borrados
  1. 1 4
      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/mapping/service/PatientMappingService.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionCheckDao.java
  4. 23 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  5. 330 203
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  6. 86 59
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java
  7. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  8. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  9. 50 33
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java
  10. 19 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  11. 140 99
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  12. 13 9
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  13. 48 6
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  14. 5 4
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  15. 1 4
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  16. 14 2
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  17. 51 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java
  18. 103 2
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  19. 1 1
      business/base-service/src/mqConfig/mqdata/MS53001.json
  20. 94 0
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  21. 221 7
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  22. 26 0
      business/sms-service/src/main/java/com/yihu/jw/sms/dao/HospitalSysDictDao.java
  23. 107 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/ZBSmsService.java
  24. 5 0
      common/common-entity-es/pom.xml
  25. 958 0
      common/common-entity-es/src/main/java/com/yihu/jw/followup/FollowupContentESDO.java
  26. 73 0
      common/common-entity/sql记录
  27. 12 1
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorFeeDetailDO.java
  28. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceOrderDO.java
  29. 439 0
      common/common-entity/src/main/java/com/yihu/jw/entity/followup/Followup.java
  30. 104 0
      common/common-entity/src/main/java/com/yihu/jw/entity/followup/FollowupDrugs.java
  31. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  32. 67 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java
  33. 58 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java
  34. 55 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanLogDO.java
  35. 58 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java
  36. 59 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationOperateRecordsDO.java
  37. 3 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  38. 9 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyInspectionVO.java
  39. 11 1
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  40. 20 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  41. 114 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  42. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  43. 78 6
      svr/svr-door-serivce/pom.xml
  44. 85 43
      svr/svr-door-serivce/sql/初始sql.sql
  45. 393 0
      svr/svr-door-serivce/sql/随访记录详情新增索引.txt
  46. 34 2
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  47. 159 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/followup/DoctorFollowUpController.java
  48. 64 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/followup/DoctorFollowupDrugsController.java
  49. 15 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java
  50. 26 3
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java
  51. 8 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/WlyyDoorFeeDetailDao.java
  52. 90 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/followup/FollowUpDao.java
  53. 22 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/followup/FollowupDrugsDao.java
  54. 109 13
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java
  55. 8 25
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java
  56. 9 5
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorPrescriptionService.java
  57. 70 18
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  58. 14 4
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/ServerPackageService.java
  59. 46 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/WlyySystemDictService.java
  60. 485 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/followup/FollowUpService.java
  61. 80 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/followup/FollowupDrugsService.java
  62. 5 2
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/statics/StatisticsUtilService.java
  63. 41 18
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/util/MessageUtil.java
  64. 21 26
      svr/svr-door-serivce/src/main/resources/application.yml
  65. 50 0
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  66. 45 24
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  67. 2 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  68. 2 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java
  69. 7 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/account/PatientEndpoint.java
  70. 5 14
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  71. 36 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  72. 12 19
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  73. 46 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  74. 12 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java
  75. 3 3
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
  76. 16 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java
  77. 3 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java
  78. 4 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java
  79. 11 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanLogDao.java
  80. 3 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationDetailDao.java
  81. 7 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationOperateRecordsDao.java
  82. 155 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  83. 13 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

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

@ -265,7 +265,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        result.setCardNo(idCard);
        result.setCardType(cardType);
        //保存到base_patient表中
        basePatientDO.setMobile(phoneNum);
        //basePatientDO.setMobile(phoneNum);
        basePatientDO.setName(familyName);
        basePatientDO.setIdcard(idCard);
@ -497,9 +497,6 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                for (Map<String,Object> map:list){
                    if (map.get("birthday")!=null){
                        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
                        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                            map.put("birthday",sp.parse(map.get("birthday").toString()));
                        }
                        int age = getAgeByBirth(sp.parse(map.get("birthday").toString()));
                        map.put("age",age);
                    }

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -82,6 +82,9 @@ public class PatientMappingService {
    public String findYkyyPatNoByPatient(String patient,boolean demoFlag)throws Exception{
        logger.info("findYkyyPatNoByPatient:"+patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if(patientDO == null){
            return patient;
        }
        logger.info("patientDO:"+patientDO.toString());
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1");
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");

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

@ -18,6 +18,9 @@ public interface PrescriptionCheckDao extends PagingAndSortingRepository<WlyyPre
    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 and a.status in (1,2,3,4,5) order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByPrescriptionIdAndStatus(String prescriptionId);
    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 and a.status=?2 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByStatus(String prescriptionId,Integer status);

+ 23 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java

@ -88,6 +88,8 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    PrescriptionService prescriptionService;
    @Autowired
    private SfConfigDao sfConfigDao;
@ -591,7 +593,8 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            if(!newroutinfolist.isEmpty()){
                prescriptionExpressageLogDao.save(newroutinfolist);
            }
            //向患者微信推送模板写消息
            pushRouteLogToPatient(newroutinfolist);
            //如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
            if(isContainEndRoutInfo){
                //修改处方状态为完成
@ -643,7 +646,26 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
    }
    //发送微信模板消息
    public void pushRouteLogToPatient(List<WlyyPrescriptionExpressageLogDO> routinfolist){
        boolean isSend = true;//防止80和8000同时存在多向患者端多发一条消息
        for (WlyyPrescriptionExpressageLogDO wlyyPrescriptionExpressageLogDO:routinfolist){
            if ("50".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||
                    "204".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||
            "80".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||"8000".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())){
                if ("80".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||"8000".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())){
                    if (isSend){
                        prescriptionService.sendSFWxTemplate(wlyyPrescriptionExpressageLogDO.getOutpatientId(),wlyyPrescriptionExpressageLogDO.getPrescriptionId(),wlyyPrescriptionExpressageLogDO.getOpCode());
                        isSend= false;
                    }
                }else {
                    prescriptionService.sendSFWxTemplate(wlyyPrescriptionExpressageLogDO.getOutpatientId(),wlyyPrescriptionExpressageLogDO.getPrescriptionId(),wlyyPrescriptionExpressageLogDO.getOpCode());
                }
            }
        }
    }
    /**
     * 根据收寄地址获取快递费用
     * @param d_province 省份名称

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

@ -643,6 +643,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            vo.setWlyyPrescriptionEmrDO(listEmr.get(0));
                        }
                    }
                }else {
                    WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
                    if (wlyyPrescriptionEmrDO1 != null) {
                        vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
                    }
                }
                //支付信息
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
@ -663,15 +668,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expressage", null);
        }
        if (!wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
            //物流配送新
            List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
            List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
            if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
                rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
            } else {
                rs.put("expressageLogs", null);
            }
        //物流配送新
        List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
        if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
            rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
        } else {
            rs.put("expressageLogs", null);
        }
        //预约记录
@ -2423,7 +2426,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDO.setType(1);
            prescriptionDO.setDept(outpatientDO.getDept());
            prescriptionDO.setCreateTime(new Date());
            prescriptionDO.setDeptName(outpatientDO.getDeptName());
            prescriptionDO.setHospital(outpatientDO.getHospital());
            prescriptionDO.setHospitalName(outpatientDO.getHospitalName());
            prescriptionDO.setStatus(10);
            prescriptionDO.setIdcard(outpatientDO.getIdcard());
            prescriptionDO.setPatientCode(outpatientDO.getPatient());
            prescriptionDO.setPatientName(outpatientDO.getPatientName());
            prescriptionDO.setDoctor(outpatientDO.getDoctor());
@ -2619,6 +2626,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result1.put("mes", "开方提交成功");
                result1.put("prescriptionId",prescription.getId());
                return result1;
            }else if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")) {
                Double price = prescription.getDrugFee();
                businessOrderService.recharge(prescription.getId(), "处方收费", "4", "处方收费", prescription.getPatientCode(), prescription.getPatientName(), prescription.getDoctor(), price);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
                return result;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
@ -3022,13 +3036,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String sql = "SELECT  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
                sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
            }else {
                sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
            }
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"expressCreateTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }else {
                sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
                sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
@ -4170,6 +4194,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String first = "";
        String remark = "";
        if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
            //医生拒绝接诊
            if ("9".equals(type)) {
                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
                first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已取消";
@ -4189,11 +4214,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) {
            //医生未接诊时患者等待时间过长的模板提示
            contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
            first = outpatientDO.getConsumerName() + ",您好!";
            logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        }else if("systemCancelRemind".equalsIgnoreCase(titelType)){
            //超过24小时未接诊,系统取消
            if ("9".equals(type)) {
                contentMsg = "图文咨询因超时自动取消。您可重新发起。由于订单取消将不做扣费处理。";
                first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超时未接诊已取消";
@ -4205,7 +4232,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("系统取消接诊入参:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            //患者发起时提醒患者支付诊费消息
            if ("9".equals(type)) {
                contentMsg = "请您先完成预交金充值发起在线问诊,点击详情进行预交金充值,如您已完成请忽略本条信息。";//您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息
                first = outpatientDO.getConsumerName() + ",您好!您有一笔未完成的在线问诊订单,请及时处理。";//您有一个图文复诊订单待支付,请及时支付。
@ -4219,68 +4246,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                if (StringUtils.isNotBlank(outpatientId)){
                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                    first = outpatientDO.getConsumerName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                }else{
                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                    first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                }
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                first = outpatientDO.getConsumerName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                logger.info("图文咨询订单待支付微信消息模板推送开始");
            } else if ("17".equals(type)) {
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                if (StringUtils.isNotBlank(outpatientId)){
                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                    first =  outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                }else{
                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                    first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                }
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                first =  outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                logger.info("视频咨询订单待支付微信消息模板推送开始");
            }
        } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
            //开具处方后向患者发送支付提醒
            first = outpatientDO.getConsumerName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
            logger.info("处方支付微信消息模板推送开始");
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getConsumerName() + ",您好!";
            contentMsg = "" + remindMsg;
            remark = "请您尽快回复";
        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
              if ("16".equals(type)) {
                  first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频复诊已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
                  msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
                  logger.info("视频问诊已接诊提醒微信模板消息发送开始");
              }
              if ("17".equals(type)) {
                  first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频咨询已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
                  if (StringUtils.isNotEmpty(outpatientId)){
                      msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId;
                  }else{
                      msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                  }
                  logger.info("视频咨询已接诊提醒微信模板消息发送开始");
              }
          /*if (consultTeam!=null){
              if ("17".equals(type)) {
                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频咨询已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
                  msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                  logger.info("视频咨询已接诊提醒微信模板消息发送开始");
              }
          }*/
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            //视频复诊预约提醒
            if ("16".equals(type)) {
                msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
                if (StringUtils.isNoneBlank(outpatientDO.getDoctorName())){
@ -4312,6 +4295,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
        } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
            //服务评价提醒
            if (consultTeam.getType()!=null&&1==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
                logger.info("图文咨询服务评价微信消息模板推送开始");
@ -4331,9 +4315,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
            msgUrl="/ims-wx/index.html#/fuwupingjia?consultCode="+consultTeam.getConsult();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)||"sd_tnzyy_wx".equalsIgnoreCase(wxId)) {
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
@ -4349,6 +4331,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String scene = "";
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
                //医生拒绝接诊
                scene = "ysqxjz";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
@ -4372,55 +4355,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("就诊等待过长提示");
            } else if ("payRemind".equalsIgnoreCase(titelType)) {
                //诊费支付提示
                scene = "zxzfts";
                //就诊支付
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
                    if ("9".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                        newConfig.setKeyword1( "图文复诊支付");
                    } else if ("16".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                        newConfig.setKeyword1( "视频复诊支付");
                    }
                    if ("1".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                        newConfig.setKeyword1("图文咨询支付");
                    } else if ("17".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                        newConfig.setKeyword1("视频咨询支付");
                    }
                    newConfig.setKeyword2(outpatientDO.getHospitalName());
                    newConfig.setKeyword3(outpatientDO.getDoctorName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                }else {
                    //咨询支付
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
                        if ("1".equals(type)) {
                            newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                            newConfig.setKeyword1("图文咨询支付");
                        } else if ("17".equals(type)) {
                            newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                            newConfig.setKeyword1("视频咨询支付");
                        }
                        newConfig.setKeyword2( hospitalDO.getOrgName());
                        newConfig.setKeyword3( consDoctorDO.getName());
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                        logger.info("眼科微信消息模板推送 咨询支付提醒开始");
                    }
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
                if ("9".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                    newConfig.setKeyword1( "图文复诊支付");
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                    newConfig.setKeyword1( "视频复诊支付");
                }
                if ("1".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                    newConfig.setKeyword1("图文咨询支付");
                } else if ("17".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                    newConfig.setKeyword1("视频咨询支付");
                }
                newConfig.setKeyword2(outpatientDO.getHospitalName());
                newConfig.setKeyword3(outpatientDO.getDoctorName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 就诊支付提醒开始");
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                //处方开具支付提醒
                scene = "cfzfts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_prescription_pay_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
                newConfig.setKeyword1( "处方支付");
@ -4429,105 +4392,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 处方支付提醒开始");
            } else if ("msgRemind".equalsIgnoreCase(titelType)) {
                scene = "zxxxtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_msg_notice", scene, 1);
            }else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                //视频问诊预约提醒
                scene = "spwzyytx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
                newConfig.setKeyword1( remindMsg);
                newConfig.setKeyword2( DateUtil.getStringDate());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
                scene = "mzxxtx";
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_jz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", StringUtils.isNoneBlank(doctorDO.getJobTitleName())?doctorDO.getJobTitleName():""));
                    newConfig.setKeyword1( outpatientDO.getDoctorName());
                    newConfig.setKeyword2(DateUtil.dateToStrLong(outpatientDO.getAdmDate()));
                    newConfig.setKeyword3(outpatientDO.getDeptName());
                    newConfig.setKeyword4( outpatientDO.getIcd10Name());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                        newConfig.setUrl(newConfig.getUrl().replace("type=16","type=17") + "" + outpatientDO.getId());
                    }
                    //发起微信消息模板推送
                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始");
                }else {
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName()));
                        newConfig.setKeyword1( consDoctorDO.getName());
                        newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间
                        newConfig.setKeyword3( hospitalDO.getDeptName());
                        newConfig.setKeyword4( consultTeam.getSymptoms());
                        if ("16".equals(type)) {
                            newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                        } else if ("17".equals(type)) {
                            newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                        }
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                        logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始");
                    }
                if ("16".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                }
            } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                scene = "spwzyytx";
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("16".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                    }
                    if ("17".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                    }
                    newConfig.setKeyword1( outpatientDO.getConsumerName());
                    newConfig.setKeyword2( outpatientDO.getDeptName());
                    newConfig.setKeyword3( outpatientDO.getDoctorName());
                    newConfig.setKeyword4(DateUtil.dateToStrLong(outpatientDO.getRegisterDate()));
                    newConfig.setKeyword5(generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
                }else {
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        if ("17".equals(type)) {
                            newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                        }
                        newConfig.setKeyword1(consPatientDO.getName());
                        newConfig.setKeyword2(hospitalDO.getDeptName());
                        newConfig.setKeyword3(consDoctorDO.getName());
                        newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq()));
                        newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                        logger.info("眼科微信消息模板推送 视频咨询预约提醒开始");
                    }
                if ("17".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                }
                newConfig.setKeyword1( outpatientDO.getConsumerName());
                newConfig.setKeyword2( outpatientDO.getDeptName());
                newConfig.setKeyword3( outpatientDO.getDoctorName());
                newConfig.setKeyword4(DateUtil.dateToStrLong(outpatientDO.getRegisterDate()));
                newConfig.setKeyword5(generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
            } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
                //服务评价提醒
                scene = "fwqjtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replaceFirst("key1", consPatientDO.getName()));
                newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getOrgName());
                newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                newConfig.setKeyword2(hospitalDO.getOrgName());
                newConfig.setKeyword3(consDoctorDO.getName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                logger.info("眼科微信消息模板推送 服务评价提醒开始");
            } else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
                //系统24小时取消复诊提醒
                scene = "xtqxfz";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_system_cancel", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
@ -4536,6 +4432,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                }else if ("1".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                } else if ("17".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                }
                newConfig.setKeyword1( outpatientDO.getHospitalName());
                newConfig.setKeyword2(outpatientDO.getDoctorName());
@ -4544,8 +4444,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 系统拒诊开始");
            }
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
@ -4571,7 +4469,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        } else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            String responseMsg="";
            //String prefix="https://www.xmheart.com";
            String prefix = "https://ih.xmheart.com/hlwyy";
@ -4584,7 +4481,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        remark,
                        prefix+msgUrl);
            }
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = xzzxEntranceService.sendMes(wxId,
                        consPatientDO.getId(),
@ -4600,7 +4496,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
@ -4633,6 +4528,147 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    /**
     * 发送顺丰物流提醒模板消息
     * @param outpatientId
     */
    public void sendSFWxTemplate(String outpatientId,String prescriptionId,String routeCode){
        String contentMsg = "";
        String first = "";
        String remark = "";
        String patientId = "";
        String drugName = "";
        String remindMsg="";
        String patienName = "";
        String mailNo ="";
        String msgUrl ="";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
        if (wlyyOutpatientDO!=null){
            patientId = wlyyOutpatientDO.getConsumer();
        }
        if (wlyyPrescriptionInfoDOS!=null&&wlyyPrescriptionInfoDOS.size()>0){
            drugName = wlyyPrescriptionInfoDOS.get(0).getDrugName();
        }
        List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS =prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if (wlyyPrescriptionExpressageDOS!=null&&wlyyPrescriptionExpressageDOS.size()>0){
            mailNo = wlyyPrescriptionExpressageDOS.get(0).getMailno();
        }
        switch (routeCode) {
            case "50":
                remindMsg = "已发出";
                break;
            case "204":
                remindMsg = "已在派件";
                break;
            case "80":
                remindMsg = "已签收";
                break;
            case "8000":
                remindMsg = "已签收";
                break;
        }
        BasePatientDO basePatientDO = basePatientDao.findById(patientId);
        if (basePatientDO!=null){
            patienName = basePatientDO.getName();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)||"sd_tnzyy_wx".equalsIgnoreCase(wechatId)){
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
            }
            if (ps.isEmpty()) {
                logger.info("该用户" + patienName + "没有openid,无法推送模版消息,用户ID:" + patientId + "wechatId:" + wechatId);
                return;
            }
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            String scene = "sfxxtx";
            WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_sf_msg_notice", scene, 1);
            BeanUtils.copyProperties(config, newConfig);
            newConfig.setFirst(config.getFirst().replace("key1",remindMsg));
            newConfig.setKeyword1(config.getKeyword1().replace("key1",patienName).replace("key2",drugName));
            newConfig.setKeyword2("顺丰快递");
            newConfig.setKeyword3(mailNo);
            newConfig.setKeyword4(remindMsg);
            newConfig.setRemark(config.getRemark());
            newConfig.setUrl(newConfig.getUrl().replace("key1",outpatientId).replace("key2",prescriptionId));
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
                logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                try {
                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                    logger.info("发送成功");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.info("发送失败,error="+e.getMessage());
                }
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                wxPushLogDO.setCreateTime(new Date());
                wxPushLogDO.setOpenid(one.getOpenid());
                wxPushLogDO.setReceiver(patientId);
                wxPushLogDO.setWechatId(wechatId);
                wxPushLogDO.setReceiverName(patienName);
                wxPushLogDO.setScene(scene);
                wxPushLogDao.save(wxPushLogDO);
            }
        }else {
            first = "您好,您的处方订单物流"+remindMsg;
            contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
            logger.info("推送物流模板消息参数first:"+first+"====contentMsg:"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/logistics?outpatientId="+outpatientId+"&prescriptionCode="+prescriptionId;
            String responseMsg = "";
            if ("xm_xzzx_wx".equalsIgnoreCase(wechatId)) {
                //String prefix="https://www.xmheart.com";
                String prefix = "https://ih.xmheart.com/hlwyy";
                if(StringUtils.isNotEmpty(outpatientId)){
                    responseMsg = xzzxEntranceService.sendMes(wechatId,
                            patientId,
                            basePatientDO.getIdcard(),
                            first,
                            contentMsg,
                            remark,
                            prefix+msgUrl);
                }
                logger.info("url="+prefix+msgUrl);
                String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
                logger.info("发送的信息="+msg);
                logger.info("心脏模板消息发送返回结果:"+responseMsg);
            } else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
                String prefix = "https://hlwyy.xmzsh.com";
                if (StringUtils.isNotEmpty(outpatientId)) {
                    responseMsg = entranceService.ehospitalNotice(
                            patienName,
                            basePatientDO.getIdcard(),
                            basePatientDO.getMobile(),
                            first,
                            prefix + msgUrl,
                            contentMsg,
                            remark
                    );
                    logger.info("中山发送模板消息返回结果="+responseMsg);
                    System.out.println("结束发送模板消息");
                }
            }
            //保存发送模板记录,
            WxPushLogDO wxPushLogDO = new WxPushLogDO();
            wxPushLogDO.setCreateTime(new Date());
            wxPushLogDO.setReceiver(patientId);
            wxPushLogDO.setWechatId(wechatId);
            wxPushLogDO.setReceiverName(patienName);
            wxPushLogDO.setRequest(first+contentMsg+msgUrl);
            wxPushLogDO.setResponse(responseMsg);
            wxPushLogDO.setTempName("顺丰推送的物流消息");
            wxPushLogDao.save(wxPushLogDO);
        }
    }
    public List<WlyyHospitalSysDictDO> findCancelReasonList() {
        return sysDictDao.findByDictName("PatientCancel");
@ -6590,7 +6626,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String str[] = realOrder.split(";");
            Object result = "";
            for (int i=0;i<str.length;i++){
                WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,str[i]);
                WlyyPrescriptionDO wlyyPrescriptionDOS = new WlyyPrescriptionDO();
                if(StringUtils.isNoneBlank(admNo)){
                    wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,str[i]);
                }else {
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(str[i]);
                    if (wlyyPrescriptionDOList!=null&&wlyyPrescriptionDOList.size()!=0){
                        wlyyPrescriptionDOS =wlyyPrescriptionDOList.get(0);
                    }
                }
                System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOS != null);
                if (wlyyPrescriptionDOS != null) {
                    List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
@ -8385,7 +8429,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public List<WlyyPrescriptionCheckDO> findPrescriptionCheck(String prescriptionId) {
        return prescriptionCheckDao.findByPrescriptionId(prescriptionId);
        return prescriptionCheckDao.findByPrescriptionIdAndStatus(prescriptionId);
    }
@ -9652,6 +9696,56 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }else if (jsonObject.getString("code").equalsIgnoreCase("414")&&jsonObject.getString("desc").contains("already")){
                return  refreshToken(userId);
            }
        }
        return null;
    }
    /**
     * 重置云信token
     * @param userId
     * @return
     */
    public String refreshToken(String userId){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/refreshToken.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("重置云信"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
@ -9667,6 +9761,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return null;
    }
    public static void main(String[] args) {
        String ss = DateUtil.getStringDateShort();
        System.out.println(ss);
@ -10197,4 +10292,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return "接口调用失败";
    }
    /**
     * 根据doctorid获取待服务数量
     *
     * @return
     */
    public Long waitUpdoorCount(String doctor) {
       WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("waitUpdoorCount");
       String url = "";
       if (wlyyHospitalSysDictDO!=null){
           url = wlyyHospitalSysDictDO.getDictValue();
       }
       logger.info("waitUpdoorCountUrl:"+url);
       if (StringUtils.isNoneBlank(doctor)){
           url+="?doctor="+doctor;
       }
        Long doorServiceCount = 0L;
       try {
           String res = httpClientUtil.get(url,"UTF-8");
           logger.info("waitUpdoorCountres:"+res);
           if (StringUtils.isNoneBlank(res)){
               com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
               if (jsonObject!=null&&"200".equalsIgnoreCase(jsonObject.getString("status"))){
                   String dataCount = jsonObject.getString("data");
                   doorServiceCount = Long.parseLong(dataCount);
               }
           }
       }catch (Exception e){
           return doorServiceCount;
       }
       return doorServiceCount;
    }
}

+ 86 - 59
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java

@ -34,6 +34,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
@ -131,12 +132,15 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm)throws Exception{
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm,String flag)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo ="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if(StringUtils.isNotBlank(cardNo)){
            BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
        if (StringUtils.isNoneBlank(flag)&&flag.equalsIgnoreCase("his")){
            patNo = patient;
        }else {
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            if(StringUtils.isNotBlank(cardNo)){
                BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
            /*JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(cardNo,false);
            if(res !=null&&res.size()>0){
                JSONObject object = (JSONObject) res.get(0);
@ -144,31 +148,33 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
                    patNo = object.get("brid").toString();
                }
            }*/
            JSONArray res = tnyyEntranceService.selectPatientMappingCode(patientDO.getIdcard());
            if (res!=null&&res.size()!=0){
                JSONObject object = res.getJSONObject(0);
                patNo = object.getString("BRID");
            }
            if(!StringUtils.isBlank(patNo)){
                if (patientMappingDO!=null){
                    patientMappingDO.setMappingCode(patNo);
                }else {
                    patientMappingDO = new PatientMappingDO();
                    patientMappingDO.setMappingCode(patNo);
                    patientMappingDO.setCreateTime(new Date());
                    patientMappingDO.setSource("1");
                    patientMappingDO.setPatient(patient);
                    patientMappingDO.setIdcard(patientDO.getIdcard());
                    patientMappingDO.setPatientName(patientDO.getName());
                JSONArray res = tnyyEntranceService.selectPatientMappingCode(patientDO.getIdcard());
                if (res!=null&&res.size()!=0){
                    JSONObject object = res.getJSONObject(0);
                    patNo = object.getString("BRID");
                }
                if(!StringUtils.isBlank(patNo)){
                    if (patientMappingDO!=null){
                        patientMappingDO.setMappingCode(patNo);
                    }else {
                        patientMappingDO = new PatientMappingDO();
                        patientMappingDO.setMappingCode(patNo);
                        patientMappingDO.setCreateTime(new Date());
                        patientMappingDO.setSource("1");
                        patientMappingDO.setPatient(patient);
                        patientMappingDO.setIdcard(patientDO.getIdcard());
                        patientMappingDO.setPatientName(patientDO.getName());
                    }
                    patientMappingDao.save(patientMappingDO);
                }
                patientMappingDao.save(patientMappingDO);
            }
        }else {
            if (patientMappingDO!=null){
                patNo = patientMappingDO.getMappingCode();
            }else {
                if (patientMappingDO!=null){
                    patNo = patientMappingDO.getMappingCode();
                }
            }
        }
        if(StringUtils.isBlank(patNo)){
            return null;
        }
@ -181,12 +187,31 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        if(StringUtils.isBlank(patNo)){
            return null;
        String patNo = "";
        if (!StringUtil.isEmpty(patient)){
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            if (patientMappingDO!=null){
                patNo = patientMappingDO.getMappingCode();
            }else {
                BasePatientDO basePatientDO = basePatientDao.findById(patient);
                if (basePatientDO!=null){
                    JSONArray res = tnyyEntranceService.selectPatientMappingCode(basePatientDO.getIdcard());
                    if (res!=null&&res.size()!=0){
                        JSONObject object = res.getJSONObject(0);
                        patNo = object.getString("BRID");
                        patientMappingDO= new PatientMappingDO();
                        patientMappingDO.setPatientName(basePatientDO.getName());
                        patientMappingDO.setPatient(patient);
                        patientMappingDO.setMappingCode(patNo);
                        patientMappingDO.setSource("1");
                        patientMappingDO.setIdcard(basePatientDO.getIdcard());
                        patientMappingDao.save(patientMappingDO);
                    }
                }
            }
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" realOrder:"+realOrder+" admNo:"+admNo);
        return tnyyEntranceService.findMS_CF01And02(admNo,demoFlag);
    }
@ -207,9 +232,11 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
        if (wlyyOutpatientVOS!=null&&wlyyOutpatientVOS.size()!=0){
            WlyyOutpatientVO outpatientVO = wlyyOutpatientVOS.get(0);
            BasePatientDO patientDO = basePatientDao.findById(patient);
            outpatientVO.setSex(patientDO.getSex()+"");
            outpatientVO.setBirthday(patientDO.getBirthday());
            outpatientVO.setIdcard(patientDO.getIdcard());
            if (patientDO!=null){
                outpatientVO.setSex(patientDO.getSex()+"");
                outpatientVO.setBirthday(patientDO.getBirthday());
                outpatientVO.setIdcard(patientDO.getIdcard());
            }
            return outpatientVO;
        }
       return null;
@ -485,39 +512,39 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
            }
        }
        JSONArray mapList = new JSONArray();
        mapList = tnyyEntranceService.findTnYpxx(chargeCode, null, null, pyKey,hisCode);
        mapList = tnyyEntranceService.findTnYpxx(chargeCode, null, groupNo, pyKey,hisCode);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("charge_code",map.get("YPXH"));
            object.put("drugname",map.get("YPMC"));
            object.put("specification",map.get("YPGG"));
            object.put("pack_unit_name",map.get("YPDW"));
            object.put("mini_unit",map.get("UNITCODE"));
            object.put("mini_unit_name",map.get("UNTCODENAME"));
            object.put("weigh_unit_name",map.get("ZXDW"));
            object.put("weigh_unit",map.get("ZXDW"));
            object.put("pack_unit",map.get("YPDW"));
            object.put("yfdw",map.get("YFDW"));
            object.put("pack_size",map.get("YFBZ"));
            object.put("charge_code",map.get("serial"));
            object.put("drugname",map.get("drugname"));
            object.put("specification",map.get("specification"));
            object.put("pack_unit_name",map.get("pack_unit_name"));
            object.put("mini_unit",map.get("mini_unit"));
            object.put("mini_unit_name",map.get("mini_unit_name"));
            object.put("weigh_unit_name",map.get("weigh_unit_name"));
            object.put("weigh_unit",map.get("weigh_unit"));
            object.put("pack_unit",map.get("pack_unit"));
            object.put("yfdw",map.get("group_no"));
            object.put("pack_size",map.get("pack_size"));
         /*   object.put("yfsx",map.get("yfsx"));//药房属性*/
            object.put("ypjl",map.get("YPJL"));//药剂量
            object.put("jldw",map.get("JLDW"));//剂量单位
            object.put("py_code",map.get("PYDM"));//拼音代码
            object.put("fyfs",map.get("FYFS"));//发药方式
            object.put("supply_code",map.get("GYFF"));//给药方式
            object.put("yfzf",map.get("YFZF"));//药房作废
            object.put("supply_name",map.get("GYFF"));//给药方式名称
            object.put("ypjl",map.get("ypjl"));//药剂量
            object.put("jldw",map.get("jldw"));//剂量单位
            object.put("py_code",map.get("py_code"));//拼音代码
            /*object.put("fyfs",map.get("FYFS"));//发药方式
            object.put("supply_code",map.get("GYFF"));//给药方式*/
         /*   object.put("yfzf",map.get("YFZF"));//药房作废*/
/*            object.put("supply_name",map.get("GYFF"));//给药方式名称*/
/*            object.put("ybfl",map.get("ybfl"));//医保分类*/
            object.put("retprice",map.get("LSJG"));//零售价格
            object.put("kcsl",map.get("KCSL"));//库存
            object.put("ypcd",map.get("YPCD"));//产地
            object.put("zfpb",map.get("ZFPB"));//作废判别
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志
            object.put("pack_retprice",map.get("BZLJ"));
            if (map.get("XTSB")!=null){
                if (map.getString("XTSB").equalsIgnoreCase("1")){
            object.put("retprice",map.get("retprice"));//零售价格
            object.put("stock_amount",map.get("stock_amount"));//库存
            object.put("ypcd",map.get("manu_name"));//产地
           /* object.put("zfpb",map.get("ZFPB"));//作废判别*/
            object.put("jbywbz",map.get("jbyw"));//基本药物标志
            object.put("pack_retprice",map.get("pack_retprice"));
            if (map.get("group_no")!=null){
                if (map.getString("group_no").equalsIgnoreCase("西药库")||map.getString("group_no").equalsIgnoreCase("成药库")){
                    object.put("group_no",81);
                }else {
                    object.put("group_no",82);

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

@ -277,7 +277,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
@ -635,6 +635,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文
            object.put("stock_amount",map.get("kcsl"));//库存
            array.add(object);
        }
        return array;

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

@ -596,6 +596,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(ksdm)) {
                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + ksdm + "'\"/>");
            }
            sbs.append("<query compy=\"\" item=\"icd_name\" splice=\"and\" value=\"is not null\"/>");
            sbs.append("<order item=\"CON_DATE\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");
@ -1479,6 +1480,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(now)) {
                sbs.append("<query compy=\"&lt;\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + now + "'\"/>");
            }
            sbs.append("<query compy=\"\" item=\"icd_name\" splice=\"and\" value=\"is not null\"/>");
            sbs.append("<order item=\"ADM_DAT\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");

+ 50 - 33
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java

@ -64,7 +64,7 @@ public class TnyyEntranceService {
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    private final static String orgCode ="350211A5004";
    private final static String orgCode ="350211A1002";
    @Autowired
    private PatientMappingDao patientMappingDao;
@ -73,7 +73,7 @@ public class TnyyEntranceService {
    //同步科室
    public String updateTnyyDept() throws Exception {
        String sql = "select KSDM,KSMC,PYDM,PLSX,JGBM from GY_KSDM ";
        String sql = "select KSDM,KSMC,PYDM,PLSX,JGBM from GY_KSDM  ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("updateTnyyDept:"+sql);
@ -90,7 +90,7 @@ public class TnyyEntranceService {
                String ksdm = deptObj.getString("KSDM");
                String jgbm = deptObj.getString("JGBM");
                String ksmc = deptObj.getString("KSMC");
                List<DictHospitalDeptDO> list = hospitalDeptDao.findByOrgCodeAndCode(jgbm,ksdm);
                List<DictHospitalDeptDO> list = hospitalDeptDao.findByOrgCodeAndCode(orgCode,ksdm);
                if (list!=null&&list.size()!=0){
                    DictHospitalDeptDO dictHospitalDeptDO = list.get(0);
                    dictHospitalDeptDO.setCode(ksdm);
@ -114,7 +114,7 @@ public class TnyyEntranceService {
    //更新泰安医生信息
    public String updateTnyyDoctor(String idCard)throws Exception{
        String sql ="select sfzh,LXDH,YGDM,KSDM,YGXM,YGXB,CSNY,YSJJ from GY_YGDM where ZFPB=1 and sfzh is not null ";
        String sql ="select sfzh,LXDH,YGDM,KSDM,YGXM,YGXB,CSNY,YSJJ from GY_YGDM where ZFPB=0 and sfzh is not null and len(ygbh) =3 and ksyq >0 and ksdm <> '2118' ";
        if (StringUtils.isNoneBlank(idCard)){
            sql +=" and sfzh ='"+idCard+"' ";
        }
@ -142,16 +142,17 @@ public class TnyyEntranceService {
                            BaseDoctorDO doctor = doctorDOs.get(0);
                            String salt = randomString(5);
                            /*String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setSalt(salt);*/
                            /*doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));*/
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            doctor.setMobile(doctorJson.getString("LXDH"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
@ -173,13 +174,14 @@ public class TnyyEntranceService {
                            doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setMobile(doctorJson.getString("LXDH"));
                            doctor.setProvinceCode("370000");
                            doctor.setProvinceName("山东省");
                            doctor.setTownCode("370902");
                            doctor.setTownName("泰山区");
                            doctor.setCityCode("370900");
                            doctor.setCityName("泰安市");
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
@ -202,7 +204,7 @@ public class TnyyEntranceService {
                            BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                            hospitalDO.setDoctorCode(temp.getId());
                            hospitalDO.setOrgCode(orgCode);
                            hospitalDO.setOrgName("泰安中医院");
                            hospitalDO.setOrgName("泰安市中医医院");
                            hospitalDO.setDeptCode(doctorJson.getString("KSDM"));
                            hospitalDO.setDel("1");
                            baseDoctorHospitalDao.save(hospitalDO);
@ -220,7 +222,7 @@ public class TnyyEntranceService {
                            mappingDO.setDoctorName(temp.getName());
                            mappingDO.setOrgCode(orgCode);
                            mappingDO.setOrgName("泰安中医院");
                            mappingDO.setOrgName("泰安市中医医院");
                            mappingDO.setMappingCode(doctorJson.getString("YGDM"));
                            mappingDO.setMappingName(temp.getName());
@ -260,21 +262,28 @@ public class TnyyEntranceService {
     * 查询药品信息
     * @param ypdm
     * @param ypmc
     * @param kusl
     * @param group_no
     * @return
     */
    public JSONArray findTnYpxx(String ypdm,String ypmc,String kusl,String pydm ,String hisCode) throws Exception {
        String sql ="SELECT yp.YPXH,yp.XTSB,yp.YPMC,yp.YPGG,yp.YFGG,yp.BFGG,yp.YPSX,yp.TSYP,yp.YPDW,yp.ZXDW,yp.ZXBZ,yp.YFBZ,yp.YFDW,yp.BFBZ," +
    public JSONArray findTnYpxx(String ypdm,String ypmc,String group_no,String pydm ,String hisCode) throws Exception {
        /*String sql ="SELECT yp.YPXH,yp.XTSB,yp.YPMC,yp.YPGG,yp.YFGG,yp.BFGG,yp.YPSX,yp.TSYP,yp.YPDW,yp.ZXDW,yp.ZXBZ,yp.YFBZ,yp.YFDW,yp.BFBZ," +
                "yp.BFDW,yp.ZFPB,yp.YLXZ,yp.FYFS,yp.PYDM,yp.YPBH,yp.MESS,yp.GYFF,yp.TYPE,yp.YPDM,yp.YPJL,yp.JLDW,yp.YKZF,yp.YFZF,yp.ZXCD,yp.YCYL," +
                "kc.YPCD,kc.LSJG,kc.KCSL,kc.BZLJ,yp.UNITCODE,yp.UNTCODENAME  FROM  YK_TYPK yp,YK_KCMX kc where 1=1 and kc.YPXH=yp.YPXH ";
                "kc.YPCD,kc.LSJG,kc.KCSL,kc.BZLJ,yp.UNITCODE,yp.UNTCODENAME  FROM  YK_TYPK yp,YK_KCMX kc where 1=1 and kc.YPXH=yp.YPXH ";*/
        String sql = "SELECT yp.serial,yp.group_no,yp.drugname,yp.dosage,yp.mini_unit,yp.pack_size,yp.specification,yp.retprice,yp.pack_retprice,yp.stock_amount,yp.visible_flag,yp.drug_flag,yp.py_code,yp.pack_unit,yp.manu_name,yp.weigh_unit,yp.vol_unit,yp.mini_unit_name,yp.pack_unit_name,yp.weigh_unit_name,yp.vol_unit_name," +
                "yp.manu_code,yp.ypjl,yp.jldw,yp.fyfs,yp.jbyw  FROM HLW_YP yp where 1=1  ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and lower(YPDM) like '%"+ypdm.toLowerCase()+"%' ";
            sql+=" and lower(yp.serial) like '%"+ypdm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and lower(YPMC) like '%"+ypmc.toLowerCase()+"%' ";
            sql+=" and lower(yp.drugname) like '%"+ypmc.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and lower(PYDM) like '%"+pydm.toLowerCase()+"%' ";
            sql+=" and lower(yp.py_code) like '%"+pydm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(group_no)&&group_no.equalsIgnoreCase("82")){
            sql+=" and yp.group_no='草药库'";
        }else {
            sql+=" and yp.group_no in('成药库','西药库')";
        }
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
@ -408,7 +417,8 @@ public class TnyyEntranceService {
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime,String ksdm) throws Exception{
        String sql = "SELECT h.JZXH,h.GHXH,h.BRBH,h.KSDM,h.YSDM,h.ZYZD,h.KSSJ,h.JSSJ,h.JZZT,h.FZRQ,h.GHFZ,ks.KSMC,yg.YGXM  from YS_MZ_JZLS h,GY_KSDM ks,GY_YGDM yg WHERE yg.YGDM=h.YSDM and ks.KSDM=h.KSDM and  h.BRBH = "+brid+" ";
        String sql = "SELECT h.JZXH,h.GHXH,h.BRBH,h.KSDM,h.YSDM,zd.JBMC as ZYZD,h.KSSJ,h.JSSJ,h.JZZT,h.FZRQ,h.GHFZ,ks.KSMC,yg.YGXM  from YS_MZ_JZLS h,GY_KSDM ks,GY_YGDM yg " +
                " ,GY_JBBM zd  WHERE yg.YGDM=h.YSDM and ks.KSDM=h.KSDM and h.ZYZD = zd.JBXH and  h.BRBH = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }
@ -455,19 +465,17 @@ public class TnyyEntranceService {
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
        String resp = "";
        String orgCode = "350211A5004";
        String orgName = "厦门大学附属厦门眼科中心";
        String orgCode = "350211A1002";
        String orgName = "泰安市中医医院";
        //居民id转化
        PatientMappingDO patientMappingDO = patientMappingDao.findByMappingCodeAndSource(PAT_NO,"1");
        if(patientMappingDO == null){
            return null;
        }
//KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
//                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH
        JSONArray jsonArray = new JSONArray();
        jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime,ksdm);
        jsonArray = findV_ZKSG_HZCX_HIS(PAT_NO,conNo,startTime,endTime,ksdm);
        //查找眼科数据
        if (jsonArray.size() == 0) {
            return null;
@ -485,8 +493,10 @@ public class TnyyEntranceService {
                //wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("KSDM") ? "" : jsonObjectMgsInfo.get("KSDM") + "");
                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("KSMC") ? "" : jsonObjectMgsInfo.get("KSMC") + "");
                wlyyOutpatientVO.setPatient(patientMappingDO.getPatient());
                wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName());
                if (patientMappingDO!=null){
                    wlyyOutpatientVO.setPatient(patientMappingDO.getPatient());
                    wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName());
                }
                wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
                String doctor = null == jsonObjectMgsInfo.get("YSDM") ? "" : jsonObjectMgsInfo.get("YSDM") + "";
@ -661,7 +671,7 @@ public class TnyyEntranceService {
     * @throws Exception
     */
    public JSONArray findVpacsBw(String pyKey) throws Exception{
        String sql = " SELECT bw.DMMC,bw.jcbw,bw.fyxh,bw.FYMC,bw.FYDW,bw.fysl,bw.FYDJ,bw.jclx,bw.JCMC,bw.SRDM FROM V_pacs_BW bw WHERE 1=1   ";
        String sql = " SELECT bw.DMMC,bw.jcbw,bw.fyxh,bw.FYMC,bw.FYDW,bw.fysl,bw.FYDJ,bw.jclx,bw.JCMC,bw.SRDM FROM HLW_PACS_BW bw WHERE 1=1   ";
        if (StringUtils.isNoneBlank(pyKey)){
            sql+= " and  lower(bw.SRDM) like '%"+pyKey+"%' ";
        }
@ -868,7 +878,14 @@ public class TnyyEntranceService {
    public JSONObject getAccessToken() throws Exception {
        String url = "http://tazhongyi.519e.com.cn/Api/ApiReport/GetAccessToken";
        HttpResponse httpResponse = HttpUtils.doPost(url,null);
        String content = httpResponse.getContent();
        logger.info("getAccessToken:"+content);
        JSONObject rs = JSON.parseObject(content);
        return rs;
    }

+ 19 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -340,9 +340,15 @@ public class XzzxEntranceService{
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setExpertise(doctorJson.getString("expertise"));
                            doctor.setIntroduce(doctorJson.getString("introduce"));
                            doctor.setPhoto(doctorJson.getString("photo"));
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
                                doctor.setExpertise(doctorJson.getString("expertise"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
                                doctor.setIntroduce(doctorJson.getString("introduce"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
                                doctor.setPhoto(doctorJson.getString("photo"));
                            }
                            doctor.setIscertified(doctorJson.getString("iscertified"));
                            doctor.setSpell(doctorJson.getString("spell"));
//                                String salt = randomString(5);
@ -415,9 +421,15 @@ public class XzzxEntranceService{
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setExpertise(doctorJson.getString("expertise"));
                            doctor.setIntroduce(doctorJson.getString("introduce"));
                            doctor.setPhoto(doctorJson.getString("photo"));
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
                                doctor.setExpertise(doctorJson.getString("expertise"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
                                doctor.setIntroduce(doctorJson.getString("introduce"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
                                doctor.setPhoto(doctorJson.getString("photo"));
                            }
                            doctor.setIscertified(doctorJson.getString("iscertified"));
                            doctor.setSpell(doctorJson.getString("spell"));
                            doctor.setOutpatientType("zj");
@ -3055,7 +3067,7 @@ public class XzzxEntranceService{
                object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
                object1.put("pack_retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("stock_amount","");
                object1.put("stock_amount",jsonObject.getString("QUANTITY"));
                object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
                object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
                object1.put("py_code",jsonObject.getString("SPELL_CODE"));

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

@ -562,6 +562,8 @@ public class YkyyEntranceService {
                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }else if (StringUtil.isBlank(ksdm)&&StringUtil.isBlank(conNo)){
            return new JSONArray();
        }
        if(!StringUtil.isBlank(startTime)){
            sql += " and h.KSSJ >= to_date('"+startTime+"', 'YYYY-MM-DD HH24:MI:SS')";
@ -1988,114 +1990,115 @@ public class YkyyEntranceService {
        Integer icd10Flag = 0;
        //诊断删除v_hlwys_mz_jzls
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            String deleteSql = "delete from v_hlwys_mz_jzls where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
        if (!StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
           /* String deleteSql = "delete from v_hlwys_mz_jzls where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
            Map<String,Object> params = new HashedMap();
            params.put("sql",deleteSql);
            HttpResponse response = HttpUtils.doGet(updateUrl,params);
            if (response.getStatus()==200){
                logger.info("表v_hlwys_mz_jzls删除成功!");
            }
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
        if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
            WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
            //就诊历史表HLWYS_MZ_JZLS
            HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
            hlwYsMzJzLsDO.setJZXH(0);
            hlwYsMzJzLsDO.setGHXH(GHXH);
            hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
            hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
            hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
            hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
            hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
            hlwYsMzJzLsDO.setJZZT(9);
            hlwYsMzJzLsDO.setJZLX(3);//就诊类型
            hlwYsMzJzLsDO.setZDMC(diagnosisDO.getName());
            hlwYsMzJzLsDO.setMQZD(diagnosisDO.getName());
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            //V_HLW_ICD10.FLAG
            JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
            if(jsonArray2!=null&&jsonArray2.size()>0){
                //获取居民信息
                JSONObject json = jsonArray2.getJSONObject(0);
                icd10Flag = json.getInteger("FLAG");
            }*/
            List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
            if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
                WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
                //就诊历史表HLWYS_MZ_JZLS
                HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
                hlwYsMzJzLsDO.setJZXH(0);
                hlwYsMzJzLsDO.setGHXH(GHXH);
                hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
                hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
                hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
                hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
                hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
                hlwYsMzJzLsDO.setJZZT(9);
                hlwYsMzJzLsDO.setJZLX(3);//就诊类型
                hlwYsMzJzLsDO.setZDMC(diagnosisDO.getName());
                hlwYsMzJzLsDO.setMQZD(diagnosisDO.getName());
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
                }
                //V_HLW_ICD10.FLAG
                JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
                if(jsonArray2!=null&&jsonArray2.size()>0){
                    //获取居民信息
                    JSONObject json = jsonArray2.getJSONObject(0);
                    icd10Flag = json.getInteger("FLAG");
            }
            hlwYsMzJzLsDO.setZYZD(icd10Flag);
            String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
            Map<String,Object> params2 = new HashedMap();
            params2.put("json",jsonString2);
            params2.put("table","HlwYsMzJzLsDO");
            logger.info("HlwYsMzJzLsDO:"+jsonString2);
            HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
            if (response2.getStatus()==200){
                String content = response2.getContent();
                logger.info("content"+content);
                //获取就诊序号,更新处方表数据
                JSONObject jsonObject = JSONObject.parseObject(content);
                JSONObject object = jsonObject.getJSONObject("obj");
                if (object!=null){
                    Integer jzxh = object.getInteger("jzxh");
                    wlyyPrescriptionVO.setAdmNo(jzxh+"");
                    logger.info("JZXH=========="+jzxh);
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                        wlyyPrescriptionDO.setAdmNo(jzxh+"");
                        prescriptionDao.save(wlyyPrescriptionDO);
                }
                hlwYsMzJzLsDO.setZYZD(icd10Flag);
                String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
                Map<String,Object> params2 = new HashedMap();
                params2.put("json",jsonString2);
                params2.put("table","HlwYsMzJzLsDO");
                logger.info("HlwYsMzJzLsDO:"+jsonString2);
                HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
                if (response2.getStatus()==200){
                    String content = response2.getContent();
                    logger.info("content"+content);
                    //获取就诊序号,更新处方表数据
                    JSONObject jsonObject = JSONObject.parseObject(content);
                    JSONObject object = jsonObject.getJSONObject("obj");
                    if (object!=null){
                        Integer jzxh = object.getInteger("jzxh");
                        wlyyPrescriptionVO.setAdmNo(jzxh+"");
                        logger.info("JZXH=========="+jzxh);
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                            wlyyPrescriptionDO.setAdmNo(jzxh+"");
                            prescriptionDao.save(wlyyPrescriptionDO);
                        }
                    }
                    logger.info("表hlwYsMzJzLsDO同步成功!");
                }
                logger.info("表hlwYsMzJzLsDO同步成功!");
            }
            //删除疾病诊断表HLWYS_MZ_JBZD
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                String deleteSql = "delete from v_hlwys_mz_jbzd where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
                Map<String,Object> params = new HashedMap();
                params.put("sql",deleteSql);
                HttpResponse response = HttpUtils.doGet(updateUrl,params);
                if (response.getStatus()==200){
                    logger.info("表v_hlwys_mz_jbzd删除成功!");
                //删除疾病诊断表HLWYS_MZ_JBZD
                /*if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    String deleteSql = "update v_hlwys_mz_jbzd set  zfpb=1,  where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
                    Map<String,Object> params = new HashedMap();
                    params.put("sql",deleteSql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params);
                    if (response.getStatus()==200){
                        logger.info("表v_hlwys_mz_jbzd删除成功!");
                    }
                }*/
                //疾病诊断表HLWYS_MZ_JBZD
                HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
                //hlwYsMzJbzdDO.setJLBH(0);
                hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
                hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
                hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
                hlwYsMzJbzdDO.setJBBH(icd10Flag);
                hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
                hlwYsMzJbzdDO.setZDLB(11);//诊断类别
                hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
                hlwYsMzJbzdDO.setZFPB(0);//作废标志
                hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
                hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
                hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
                hlwYsMzJbzdDO.setZDLX(1);//诊断类型
                hlwYsMzJbzdDO.setTJBZ(1);//提交标志
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
                }
            }
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
            hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
            hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
            hlwYsMzJbzdDO.setZDLB(11);//诊断类别
            hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
            hlwYsMzJbzdDO.setZFPB(0);//作废标志
            hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
            hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
            hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
            hlwYsMzJbzdDO.setZDLX(1);//诊断类型
            hlwYsMzJbzdDO.setTJBZ(1);//提交标志
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String,Object> params1 = new HashedMap();
            params1.put("json",jsonString1);
            params1.put("table","HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:"+jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
            if (response1.getStatus()==200){
                String content = response1.getContent();
                logger.info("content"+content);
                logger.info("表hlwYsMzJbzdDO同步成功!");
                String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HlwYsMzJbzdDO");
                logger.info("HlwYsMzJbzdDO:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
                if (response1.getStatus()==200){
                    String content = response1.getContent();
                    logger.info("content"+content);
                    logger.info("表hlwYsMzJbzdDO同步成功!");
                }
            }
        }
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
@ -2187,6 +2190,41 @@ public class YkyyEntranceService {
                    }
                }else {
                    cfsb = wlyyPrescriptionVO.getRealOrder();
                    String sql = "update v_ms_dd01 t set t.ZFPB=1,t.ZFSJ=to_date('"+DateUtil.getStringDate()+"','yyyy-mm-dd hh24:mi:ss')  where  t.CFSB ='"+cfsb+"' ";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",sql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params1);
                    if (response.getStatus()==200){
                        logger.info("表v_ms_dd01作废成功!");
                        HttpResponse response1 = HttpUtils.doGet(saveUrl,params);
                        if (response1.getStatus()==200){
                            logger.info("content"+response1.getContent());
                            String content = response1.getContent();
                            JSONObject jsonObject = JSONObject.parseObject(content);
                            JSONObject object = jsonObject.getJSONObject("obj");
                            if (object!=null){
                                cfsb = object.getString("cfsb");
                                cfhm = object.getString("cfhm");
                                logger.info("kaishi=========="+cfsb);
                                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                                if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                    WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                    wlyyPrescriptionDO.setRealOrder(cfsb);
                                    wlyyPrescriptionDO.setOrderId(hlwCf01DO.getGUID());
                                    wlyyPrescriptionDO.setOriginRealOrder(cfhm);
                                    prescriptionDao.save(wlyyPrescriptionDO);
                                }
                            }
                            logger.info("表HLW_CF01同步成功!");
                        }else {
                            logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
                        }
                    }
                   /* hlwCf01DO.setZFPB(1);
                    hlwCf01DO.setZFSJ(new Date());
                    HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
                    if (response.getStatus()==200){
                        logger.info("content"+response.getContent());
@ -2194,14 +2232,14 @@ public class YkyyEntranceService {
                    }else {
                        logger.info("表HLW_CF01更新失败!"+response.getErrorMsg());
                    }
                    }*/
                }
                logger.info("处方:"+cfsb);
                if (StringUtils.isEmpty(cfsb)){
                    throw new Exception("添加失败");
                }
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
               /* if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
                    String deleteSql = "delete from v_ms_dd02 where cfsb = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",deleteSql);
@ -2209,7 +2247,7 @@ public class YkyyEntranceService {
                    if (response.getStatus()==200){
                        logger.info("表v_ms_dd02删除成功!");
                    }
                }
                }*/
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
                for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                    try {
@ -2218,7 +2256,9 @@ public class YkyyEntranceService {
                    hlwCf02DO.setCFSB(Integer.parseInt(cfsb));
                    hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                    logger.info("drugNo"+hlwCf02DO.getYPXH());
                    hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                    if (wlyyPrescriptionInfoVO.getDrugPlace()!=null){
                        hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                    }
                    hlwCf02DO.setXMLX(1);
                    hlwCf02DO.setCFTS(1);
                    hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
@ -2304,6 +2344,7 @@ public class YkyyEntranceService {
    public String updateHisStatus(String sql) throws Exception {
        Map<String,Object> params1 = new HashedMap();
        params1.put("sql",sql);
        logger.info("his支付"+sql);
        HttpResponse response1 = HttpUtils.doGet(updateUrl,params1);
        logger.info(response1.getContent());
        if (response1.getStatus()==200){

+ 13 - 9
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -41,7 +41,7 @@ import sun.misc.BASE64Encoder;
import java.io.*;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -1285,7 +1285,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
                "  where  a.dosage is not null and b.real_order is not null and a.del=1 ";
        Map<String,Object> params = new HashedMap();
@ -1298,7 +1298,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and  a.id =:keyId ";
            sql =  sql +  "  and  a.prescription_id =:keyId ";
            params.put("keyId",keyId);
        }
@ -1331,9 +1331,10 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                Double pack_retprice = Double.parseDouble(info.get("pack_retprice").toString());
                Long quantity = Long.parseLong((String)info.get("quantity"));
                DecimalFormat decimalFormat = new DecimalFormat("0.00");
                Double price = pack_retprice.doubleValue()*quantity;
                jb.put("drug_total_price",price);
                logger.info("price"+decimalFormat.format(price));
                jb.put("drug_total_price",decimalFormat.format(price));
                jb.put("comments", "");
                jb.put("anti_comments", "");
                jb.put("dec_meth_name", "");
@ -1543,8 +1544,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " base_evaluate_score a " +
                " JOIN base_evaluate e ON a.id = e.relation_code " +
                " JOIN base_doctor d ON d.id = a.doctor " +
                " WHERE " +
                " e.score_type = '4'";
                " JOIN wlyy_consult m ON m.id = a.relation_code  " +
                "WHERE " +
                " e.score_type = '4' and m.id != '' and m.id is not null ";
        if(StringUtils.isNotBlank(startDate)){
            yypjSql =  yypjSql + "  and a.create_time >=:startDate ";
@ -1595,7 +1597,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "      join base_doctor b on b.id = a.doctor" +
                "      join base_patient c on c.id = a.patient" +
                " where a.register_no is NOT NULL and a.dept is not null " +
                " and a.register_date is not null " ;
                " and a.register_date is not null " +
                " and a.doctor not in ('402803816babc778016babd0dee21112')" +
                " and a.patient not in ('2c9081aa6c2f1892016c6a26a8c102ca','39686349deff487d8f3372fc253b8417') " ;
        if(StringUtils.isNotBlank(startDate)){
            wlzlSql =  wlzlSql + "  and a.create_time >=:startDate ";
        }
@ -1639,7 +1643,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
                "  where  a.dosage is not null and b.real_order is not null and a.del=1 ";
        if(StringUtils.isNotBlank(startDate)){
            infosql =  infosql + "  and b.create_time >=:startDate ";

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 48 - 6
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java


+ 5 - 4
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -9,6 +9,7 @@ import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
@ -241,6 +242,10 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    public Boolean updatePatientPw(String id,String pw,String orgPw){
        BasePatientDO patientDO = basePatientDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        //认证信息设置
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            String response =ykyyService.updatePatientPassword(patientDO.getMobile(),pw,"");
@ -256,10 +261,6 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
                return true;
            }
        }
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        String salt = randomString(5);
        patientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        patientDO.setSalt(salt);

+ 1 - 4
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -1,11 +1,8 @@
package com.yihu.jw.utils.hibernate;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import com.yihu.jw.entity.hospital.prescription.HlwCf02DO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -92,7 +89,7 @@ public class HibenateUtils {
        setSqlQueryByMap(query, params);
        if(page!=null&&size!=null){
            query.setFirstResult((page - 1) * size);
            query.setFirstResult((page-1) * size);
            query.setMaxResults(size);
        }
        List<Map<String, Object>> list = query.list();

+ 14 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -3,6 +3,7 @@ package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.wx.JsApiTicket;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.dao.WechatDao;
@ -22,6 +23,8 @@ public class WechatInfoService {
    private EntranceService entranceService;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    /**
     * 通过code获取判断openid
@ -66,7 +69,7 @@ public class WechatInfoService {
            WxWechatDO wxWechat = null;
            
            //中山医院互联网医院
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)||"sd_tnzyy_wx".equals(wxId)){
                jsapiTickets = wxAccessTokenService.findJsapiTicket(wxId);
            }else{
                wxWechat = wxAccessTokenService.getWxInfo(wxId);
@ -97,6 +100,15 @@ public class WechatInfoService {
            }else if("xm_xzzx_wx".equals(wxId)){
                token = xzzxEntranceService.getXzToken();
            }else if("xm_xzzx_wx".equals(wxId)){
                token = xzzxEntranceService.getXzToken();
            }else if("sd_tnzyy_wx".equals(wxId)){
                com.alibaba.fastjson.JSONObject jsonObject = tnyyEntranceService.getAccessToken();
                if (jsonObject.getString("ResultCode")!=null&&jsonObject.getString("ResultCode").equalsIgnoreCase("0")){
                    token = jsonObject.getString("AccessToken");
                }else {
                    throw new Exception("获取ACCESSTOKEN失败");
                }
            }else{
                token = wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
            }
@ -114,7 +126,7 @@ public class WechatInfoService {
                    JsApiTicket newJsApiTicket = new JsApiTicket();
                    newJsApiTicket.setJsapi_ticket(ticket);
                    newJsApiTicket.setExpires_in(Long.parseLong(expires_in));
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)||"sd_tnzyy_wx".equals(wxId)){
                        newJsApiTicket.setAcc_id(wxId);
                    }else{
                        newJsApiTicket.setAcc_id(wxWechat.getAppOriginId());

+ 51 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.dao.JsapiTicketDao;
import com.yihu.jw.wechat.dao.WechatDao;
@ -38,6 +39,8 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
    @Autowired
    private JsapiTicketDao jsapiTicketDao;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    public WxWechatDO getWxInfo(String wxId){
@ -183,6 +186,9 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
                    }
                }
            }
            if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")){
                return  getAccessTokenById(wechatId);
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
@ -222,6 +228,51 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
        }
    }
    /**
     * 泰安获取token
     * @param wechatId
     * @return
     */
    public WxAccessTokenDO getAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            com.alibaba.fastjson.JSONObject json = tnyyEntranceService.getAccessToken();
            if (json.containsKey("AccessToken")) {
                String token = json.get("AccessToken").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(7200);
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 获取凭证
     * @param accId 微信原始id

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

@ -8,6 +8,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -31,6 +32,7 @@ import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.*;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
@ -104,6 +106,8 @@ public class WxTemplateService {
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private YxTokenMappingDao yxTokenMappingDao;
    
@ -153,7 +157,7 @@ public class WxTemplateService {
                        String miniprogramUrl = "";
                        config.setFirst(config.getFirst().replace("key1",sender_name+titleName));
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                            String token = yxToken(reciver_id,reciver_name);
                            String token = yxToken2(reciver_id,reciver_name);
                            miniprogramUrl = "pages/room/yunxin?role=patient&token="+token+"&uid="+basePatientDO.getId();
                            config.setPagepath(miniprogramUrl);
                        }
@ -185,7 +189,7 @@ public class WxTemplateService {
        return "success";
    }
    public String yxToken(String userId,String channelName){
  /*  public String yxToken(String userId,String channelName){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
@ -216,6 +220,103 @@ public class WxTemplateService {
            }
        }
        return null;
    }*/
    public String yxToken2(String userId,String channelName){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/create.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        if (StringUtils.isNoneBlank(channelName)){
            nvps.add(new BasicNameValuePair("name",channelName));
            yxTokenMappingDO1.setName(channelName);
        }
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }else if (jsonObject.getString("code").equalsIgnoreCase("414")&&jsonObject.getString("desc").contains("already")){
                return  refreshToken(userId);
            }
        }
        return null;
    }
    /**
     * 重置云信token
     * @param userId
     * @return
     */
    public String refreshToken(String userId){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/refreshToken.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("重置云信"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }
        }
        return null;
    }
    /**

+ 1 - 1
business/base-service/src/mqConfig/mqdata/MS53001.json

@ -22,7 +22,7 @@
				"specification": "10mgx10片/盒",
				"retprice": "1.5726",
				"pack_retprice": "15.726",
				"stock_amount": "0",
				"stock_amount": "1",
				"visible_flag": "0",
				"drug_flag": "0",
				"py_code": "BNPLP   ",

+ 94 - 0
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -4478,6 +4478,7 @@ public class StatisticsEsService {
    public JSONObject getPrescriptionLineBy(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        String index3 = indexes.length>=3?indexes[2]:"20";
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
@ -4511,8 +4512,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate ="";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"","",level2_type);
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","",level2_type);
            if(SaveModel.OrgLevel.equals(level2_type)){
                for(SaveModel saveModel:precriptionList){
@ -4531,6 +4535,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                        String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getHospital()){
                        resultArray =new JSONArray();
                    }else {
@ -4565,6 +4579,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDoctor()==null?"":saveModel2.getDoctor();
                        String pre=saveModel.getDoctor()==null?"":saveModel.getDoctor();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDoctor()){
                        resultArray =new JSONArray();
                    }else {
@ -4592,6 +4616,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDept()==null?"":saveModel2.getDept();
                        String pre=saveModel.getDept()==null?"":saveModel.getDept();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDept()){
                        resultArray =new JSONArray();
                    }else {
@ -4606,8 +4640,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate ="";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"","","4");
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","","4");
            for(SaveModel saveModel:precriptionList){
                preNum = saveModel.getResult1();
                JSONObject jsonObject = new JSONObject();
@ -4628,6 +4665,16 @@ public class StatisticsEsService {
                        break;
                    }
                }
                for (SaveModel saveModel2:precriptionIsPayList){
                    String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                    if(isPay.equalsIgnoreCase(pre)){
                        isPayNum = saveModel2.getResult1();
                        prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                        jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                        break;
                    }
                }
                if(null==saveModel.getHospital()){
                    resultArray =new JSONArray();
                }else {
@ -4670,6 +4717,7 @@ public class StatisticsEsService {
    public JSONObject getPrescriptionLineByType(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        String index3 = indexes.length>=3?indexes[2]:"20";
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
@ -4702,8 +4750,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate = "";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL, "", "", level2_type);
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","",level2_type);
            if (SaveModel.OrgLevel.equals(level2_type)) {
                //问诊量表格
                for (SaveModel saveModel : precriptionList) {
@ -4722,6 +4773,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                        String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getHospital()){
                        resultArray =new JSONArray();
                    }else {
@ -4750,6 +4811,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDoctor()==null?"":saveModel2.getDoctor();
                        String pre=saveModel.getDoctor()==null?"":saveModel.getDoctor();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDoctor()){
                        resultArray =new JSONArray();
                    }else {
@ -4778,6 +4849,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDept()==null?"":saveModel2.getDept();
                        String pre=saveModel.getDept()==null?"":saveModel.getDept();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDept()){
                        resultArray =new JSONArray();
                    }else {
@ -4791,8 +4872,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate = "";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL, "", "", "4");
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","","4");
            for (SaveModel saveModel : precriptionList) {
                preNum = saveModel.getResult1();
                JSONObject jsonObject = new JSONObject();
@ -4813,6 +4897,16 @@ public class StatisticsEsService {
                        break;
                    }
                }
                for (SaveModel saveModel2:precriptionIsPayList){
                    String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                    if(isPay.equalsIgnoreCase(pre)){
                        isPayNum = saveModel2.getResult1();
                        prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                        jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                        break;
                    }
                }
                if(null==saveModel.getHospital()){
                    resultArray =new JSONArray();
                }else {

+ 221 - 7
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -55,6 +55,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.wechat.service.WxTemplateService;
import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.slf4j.LoggerFactory;
@ -151,6 +152,8 @@ public class ImService {
	@Value("${demo.flag}")
	private boolean demoFlag;
	@Autowired
	private WxTemplateService wxTemplateService;
	@Autowired
	private JdbcTemplate jdbcTemplate;
@ -1360,6 +1363,10 @@ public class ImService {
				// 添加咨询转发记录
				// 添加医生咨询日志
				addLogs(ct);
				//只有勾选同同时发起视频邀请的时候才发送模板消息
				if("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
					wxTemplateService.sendWeTempMesMiniProgram(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getDoctorName(),wlyyOutpatientDO.getConsumer(),wlyyOutpatientDO.getConsumerName(),consult.getId());
				}
			}
			String sessionIds = patient + "_" + outpatientCode + "_" + ct.getType();
			JSONObject result = imUtil.getSingleSessionInfo(sessionIds,doctorCode);
@ -1380,6 +1387,8 @@ public class ImService {
				}
			}
			//发送外层SOCKET消息 在线复诊
			if("1".equals(wlyyOutpatientDO.getOutpatientType())){
				System.out.println("发送外层SOCKET消息:在线复诊");
@ -2273,9 +2282,9 @@ public class ImService {
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyOutpatientDO.getConsumer()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyOutpatientDO.getConsumer()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
				}
			}
		}
@ -2291,9 +2300,9 @@ public class ImService {
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1",null);
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyOutpatientDO.getConsumer()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1",null);
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "27", JSON.toJSONString(object),"1",null);
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyOutpatientDO.getConsumer()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "27", JSON.toJSONString(object),"1",null);
				}
			}
		}
@ -2347,9 +2356,13 @@ public class ImService {
	 * @return
	 * @throws Exception
	 */
	public String pushPrescriptionBackMsg(com.alibaba.fastjson.JSONObject jsonObject,String doctor,String doctorName,String outpatientId,String patient,String outpatientType) throws Exception {
	public String pushPrescriptionBackMsg(com.alibaba.fastjson.JSONObject jsonObject,String doctor,String doctorName,String outpatientId,String patient,String outpatientType,String type) throws Exception {
		if("1".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "33",jsonObject.toString(),"1",null);
			if ("1".equalsIgnoreCase(type)){
				return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "33",jsonObject.toString(),"1",null);
			}else {
				return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_16", "33",jsonObject.toString(),"1",null);
			}
		}else if("2".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "33",jsonObject.toString(),"1",null);
		}else{
@ -3899,7 +3912,7 @@ public class ImService {
		return mapList;
	}
	/**
	/**TnyyEntranceService
	 * 修改视频会话邀请状态
	 * @param session_id session_id
	 * @param status 1发起,0挂断
@ -4263,4 +4276,205 @@ public class ImService {
		}
		return count;
	}
	public List<Map<String,Object>> doctorUpcomingList2(String doctorCode, String type) {
		String sql = "";
		if("1,15,17".equals(type)) {
			/*sql = "SELECT " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else{
					sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
			sql = sql +"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"b.doctor AS \"doctorCode\"," +
					"b.actual_sender AS \"generalDoctor\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d  " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id AND b.doctor='" + doctorCode + "' AND b.type in (" + type + ") and b.status = 0 and a.pay_status=1 " +
					"ORDER BY a.czrq desc ";*/
			sql = "SELECT " +
					" DISTINCT op.id AS \"outpatientId\"," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\","+
					//添加排序的列
					"op.create_time AS \"createTime\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else {
					sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
			sql =sql +"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"case op.type when '1' then '1'  when '3' then '15' else  '17' end \"type\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"op.consumer AS \"consumer\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
				}else {
					sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
				}
			}else{
				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
			}
			sql = sql +		"op.status AS \"outpatientstatus\" "+
					"FROM base_patient patient," +
					"wlyy_outpatient op " +
					"WHERE op.patient=patient.id " +
					"AND op.doctor='"+doctorCode+"' " +
					"AND op.status in ('0','1','2') and  op.pay_status=1 ";
			/*if("9".equals(type)){
				//图文复诊
				sql =sql +"AND op.type=1 AND op.outpatient_type=1 ";
			}else if("16".equals(type)){
				//视频复诊
				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else if("12".equals(type)){
				//视频复诊
				sql =sql +"AND op.outpatient_type=2";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else  {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}*/
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
			}
			sql =sql +" AND op.type in ('1','2') AND op.outpatient_type = 3 ";
			sql =sql +" ORDER BY op.create_time DESC";
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					" DISTINCT op.id AS \"outpatientId\"," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\","+
					//添加排序的列
					"op.create_time AS \"createTime\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else {
					sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
			sql =sql +"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"op.consumer AS \"consumer\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
				}else {
					sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
				}
			}else{
				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
			}
			sql = sql +		"op.status AS \"outpatientstatus\" " +
					"FROM base_patient patient," +
					"wlyy_outpatient op " +
					"WHERE op.patient=patient.id " +
					"AND op.doctor='"+doctorCode+"' " +
					"AND op.status in ('0','1','2') and  op.pay_status=1 ";
			if("9".equals(type)){
				//图文复诊
				sql =sql +"AND op.type=1 AND op.outpatient_type=1 ";
			}else if("16".equals(type)){
				//视频复诊
				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else if("12".equals(type)){
				//视频复诊
				sql =sql +"AND op.outpatient_type=2";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else  {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}
			sql =sql +" ORDER BY op.create_time DESC";
		}
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
		for (Map<String,Object> map:mapList){
			if (map.get("patientIdcard")!=null){
				String idcard = map.get("patientIdcard").toString();
				Integer age =IdCardUtil.getAgeForIdcard(idcard);
				map.put("patientAge",age);
			}
		}
		return mapList;
	}
}

+ 26 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/dao/HospitalSysDictDao.java

@ -0,0 +1,26 @@
package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/17.
 */
public interface HospitalSysDictDao extends PagingAndSortingRepository<WlyyHospitalSysDictDO, String>, JpaSpecificationExecutor<WlyyHospitalSysDictDO> {
    WlyyHospitalSysDictDO findByHospitalAndDictCode(String hospital, String dictCode);
    List<WlyyHospitalSysDictDO> findByHospitalAndDictNameOrderBySortAsc(String hospital, String dictName);
    WlyyHospitalSysDictDO findById(String id);
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
    @Query("from WlyyHospitalSysDictDO where 1=1")
    List<WlyyHospitalSysDictDO> findAlldict();
    @Query("from WlyyHospitalSysDictDO where dictCode = ?1")
    List<WlyyHospitalSysDictDO> findByDictCode(String dictCode);
}

+ 107 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/ZBSmsService.java

@ -0,0 +1,107 @@
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.sms.dao.HospitalSysDictDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 福州总部的短信接口
 */
@Service
public class ZBSmsService {
    private Logger logger= LoggerFactory.getLogger(ZBSmsService.class);
    private String smsHandlerId;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private HospitalSysDictDao sysDictDao;
    private String appId;
    private String secret;//正式参数
    private String prixUrl;//正式参数
    /**
     * 初始化总部接口参数
     */
    private void init(){
        List<WlyyHospitalSysDictDO> dictDOList = sysDictDao.findByDictName("zbSms");
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dictDOList){
            if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("smsHandlerId")){
                smsHandlerId=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("appId")){
                appId=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("secret")){
                secret=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("prixUrl")){
                prixUrl=wlyyHospitalSysDictDO.getDictValue();
            }
        }
    }
    /**
     * 发送短信
     * @return
     */
    public Integer sendMessage(String mobile,String code) throws Exception {
        try{
            //初始化参数
            init();
            String apiUrl = prixUrl+"MsgGW/Sms/send";
            String timestamp =
                    Long.toString(System.currentTimeMillis());//timestamp必须与服务器时间相差在5分钟以内,否则调用将失败;
            Map<String, String> paramMap = new HashMap<>();
            JSONObject object = new JSONObject();
            object.put("code",code);
            paramMap.put("mobile", mobile);
            paramMap.put("templateParam", object.toJSONString());
            paramMap.put("handlerId", smsHandlerId);
            paramMap.put("timestamp", timestamp);
            StringBuilder stringBuilder = new StringBuilder();
            // 对参数名进行字典排序
            String[] keyArray = paramMap.keySet().toArray(new String[0]);
            Arrays.sort(keyArray);
            // 拼接有序的参数名-值串
            stringBuilder.append(appId);
            for (String key : keyArray)
            {
                stringBuilder.append(key).append(paramMap.get(key));
            }
            String codes = stringBuilder.append(secret).toString();
            String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
            // 添加签名,并发送请求
            paramMap.put("appId", appId);
            paramMap.put("sign", sign);
            String rep = httpClientUtil.httpPost(apiUrl, paramMap);
            logger.info("总部短信接口请求返回值:"+rep);
            if (!StringUtils.isEmpty(rep)){
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(rep);
                if ( jsonObject.getInteger("Code")==10000){
                    return 0;
                }else {
                    throw new Exception(jsonObject.getString("Message"));
                }
            }
            return 1;
        }catch (Exception e){
            logger.error(e.getMessage());
        }
        return null;
    }
}

+ 5 - 0
common/common-entity-es/pom.xml

@ -38,5 +38,10 @@
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.1.0</version>
        </dependency>
    </dependencies>
</project>

+ 958 - 0
common/common-entity-es/src/main/java/com/yihu/jw/followup/FollowupContentESDO.java

@ -0,0 +1,958 @@
package com.yihu.jw.followup;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.searchbox.annotations.JestId;
import org.springframework.data.annotation.CreatedDate;
import java.util.Date;
/**
 * 随访详情ES实体类
 * @author huangwenjie
 * @date 2017/11/1 13:41
 */
public class FollowupContentESDO {
	
	@JestId
	private String id;
	private String followup_id;             //随访记录ID
	private String followup_project;        //随访详情分类ID
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
	@CreatedDate
	private Date create_time;
	
    private String NO_SYMPTOM;//无症状【0.无 1.有】
    private String HEADACHE;//头痛头晕【0.无 1.有】
    private String NAUSEA;//恶心呕吐【0.无 1.有】
    private String VERTIGO_TINNITUS;//眼花耳鸣【0.无 1.有】
    private String DIFFICULTY_BREATHING;//呼吸困难【0.无 1.有】
    private String PALPITATIONS;//心悸胸闷【0.无 1.有】
    private String EPISTAXIS_BLEEDING;//鼻衄出血不止【0.无 1.有】
    private String LIMBS_NUMB;//四肢发麻【0.无 1.有】
    private String EXTREMITY_EDEMA;//下肢水肿【0.无 1.有】
    private String SYMPTOM_OTHER;//"其他症状"
    private String POLYDIPSIA;//多饮【0.无 1.有】
    private String MORE_FOOD;//多食【0.无 1.有】
    private String MORE_URINE;//多尿【0.无 1.有】
    private String BLURRED_VISION;//视力模糊【0.无 1.有】
    private String INFECTION;//感染【0.无 1.有】
    private String NUMB_HANDS;//手脚麻木【0.无 1.有】
    private String WEIGHT_LOSS;//体重明显下降【0.无 1.有】
    private String HYPOG_REACT_CODE;//低血糖反应【0.无;1.偶尔;2.频繁;】
	
	//体征信息
    private String HEIGHT;//身高
    private String HEIGHT_EXP;//期望身高
    private String WEIGHT;//体重
    private String WEIGHT_EXP;//期望体重
    private String BP_D;//舒张压
    private String BP_U;//收缩压
    private String BS_FPG;//空腹血糖
    private String NO_BS_FPG;//餐后血糖
    private String RANDOM_BLOOD_SUGAR;//随机血糖
    private String BMI;//体质指数
    private String BMI_EXP;//期望体质
    private String OTHER_POSITIVE_SIGNS;//体征其他
    private String POFDA_MARK;//足背动脉搏动【TOUCH_DICT】
    private String HEART_RATE;//心率
	private String BLOOD_SUGAR;//血糖
	private String BLOOD_SUGAR_TYPE;//血糖类
	
	//检查室检查
    private String GHB;//糖化血红蛋白
    private String RENAL_FUNCTION_CREATININE;//血清肌酐
    private String RENAL_FUNCTION_BUN;//血尿素氮
    private String MICROALBUMINURIA;//尿微量白蛋白
    private String EXAM_DATE;//检查日期
    private String BLOOD_FAT_TRIGLYCERIDE;//甘油三酯 V01
    private String BLOOD_FAT_TC;//总胆固醇 V02
    private String BLOOD_FAT_LDLC;//血清低密度脂蛋白胆固醇 V03
	
	//生活方式
    private String DAILY_SMOKING;//日吸烟量
    private String SOMKING_EXP;//日吸烟期望
    private String DAILY_DRINKING;//日饮酒量
    private String DRINK_EXP;//日饮酒期望
    private String EXERCISE_FREQ_CODE;//运动频率【HYGIENE_SPORT_FREQ_DICT】
    private String EXERCISE_FREQ_CODE_EXP;//运动频率期望【HYGIENE_SPORT_FREQ_DICT】
    private String EXERCISE_DURATION_MINS;//运动时长(min) 分钟/次
    private String EXERCISE_DURATION_MINS_EXP;//运动时长期望(min) 分钟/次期望
    private String SALT_TAKEN_LEVEL_CODE;//摄盐情况【LIGHT_WEIGHT_DICT】
    private String SALT_TAKEN_LEVEL_EXP;//摄盐情况期望【LIGHT_WEIGHT_DICT】
    private String PSY_ADJUST_RESULT_CODE;//心里调整【GOOD_FAIR_POOR_DICT】
    private String COMPLIANCE_RESULT_CODE;//遵医行为【GOOD_FAIR_POOR_DICT】
    private String DAILY_STAPLE;//主食(克/天)
	
	//随访评价
    private String HYP_FOLLOWUP_TYPE_CODE;//高血压随访分类【FOLLOW_TYPE_DICT】
    private String HYP_COMPLICATION_DETAIL;//高血压随访分类--详情
    private String DIA_FOLLOWUP_TYPE_CODE;//糖尿病随访分类【FOLLOW_TYPE_DICT】
    private String DIA_COMPLICATION_DETAIL;//糖尿病随访分类--详情
	
	//用药情况
	private String DRUG_COMPLIANCE_CODE;//服药依从性【DRUG_STATE_DICT】
	
	//控制目标
    private String CONTROL_DATE;//控制日期 V04
	private String CONTROL_CONSTITUTOR;//制定者姓名
	private String CONTROL_CONSTITUTOR_DOCTORCODE;//制定者本地CODE
	private String CONTROL_CONSTITUTOR_JWDOCTORCODE;//制定者本地CODE
                            
    private String CONTROL_BP_U;//血压收缩压 V06
    private String CONTROL_BP_D;//血压舒张压 V07
    private String CONTROL_BS_FPG;//空腹血糖 V08
    private String CONTROL_NO_BS_FPG;//餐后血糖 V09
    private String CONTROL_GHB;//糖化血红蛋白 V10
    private String CONTROL_TRIGLYCERIDE;//甘油三酯 V11
    private String CONTROL_TOTAL_CHOLESTEROL;//总胆固醇 V12
    private String CONTROL_LDL;//低密度脂蛋白 V13
    private String CONTROL_WEIGHT;//体重 V14
    private String CONTROL_EXERCISE_FREQ_CODE;//运动频率 V15
    private String CONTROL_EXERCISE_DURATION_MINS;//运动时长 V16
	
	//健康教育
    private String ARCHIVE_TIME;//健康教育日期 V17
    private String ARCHIVE_OPERATOR_NAME;//健康教育记录者 基卫系统医生【传中文名称】 V18
    private String HEALTH_EDUCATE;//健康教育【CHRO_HEALTH_EDUCATE_DICT】 V19
    private String EDUCATE_CONTENT;//健康教育内容 V20
	
	//转诊
    private String DRUG_ADVERSE_MARK;//药物不良反应【0.无;1.有;】
    private String ADR_REMARK;//药物不良反应【内容】
    private String TRANSFER_RESON;//转诊原因
    private String TRANSFER_ORG_DEPT;//转诊机构科室
    private String REFUSE_REFERRAL;//患者拒绝转诊【0 否 1 是】
    private String REFUSE_REFERRAL_WHY;//患者拒绝转诊内容
	
	//多余字段
    private String ARCHIVE_ID;//档案ID
    private String CHECK_FEE_TYPE;//检测费用类型
    private String FAMILY_FOLLOWUP_ID;//随访细表外键随访ID
	
	
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getFollowup_id() {
		return followup_id;
	}
	
	public void setFollowup_id(String followup_id) {
		this.followup_id = followup_id;
	}
	
	public String getFollowup_project() {
		return followup_project;
	}
	
	public void setFollowup_project(String followup_project) {
		this.followup_project = followup_project;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	@JSONField(name = "NO_SYMPTOM")
	public String getNO_SYMPTOM() {
		return NO_SYMPTOM;
	}
	
	public void setNO_SYMPTOM(String NO_SYMPTOM) {
		this.NO_SYMPTOM = NO_SYMPTOM;
	}
	
	@JSONField(name = "HEADACHE")
	public String getHEADACHE() {
		return HEADACHE;
	}
	
	public void setHEADACHE(String HEADACHE) {
		this.HEADACHE = HEADACHE;
	}
	
	@JSONField(name = "NAUSEA")
	public String getNAUSEA() {
		return NAUSEA;
	}
	
	public void setNAUSEA(String NAUSEA) {
		this.NAUSEA = NAUSEA;
	}
	
	@JSONField(name = "VERTIGO_TINNITUS")
	public String getVERTIGO_TINNITUS() {
		return VERTIGO_TINNITUS;
	}
	
	public void setVERTIGO_TINNITUS(String VERTIGO_TINNITUS) {
		this.VERTIGO_TINNITUS = VERTIGO_TINNITUS;
	}
	
	@JSONField(name = "DIFFICULTY_BREATHING")
	public String getDIFFICULTY_BREATHING() {
		return DIFFICULTY_BREATHING;
	}
	
	public void setDIFFICULTY_BREATHING(String DIFFICULTY_BREATHING) {
		this.DIFFICULTY_BREATHING = DIFFICULTY_BREATHING;
	}
	
	@JSONField(name = "PALPITATIONS")
	public String getPALPITATIONS() {
		return PALPITATIONS;
	}
	
	public void setPALPITATIONS(String PALPITATIONS) {
		this.PALPITATIONS = PALPITATIONS;
	}
	
	@JSONField(name = "EPISTAXIS_BLEEDING")
	public String getEPISTAXIS_BLEEDING() {
		return EPISTAXIS_BLEEDING;
	}
	
	public void setEPISTAXIS_BLEEDING(String EPISTAXIS_BLEEDING) {
		this.EPISTAXIS_BLEEDING = EPISTAXIS_BLEEDING;
	}
	
	@JSONField(name = "LIMBS_NUMB")
	public String getLIMBS_NUMB() {
		return LIMBS_NUMB;
	}
	
	public void setLIMBS_NUMB(String LIMBS_NUMB) {
		this.LIMBS_NUMB = LIMBS_NUMB;
	}
	
	@JSONField(name = "EXTREMITY_EDEMA")
	public String getEXTREMITY_EDEMA() {
		return EXTREMITY_EDEMA;
	}
	
	public void setEXTREMITY_EDEMA(String EXTREMITY_EDEMA) {
		this.EXTREMITY_EDEMA = EXTREMITY_EDEMA;
	}
	
	@JSONField(name = "SYMPTOM_OTHER")
	public String getSYMPTOM_OTHER() {
		return SYMPTOM_OTHER;
	}
	
	public void setSYMPTOM_OTHER(String SYMPTOM_OTHER) {
		this.SYMPTOM_OTHER = SYMPTOM_OTHER;
	}
	
	@JSONField(name = "POLYDIPSIA")
	public String getPOLYDIPSIA() {
		return POLYDIPSIA;
	}
	
	public void setPOLYDIPSIA(String POLYDIPSIA) {
		this.POLYDIPSIA = POLYDIPSIA;
	}
	
	@JSONField(name = "MORE_FOOD")
	public String getMORE_FOOD() {
		return MORE_FOOD;
	}
	
	public void setMORE_FOOD(String MORE_FOOD) {
		this.MORE_FOOD = MORE_FOOD;
	}
	
	@JSONField(name = "MORE_URINE")
	public String getMORE_URINE() {
		return MORE_URINE;
	}
	
	public void setMORE_URINE(String MORE_URINE) {
		this.MORE_URINE = MORE_URINE;
	}
	
	@JSONField(name = "BLURRED_VISION")
	public String getBLURRED_VISION() {
		return BLURRED_VISION;
	}
	
	public void setBLURRED_VISION(String BLURRED_VISION) {
		this.BLURRED_VISION = BLURRED_VISION;
	}
	
	@JSONField(name = "INFECTION")
	public String getINFECTION() {
		return INFECTION;
	}
	
	public void setINFECTION(String INFECTION) {
		this.INFECTION = INFECTION;
	}
	
	@JSONField(name = "NUMB_HANDS")
	public String getNUMB_HANDS() {
		return NUMB_HANDS;
	}
	
	public void setNUMB_HANDS(String NUMB_HANDS) {
		this.NUMB_HANDS = NUMB_HANDS;
	}
	
	@JSONField(name = "WEIGHT_LOSS")
	public String getWEIGHT_LOSS() {
		return WEIGHT_LOSS;
	}
	
	public void setWEIGHT_LOSS(String WEIGHT_LOSS) {
		this.WEIGHT_LOSS = WEIGHT_LOSS;
	}
	
	@JSONField(name = "HYPOG_REACT_CODE")
	public String getHYPOG_REACT_CODE() {
		return HYPOG_REACT_CODE;
	}
	
	public void setHYPOG_REACT_CODE(String HYPOG_REACT_CODE) {
		this.HYPOG_REACT_CODE = HYPOG_REACT_CODE;
	}
	
	@JSONField(name = "HEIGHT")
	public String getHEIGHT() {
		return HEIGHT;
	}
	
	public void setHEIGHT(String HEIGHT) {
		this.HEIGHT = HEIGHT;
	}
	
	@JSONField(name = "HEIGHT_EXP")
	public String getHEIGHT_EXP() {
		return HEIGHT_EXP;
	}
	
	public void setHEIGHT_EXP(String HEIGHT_EXP) {
		this.HEIGHT_EXP = HEIGHT_EXP;
	}
	
	@JSONField(name = "WEIGHT")
	public String getWEIGHT() {
		return WEIGHT;
	}
	
	public void setWEIGHT(String WEIGHT) {
		this.WEIGHT = WEIGHT;
	}
	
	@JSONField(name = "WEIGHT_EXP")
	public String getWEIGHT_EXP() {
		return WEIGHT_EXP;
	}
	
	public void setWEIGHT_EXP(String WEIGHT_EXP) {
		this.WEIGHT_EXP = WEIGHT_EXP;
	}
	
	@JSONField(name = "BP_D")
	public String getBP_D() {
		return BP_D;
	}
	
	public void setBP_D(String BP_D) {
		this.BP_D = BP_D;
	}
	
	@JSONField(name = "BP_U")
	public String getBP_U() {
		return BP_U;
	}
	
	public void setBP_U(String BP_U) {
		this.BP_U = BP_U;
	}
	
	@JSONField(name = "BS_FPG")
	public String getBS_FPG() {
		return BS_FPG;
	}
	
	public void setBS_FPG(String BS_FPG) {
		this.BS_FPG = BS_FPG;
	}
	
	@JSONField(name = "NO_BS_FPG")
	public String getNO_BS_FPG() {
		return NO_BS_FPG;
	}
	
	public void setNO_BS_FPG(String NO_BS_FPG) {
		this.NO_BS_FPG = NO_BS_FPG;
	}
	
	@JSONField(name = "RANDOM_BLOOD_SUGAR")
	public String getRANDOM_BLOOD_SUGAR() {
		return RANDOM_BLOOD_SUGAR;
	}
	
	public void setRANDOM_BLOOD_SUGAR(String RANDOM_BLOOD_SUGAR) {
		this.RANDOM_BLOOD_SUGAR = RANDOM_BLOOD_SUGAR;
	}
	
	@JSONField(name = "BMI")
	public String getBMI() {
		return BMI;
	}
	
	public void setBMI(String BMI) {
		this.BMI = BMI;
	}
	
	@JSONField(name = "BMI_EXP")
	public String getBMI_EXP() {
		return BMI_EXP;
	}
	
	public void setBMI_EXP(String BMI_EXP) {
		this.BMI_EXP = BMI_EXP;
	}
	
	@JSONField(name = "OTHER_POSITIVE_SIGNS")
	public String getOTHER_POSITIVE_SIGNS() {
		return OTHER_POSITIVE_SIGNS;
	}
	
	public void setOTHER_POSITIVE_SIGNS(String OTHER_POSITIVE_SIGNS) {
		this.OTHER_POSITIVE_SIGNS = OTHER_POSITIVE_SIGNS;
	}
	
	@JSONField(name = "POFDA_MARK")
	public String getPOFDA_MARK() {
		return POFDA_MARK;
	}
	
	public void setPOFDA_MARK(String POFDA_MARK) {
		this.POFDA_MARK = POFDA_MARK;
	}
	
	@JSONField(name = "HEART_RATE")
	public String getHEART_RATE() {
		return HEART_RATE;
	}
	
	public void setHEART_RATE(String HEART_RATE) {
		this.HEART_RATE = HEART_RATE;
	}
	@JSONField(name = "BLOOD_SUGAR")
	public String getBLOOD_SUGAR() {
		return BLOOD_SUGAR;
	}
	public void setBLOOD_SUGAR(String BLOOD_SUGAR) {
		this.BLOOD_SUGAR = BLOOD_SUGAR;
	}
	@JSONField(name = "BLOOD_SUGAR_TYPE")
	public String getBLOOD_SUGAR_TYPE() {
		return BLOOD_SUGAR_TYPE;
	}
	public void setBLOOD_SUGAR_TYPE(String BLOOD_SUGAR_TYPE) {
		this.BLOOD_SUGAR_TYPE = BLOOD_SUGAR_TYPE;
	}
	@JSONField(name = "GHB")
	public String getGHB() {
		return GHB;
	}
	
	public void setGHB(String GHB) {
		this.GHB = GHB;
	}
	
	@JSONField(name = "RENAL_FUNCTION_CREATININE")
	public String getRENAL_FUNCTION_CREATININE() {
		return RENAL_FUNCTION_CREATININE;
	}
	
	public void setRENAL_FUNCTION_CREATININE(String RENAL_FUNCTION_CREATININE) {
		this.RENAL_FUNCTION_CREATININE = RENAL_FUNCTION_CREATININE;
	}
	
	@JSONField(name = "RENAL_FUNCTION_BUN")
	public String getRENAL_FUNCTION_BUN() {
		return RENAL_FUNCTION_BUN;
	}
	
	public void setRENAL_FUNCTION_BUN(String RENAL_FUNCTION_BUN) {
		this.RENAL_FUNCTION_BUN = RENAL_FUNCTION_BUN;
	}
	
	@JSONField(name = "MICROALBUMINURIA")
	public String getMICROALBUMINURIA() {
		return MICROALBUMINURIA;
	}
	
	public void setMICROALBUMINURIA(String MICROALBUMINURIA) {
		this.MICROALBUMINURIA = MICROALBUMINURIA;
	}
	
	@JSONField(name = "EXAM_DATE")
	public String getEXAM_DATE() {
		return EXAM_DATE;
	}
	
	public void setEXAM_DATE(String EXAM_DATE) {
		this.EXAM_DATE = EXAM_DATE;
	}
	
	@JSONField(name = "BLOOD_FAT_TRIGLYCERIDE")
	public String getBLOOD_FAT_TRIGLYCERIDE() {
		return BLOOD_FAT_TRIGLYCERIDE;
	}
	
	public void setBLOOD_FAT_TRIGLYCERIDE(String BLOOD_FAT_TRIGLYCERIDE) {
		this.BLOOD_FAT_TRIGLYCERIDE = BLOOD_FAT_TRIGLYCERIDE;
	}
	
	@JSONField(name = "BLOOD_FAT_TC")
	public String getBLOOD_FAT_TC() {
		return BLOOD_FAT_TC;
	}
	
	public void setBLOOD_FAT_TC(String BLOOD_FAT_TC) {
		this.BLOOD_FAT_TC = BLOOD_FAT_TC;
	}
	
	@JSONField(name = "BLOOD_FAT_LDLC")
	public String getBLOOD_FAT_LDLC() {
		return BLOOD_FAT_LDLC;
	}
	
	public void setBLOOD_FAT_LDLC(String BLOOD_FAT_LDLC) {
		this.BLOOD_FAT_LDLC = BLOOD_FAT_LDLC;
	}
	
	@JSONField(name = "DAILY_SMOKING")
	public String getDAILY_SMOKING() {
		return DAILY_SMOKING;
	}
	
	public void setDAILY_SMOKING(String DAILY_SMOKING) {
		this.DAILY_SMOKING = DAILY_SMOKING;
	}
	
	@JSONField(name = "SOMKING_EXP")
	public String getSOMKING_EXP() {
		return SOMKING_EXP;
	}
	
	public void setSOMKING_EXP(String SOMKING_EXP) {
		this.SOMKING_EXP = SOMKING_EXP;
	}
	
	@JSONField(name = "DAILY_DRINKING")
	public String getDAILY_DRINKING() {
		return DAILY_DRINKING;
	}
	
	public void setDAILY_DRINKING(String DAILY_DRINKING) {
		this.DAILY_DRINKING = DAILY_DRINKING;
	}
	
	@JSONField(name = "DRINK_EXP")
	public String getDRINK_EXP() {
		return DRINK_EXP;
	}
	
	public void setDRINK_EXP(String DRINK_EXP) {
		this.DRINK_EXP = DRINK_EXP;
	}
	
	@JSONField(name = "EXERCISE_FREQ_CODE")
	public String getEXERCISE_FREQ_CODE() {
		return EXERCISE_FREQ_CODE;
	}
	
	public void setEXERCISE_FREQ_CODE(String EXERCISE_FREQ_CODE) {
		this.EXERCISE_FREQ_CODE = EXERCISE_FREQ_CODE;
	}
	
	@JSONField(name = "EXERCISE_FREQ_CODE_EXP")
	public String getEXERCISE_FREQ_CODE_EXP() {
		return EXERCISE_FREQ_CODE_EXP;
	}
	
	public void setEXERCISE_FREQ_CODE_EXP(String EXERCISE_FREQ_CODE_EXP) {
		this.EXERCISE_FREQ_CODE_EXP = EXERCISE_FREQ_CODE_EXP;
	}
	
	@JSONField(name = "EXERCISE_DURATION_MINS")
	public String getEXERCISE_DURATION_MINS() {
		return EXERCISE_DURATION_MINS;
	}
	
	public void setEXERCISE_DURATION_MINS(String EXERCISE_DURATION_MINS) {
		this.EXERCISE_DURATION_MINS = EXERCISE_DURATION_MINS;
	}
	
	@JSONField(name = "EXERCISE_DURATION_MINS_EXP")
	public String getEXERCISE_DURATION_MINS_EXP() {
		return EXERCISE_DURATION_MINS_EXP;
	}
	
	public void setEXERCISE_DURATION_MINS_EXP(String EXERCISE_DURATION_MINS_EXP) {
		this.EXERCISE_DURATION_MINS_EXP = EXERCISE_DURATION_MINS_EXP;
	}
	
	@JSONField(name = "SALT_TAKEN_LEVEL_CODE")
	public String getSALT_TAKEN_LEVEL_CODE() {
		return SALT_TAKEN_LEVEL_CODE;
	}
	
	public void setSALT_TAKEN_LEVEL_CODE(String SALT_TAKEN_LEVEL_CODE) {
		this.SALT_TAKEN_LEVEL_CODE = SALT_TAKEN_LEVEL_CODE;
	}
	
	@JSONField(name = "SALT_TAKEN_LEVEL_EXP")
	public String getSALT_TAKEN_LEVEL_EXP() {
		return SALT_TAKEN_LEVEL_EXP;
	}
	
	public void setSALT_TAKEN_LEVEL_EXP(String SALT_TAKEN_LEVEL_EXP) {
		this.SALT_TAKEN_LEVEL_EXP = SALT_TAKEN_LEVEL_EXP;
	}
	
	@JSONField(name = "PSY_ADJUST_RESULT_CODE")
	public String getPSY_ADJUST_RESULT_CODE() {
		return PSY_ADJUST_RESULT_CODE;
	}
	
	public void setPSY_ADJUST_RESULT_CODE(String PSY_ADJUST_RESULT_CODE) {
		this.PSY_ADJUST_RESULT_CODE = PSY_ADJUST_RESULT_CODE;
	}
	
	@JSONField(name = "COMPLIANCE_RESULT_CODE")
	public String getCOMPLIANCE_RESULT_CODE() {
		return COMPLIANCE_RESULT_CODE;
	}
	
	public void setCOMPLIANCE_RESULT_CODE(String COMPLIANCE_RESULT_CODE) {
		this.COMPLIANCE_RESULT_CODE = COMPLIANCE_RESULT_CODE;
	}
	
	@JSONField(name = "DAILY_STAPLE")
	public String getDAILY_STAPLE() {
		return DAILY_STAPLE;
	}
	
	public void setDAILY_STAPLE(String DAILY_STAPLE) {
		this.DAILY_STAPLE = DAILY_STAPLE;
	}
	
	@JSONField(name = "HYP_FOLLOWUP_TYPE_CODE")
	public String getHYP_FOLLOWUP_TYPE_CODE() {
		return HYP_FOLLOWUP_TYPE_CODE;
	}
	
	public void setHYP_FOLLOWUP_TYPE_CODE(String HYP_FOLLOWUP_TYPE_CODE) {
		this.HYP_FOLLOWUP_TYPE_CODE = HYP_FOLLOWUP_TYPE_CODE;
	}
	
	@JSONField(name = "HYP_COMPLICATION_DETAIL")
	public String getHYP_COMPLICATION_DETAIL() {
		return HYP_COMPLICATION_DETAIL;
	}
	
	public void setHYP_COMPLICATION_DETAIL(String HYP_COMPLICATION_DETAIL) {
		this.HYP_COMPLICATION_DETAIL = HYP_COMPLICATION_DETAIL;
	}
	
	@JSONField(name = "DIA_FOLLOWUP_TYPE_CODE")
	public String getDIA_FOLLOWUP_TYPE_CODE() {
		return DIA_FOLLOWUP_TYPE_CODE;
	}
	
	public void setDIA_FOLLOWUP_TYPE_CODE(String DIA_FOLLOWUP_TYPE_CODE) {
		this.DIA_FOLLOWUP_TYPE_CODE = DIA_FOLLOWUP_TYPE_CODE;
	}
	
	@JSONField(name = "DIA_COMPLICATION_DETAIL")
	public String getDIA_COMPLICATION_DETAIL() {
		return DIA_COMPLICATION_DETAIL;
	}
	
	public void setDIA_COMPLICATION_DETAIL(String DIA_COMPLICATION_DETAIL) {
		this.DIA_COMPLICATION_DETAIL = DIA_COMPLICATION_DETAIL;
	}
	
	@JSONField(name = "DRUG_COMPLIANCE_CODE")
	public String getDRUG_COMPLIANCE_CODE() {
		return DRUG_COMPLIANCE_CODE;
	}
	
	public void setDRUG_COMPLIANCE_CODE(String DRUG_COMPLIANCE_CODE) {
		this.DRUG_COMPLIANCE_CODE = DRUG_COMPLIANCE_CODE;
	}
	
	@JSONField(name = "CONTROL_DATE")
	public String getCONTROL_DATE() {
		return CONTROL_DATE;
	}
	
	public void setCONTROL_DATE(String CONTROL_DATE) {
		this.CONTROL_DATE = CONTROL_DATE;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR")
	public String getCONTROL_CONSTITUTOR() {
		return CONTROL_CONSTITUTOR;
	}
	
	public void setCONTROL_CONSTITUTOR(String CONTROL_CONSTITUTOR) {
		this.CONTROL_CONSTITUTOR = CONTROL_CONSTITUTOR;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR_DOCTORCODE")
	public String getCONTROL_CONSTITUTOR_DOCTORCODE() {
		return CONTROL_CONSTITUTOR_DOCTORCODE;
	}
	
	public void setCONTROL_CONSTITUTOR_DOCTORCODE(String CONTROL_CONSTITUTOR_DOCTORCODE) {
		this.CONTROL_CONSTITUTOR_DOCTORCODE = CONTROL_CONSTITUTOR_DOCTORCODE;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR_JWDOCTORCODE")
	public String getCONTROL_CONSTITUTOR_JWDOCTORCODE() {
		return CONTROL_CONSTITUTOR_JWDOCTORCODE;
	}
	
	public void setCONTROL_CONSTITUTOR_JWDOCTORCODE(String CONTROL_CONSTITUTOR_JWDOCTORCODE) {
		this.CONTROL_CONSTITUTOR_JWDOCTORCODE = CONTROL_CONSTITUTOR_JWDOCTORCODE;
	}
	
	@JSONField(name = "CONTROL_BP_U")
	public String getCONTROL_BP_U() {
		return CONTROL_BP_U;
	}
	
	public void setCONTROL_BP_U(String CONTROL_BP_U) {
		this.CONTROL_BP_U = CONTROL_BP_U;
	}
	
	@JSONField(name = "CONTROL_BP_D")
	public String getCONTROL_BP_D() {
		return CONTROL_BP_D;
	}
	
	public void setCONTROL_BP_D(String CONTROL_BP_D) {
		this.CONTROL_BP_D = CONTROL_BP_D;
	}
	
	@JSONField(name = "CONTROL_BS_FPG")
	public String getCONTROL_BS_FPG() {
		return CONTROL_BS_FPG;
	}
	
	public void setCONTROL_BS_FPG(String CONTROL_BS_FPG) {
		this.CONTROL_BS_FPG = CONTROL_BS_FPG;
	}
	
	@JSONField(name = "CONTROL_NO_BS_FPG")
	public String getCONTROL_NO_BS_FPG() {
		return CONTROL_NO_BS_FPG;
	}
	
	public void setCONTROL_NO_BS_FPG(String CONTROL_NO_BS_FPG) {
		this.CONTROL_NO_BS_FPG = CONTROL_NO_BS_FPG;
	}
	
	@JSONField(name = "CONTROL_GHB")
	public String getCONTROL_GHB() {
		return CONTROL_GHB;
	}
	
	public void setCONTROL_GHB(String CONTROL_GHB) {
		this.CONTROL_GHB = CONTROL_GHB;
	}
	
	@JSONField(name = "CONTROL_TRIGLYCERIDE")
	public String getCONTROL_TRIGLYCERIDE() {
		return CONTROL_TRIGLYCERIDE;
	}
	
	public void setCONTROL_TRIGLYCERIDE(String CONTROL_TRIGLYCERIDE) {
		this.CONTROL_TRIGLYCERIDE = CONTROL_TRIGLYCERIDE;
	}
	
	@JSONField(name = "CONTROL_TOTAL_CHOLESTEROL")
	public String getCONTROL_TOTAL_CHOLESTEROL() {
		return CONTROL_TOTAL_CHOLESTEROL;
	}
	
	public void setCONTROL_TOTAL_CHOLESTEROL(String CONTROL_TOTAL_CHOLESTEROL) {
		this.CONTROL_TOTAL_CHOLESTEROL = CONTROL_TOTAL_CHOLESTEROL;
	}
	
	@JSONField(name = "CONTROL_LDL")
	public String getCONTROL_LDL() {
		return CONTROL_LDL;
	}
	
	public void setCONTROL_LDL(String CONTROL_LDL) {
		this.CONTROL_LDL = CONTROL_LDL;
	}
	
	@JSONField(name = "CONTROL_WEIGHT")
	public String getCONTROL_WEIGHT() {
		return CONTROL_WEIGHT;
	}
	
	public void setCONTROL_WEIGHT(String CONTROL_WEIGHT) {
		this.CONTROL_WEIGHT = CONTROL_WEIGHT;
	}
	
	@JSONField(name = "CONTROL_EXERCISE_FREQ_CODE")
	public String getCONTROL_EXERCISE_FREQ_CODE() {
		return CONTROL_EXERCISE_FREQ_CODE;
	}
	
	public void setCONTROL_EXERCISE_FREQ_CODE(String CONTROL_EXERCISE_FREQ_CODE) {
		this.CONTROL_EXERCISE_FREQ_CODE = CONTROL_EXERCISE_FREQ_CODE;
	}
	
	@JSONField(name = "CONTROL_EXERCISE_DURATION_MINS")
	public String getCONTROL_EXERCISE_DURATION_MINS() {
		return CONTROL_EXERCISE_DURATION_MINS;
	}
	
	public void setCONTROL_EXERCISE_DURATION_MINS(String CONTROL_EXERCISE_DURATION_MINS) {
		this.CONTROL_EXERCISE_DURATION_MINS = CONTROL_EXERCISE_DURATION_MINS;
	}
	
	@JSONField(name = "ARCHIVE_TIME")
	public String getARCHIVE_TIME() {
		return ARCHIVE_TIME;
	}
	
	public void setARCHIVE_TIME(String ARCHIVE_TIME) {
		this.ARCHIVE_TIME = ARCHIVE_TIME;
	}
	
	@JSONField(name = "ARCHIVE_OPERATOR_NAME")
	public String getARCHIVE_OPERATOR_NAME() {
		return ARCHIVE_OPERATOR_NAME;
	}
	
	public void setARCHIVE_OPERATOR_NAME(String ARCHIVE_OPERATOR_NAME) {
		this.ARCHIVE_OPERATOR_NAME = ARCHIVE_OPERATOR_NAME;
	}
	
	@JSONField(name = "HEALTH_EDUCATE")
	public String getHEALTH_EDUCATE() {
		return HEALTH_EDUCATE;
	}
	
	public void setHEALTH_EDUCATE(String HEALTH_EDUCATE) {
		this.HEALTH_EDUCATE = HEALTH_EDUCATE;
	}
	
	@JSONField(name = "EDUCATE_CONTENT")
	public String getEDUCATE_CONTENT() {
		return EDUCATE_CONTENT;
	}
	
	public void setEDUCATE_CONTENT(String EDUCATE_CONTENT) {
		this.EDUCATE_CONTENT = EDUCATE_CONTENT;
	}
	
	@JSONField(name = "DRUG_ADVERSE_MARK")
	public String getDRUG_ADVERSE_MARK() {
		return DRUG_ADVERSE_MARK;
	}
	
	public void setDRUG_ADVERSE_MARK(String DRUG_ADVERSE_MARK) {
		this.DRUG_ADVERSE_MARK = DRUG_ADVERSE_MARK;
	}
	
	@JSONField(name = "ADR_REMARK")
	public String getADR_REMARK() {
		return ADR_REMARK;
	}
	
	public void setADR_REMARK(String ADR_REMARK) {
		this.ADR_REMARK = ADR_REMARK;
	}
	
	@JSONField(name = "TRANSFER_RESON")
	public String getTRANSFER_RESON() {
		return TRANSFER_RESON;
	}
	
	public void setTRANSFER_RESON(String TRANSFER_RESON) {
		this.TRANSFER_RESON = TRANSFER_RESON;
	}
	
	@JSONField(name = "TRANSFER_ORG_DEPT")
	public String getTRANSFER_ORG_DEPT() {
		return TRANSFER_ORG_DEPT;
	}
	
	public void setTRANSFER_ORG_DEPT(String TRANSFER_ORG_DEPT) {
		this.TRANSFER_ORG_DEPT = TRANSFER_ORG_DEPT;
	}
	
	@JSONField(name = "REFUSE_REFERRAL")
	public String getREFUSE_REFERRAL() {
		return REFUSE_REFERRAL;
	}
	
	public void setREFUSE_REFERRAL(String REFUSE_REFERRAL) {
		this.REFUSE_REFERRAL = REFUSE_REFERRAL;
	}
	
	@JSONField(name = "REFUSE_REFERRAL_WHY")
	public String getREFUSE_REFERRAL_WHY() {
		return REFUSE_REFERRAL_WHY;
	}
	
	public void setREFUSE_REFERRAL_WHY(String REFUSE_REFERRAL_WHY) {
		this.REFUSE_REFERRAL_WHY = REFUSE_REFERRAL_WHY;
	}
	
	@JSONField(name = "ARCHIVE_ID")
	public String getARCHIVE_ID() {
		return ARCHIVE_ID;
	}
	
	public void setARCHIVE_ID(String ARCHIVE_ID) {
		this.ARCHIVE_ID = ARCHIVE_ID;
	}
	
	@JSONField(name = "CHECK_FEE_TYPE")
	public String getCHECK_FEE_TYPE() {
		return CHECK_FEE_TYPE;
	}
	
	public void setCHECK_FEE_TYPE(String CHECK_FEE_TYPE) {
		this.CHECK_FEE_TYPE = CHECK_FEE_TYPE;
	}
	
	@JSONField(name = "FAMILY_FOLLOWUP_ID")
	public String getFAMILY_FOLLOWUP_ID() {
		return FAMILY_FOLLOWUP_ID;
	}
	
	public void setFAMILY_FOLLOWUP_ID(String FAMILY_FOLLOWUP_ID) {
		this.FAMILY_FOLLOWUP_ID = FAMILY_FOLLOWUP_ID;
	}
}

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

@ -0,0 +1,73 @@
-- 2021-01-11 ysj 新增随访相关
DROP TABLE IF EXISTS `wlyy_followup`;
CREATE TABLE `wlyy_followup` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `followup_no` varchar(50) DEFAULT NULL,
  `followup_date` datetime NULL COMMENT '随访时间',
  `followup_plan_date` datetime DEFAULT NULL COMMENT '计划随访时间',
  `followup_next_date` datetime DEFAULT NULL COMMENT '计划下次随访时间',
  `followup_type` varchar(50) DEFAULT NULL COMMENT '随访方式【字典FOLLOWUP_WAY_DICT】',
  `followup_class` varchar(50) DEFAULT NULL COMMENT '随访类别,多类别“,”分割【1.高血压 2.糖尿病 3.肿瘤 4.精神分裂症 5.产后 6.新生儿 7.严重精神病 8.80岁以上老人 9.肺结核 11.冠心病日常随访 12.慢性妇科炎症 13.慢性前列腺疾病日常随访 14.慢性乳腺疾病日常随访 15慢性肾病日常随访 16慢性阻塞性肺病17脑卒中日常随访 18脂肪肝日常随访 ',
  `followup_manager_status` varchar(50) DEFAULT NULL COMMENT '随访管理状态【字典FOLLOWUP_MANAGER_STATUS】',
  `doctor_code` varchar(50) DEFAULT NULL COMMENT '随访医生code',
  `doctor_name` varchar(50) DEFAULT NULL COMMENT '随访医生name',
  `jwdoctor_code` varchar(50) DEFAULT NULL,
  `org_code` varchar(50) DEFAULT NULL COMMENT '随访机构code',
  `org_name` varchar(50) DEFAULT NULL COMMENT '随访机构名称',
  `jworg_code` varchar(20) DEFAULT NULL COMMENT '基卫机构编码',
  `patient_code` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `idcard` varchar(50) DEFAULT NULL,
  `data_from` varchar(1) NOT NULL COMMENT '数据来源 1基卫 2APP',
  `status` varchar(1) NOT NULL COMMENT '状态 0取消 1已完成 2未开始 3进行中 4未审核',
  `followup_content_phone` varchar(1000) DEFAULT NULL COMMENT '电话随访内容',
  `creater` varchar(50) DEFAULT NULL COMMENT '创建者',
  `sign_type` int(11) DEFAULT NULL COMMENT '签约类型',
  `admin_team_code` int(11) DEFAULT NULL COMMENT '行政团队',
  `create_time` timestamp NULL DEFAULT NULL,
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `sign_code` varchar(200) DEFAULT NULL COMMENT '签约code',
  `prescription_code` varchar(50) DEFAULT NULL COMMENT '续方CODE或者康复计划ID',
  `age` varchar(100) DEFAULT NULL COMMENT '婴儿年龄',
  `sex` int(11) DEFAULT NULL COMMENT '性别',
  `mobile` varchar(255) DEFAULT NULL COMMENT '手机号',
  `idcard_encrypt` varchar(255) DEFAULT NULL COMMENT '妊娠编号',
  `type` int(2) DEFAULT NULL COMMENT '1新增随访2临时随访3入户访视',
  `jw_doctor_work_type` varchar(10) DEFAULT NULL COMMENT '随访角色【FAMILY_WORK_TYPE_DICT】【1. 专科医生 2. 全科医生 3. 健康管理师】',
  `jw_doctor_health` varchar(50) DEFAULT NULL COMMENT '基卫系统的随访健管师ID',
  `health_followup_type` varchar(50) DEFAULT NULL COMMENT '健管师随访方式【FOLLOWUP_WAY_DICT】',
  `health_followup_next_date` datetime DEFAULT NULL COMMENT '健管师下次随访日期',
  `rural_doctors_flag` varchar(10) DEFAULT NULL COMMENT '是否乡医【0.否;1.是;】',
  `patient_read_status` int(11) DEFAULT '0' COMMENT '专病档案功能是否未读,0-未读  1-已读',
  `doctor_read_status` int(11) DEFAULT '0' COMMENT '专病档案功能是否未读,0-未读  1-已读',
  PRIMARY KEY (`id`),
  KEY `idx_patient` (`patient_code`) USING BTREE,
  KEY `idx_doctorcode_followup_date` (`doctor_code`,`followup_date`) USING BTREE,
  KEY `idx_prescription_code` (`prescription_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1889415 DEFAULT CHARSET=utf8mb4 COMMENT='随访计划表';
ALTER TABLE wlyy_door_service_order ADD followup_date varchar(50) COMMENT '随访时间' ;
-------
-- 2021-01-12 ysj 新增随访相关
CREATE TABLE `wlyy_followup_drugs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `followup_id` int(11) DEFAULT NULL COMMENT '随访ID',
  `drugs_code` varchar(50) DEFAULT NULL COMMENT '药品代码',
  `drugs_name` varchar(50) DEFAULT NULL COMMENT '药品名称',
  `drugs_group` varchar(50) DEFAULT NULL COMMENT '药品分组(糖尿病--胰岛特殊处理)',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `dose` varchar(200) DEFAULT NULL COMMENT '次剂量',
  `unit` varchar(50) DEFAULT NULL COMMENT '用药单位【字典MEASURE_UNIT_DICT】',
  `frequency` varchar(50) DEFAULT NULL COMMENT '用药频率【字典RECIPE_FREQUENCY_DICT】',
  PRIMARY KEY (`id`),
  KEY `wlyy_followup_drugs_followup_id_index` (`followup_id`)
) ENGINE=InnoDB AUTO_INCREMENT=436 DEFAULT CHARSET=utf8mb4 COMMENT='随访用药记录';
-- 2021-01-19 ysj 上门服务项费用相关
ALTER TABLE wlyy_door_fee_detail ADD pay_status TINYINT(1) COMMENT '付款状态:0未付款 1已付款' ;

+ 12 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorFeeDetailDO.java

@ -112,6 +112,11 @@ public class WlyyDoorFeeDetailDO extends UuidIdentityEntityWithOperator {
	 */
	private Integer status;
    /**
     * 付款状态:0未付款 1已付款
     */
    private Integer payStatus;
	@Column(name = "order_id")
    public String getOrderId() {
@ -177,6 +182,12 @@ public class WlyyDoorFeeDetailDO extends UuidIdentityEntityWithOperator {
        this.status = status;
    }
    @Column(name = "pay_status")
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.entity.door;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.followup.Followup;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import javax.persistence.Column;
@ -553,6 +554,9 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
    private List<WlyyPrescriptionDO> prescriptionDOList;//上门前开的方
    private List<WlyyPrescriptionDO> afterPrescriptionList;//上门后开的方
    private List<Followup> followupList;//上门随访
    private String followupDate;//随访时间
    /**
     * 快捷类型,1是快捷类型,其他值不是
     */
@ -1100,6 +1104,15 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
        this.sessionId = sessionId;
    }
    @Transient
    public List<Followup> getFollowupList() {
        return followupList;
    }
    public void setFollowupList(List<Followup> followupList) {
        this.followupList = followupList;
    }
    public Integer getConclusionStatus() {
        return conclusionStatus;
    }
@ -1192,4 +1205,13 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
    @Column(name = "followup_date")
    public String getFollowupDate() {
        return followupDate;
    }
    public void setFollowupDate(String followupDate) {
        this.followupDate = followupDate;
    }
}

+ 439 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/followup/Followup.java

@ -0,0 +1,439 @@
package com.yihu.jw.entity.followup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 随访记录表
 * @author hzp add 2016-12-07
 *
 */
@Entity
@Table(name = "wlyy_followup")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_followup")
public class Followup extends IdEntity {
	//随访编号【基卫】
	private String followupNo;
	//随访时间
	private Date followupDate;
	//随访计划时间
	private Date followupPlanDate;
	//计划下次随访时间
	private Date followupNextDate;
	//随访方式【字典FOLLOWUP_WAY_DICT】
	private String followupType;
	//随访类别,多类别“,”分割【1.高血压 2.糖尿病 3.肿瘤 4.精神分裂症 5.产后 6.新生儿 7.严重精神病 8.80岁以上老人 9.肺结核 10异常体温随访
	// 11.冠心病日常随访 12.慢性妇科炎症13.慢性前列腺疾病日常随访 14.慢性乳腺疾病日常随访 15慢性肾病日常随访 16慢性阻塞性肺病 17脑卒中日常随访 18脂肪肝日常随访
	private String followupClass;
	//随访管理状态【字典FOLLOWUP_MANAGER_STATUS】
	private String followupManagerStatus;
	//医生代码
	private String doctorCode;
	//医生姓名
	private String doctorName;
	//基卫医生CODE
	private String jwdoctorCode;
	//社区代码
	private String orgCode;
	//社区名称
	private String orgName;
	//基卫机构编码
	private String jworgCode;
	//患者代码
	private String patientCode;
	//患者姓名
	private String patientName;
	//患者身份证
	private String idcard;
	//年龄
	private String age;
	//性别
	private Integer sex;
	//手机号
	private String mobile;
	//妊娠编号
	private String idcardEncrypt;
	//数据来源 1基卫 2APP
	private String dataFrom;
	//状态 0取消 1已完成 2未开始 3进行中 4待审核
	private String status;
	//电话随访内容
	private String followupContentPhone;
	//创建时间
	private Date createTime;
	//更新时间
	private Date updateTime;
	//创建者
	private String creater;
	// 签约类型 1三师 2家庭
	private Integer signType;
	// 行政团队
	private Long adminTeamCode;
	//签约表Code
	private String signCode;
	//关联的续方CODE
	private String prescriptionCode;
	//外部数据-居民数据
	private BasePatientDO patient;
	//外部数据-标签数据
	private List<Map<String,Object>> followupLabelPatient;
	//居民头像
	private String photo;
	//随访类型1、新增随访、2临时随访、3入户访视
	private Integer type;
	//随访角色【FAMILY_WORK_TYPE_DICT】【1. 专科医生 2. 全科医生 3. 健康管理师】
	private String jwDoctorWorkType;
	private String jwDoctorHealth;//基卫系统的随访健管师ID
	private String healthFollowupType;//健管师随访方式【FOLLOWUP_WAY_DICT】
	private Date healthFollowupNextDate;//健管师下次随访日期
	private String ruralDoctorsFlag;//是否乡医【0.否;1.是;】
	private Integer doctorReadStatus;
	private Integer patientReadStatus;
	@Column(name = "doctor_read_status")
	public Integer getDoctorReadStatus() {
		return doctorReadStatus;
	}
	public void setDoctorReadStatus(Integer doctorReadStatus) {
		this.doctorReadStatus = doctorReadStatus;
	}
	@Column(name = "patient_read_status")
	public Integer getPatientReadStatus() {
		return patientReadStatus;
	}
	public void setPatientReadStatus(Integer patientReadStatus) {
		this.patientReadStatus = patientReadStatus;
	}
	@Transient
	public BasePatientDO getPatient() {
		return patient;
	}
	public void setPatient(BasePatientDO patient) {
		this.patient = patient;
	}
	@Transient
	public List<Map<String, Object>> getFollowupLabelPatient() {
		return followupLabelPatient;
	}
	public void setFollowupLabelPatient(List<Map<String, Object>> followupLabelPatient) {
		this.followupLabelPatient = followupLabelPatient;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getFollowupPlanDate() {
		return followupPlanDate;
	}
	public void setFollowupPlanDate(Date followupPlanDate) {
		this.followupPlanDate = followupPlanDate;
	}
	public String getFollowupNo() {
		return followupNo;
	}
	public void setFollowupNo(String followupNo) {
		this.followupNo = followupNo;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getFollowupDate() {
		return followupDate;
	}
	public void setFollowupDate(Date followupDate) {
		this.followupDate = followupDate;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getFollowupNextDate() {
		return followupNextDate;
	}
	public void setFollowupNextDate(Date followupNextDate) {
		this.followupNextDate = followupNextDate;
	}
	public String getFollowupType() {
		return followupType;
	}
	public void setFollowupType(String followupType) {
		this.followupType = followupType;
	}
	public String getFollowupClass() {
		return followupClass;
	}
	public void setFollowupClass(String followupClass) {
		this.followupClass = followupClass;
	}
	public String getFollowupManagerStatus() {
		return followupManagerStatus;
	}
	public void setFollowupManagerStatus(String followupManagerStatus) {
		this.followupManagerStatus = followupManagerStatus;
	}
	public String getDoctorCode() {
		return doctorCode;
	}
	public void setDoctorCode(String doctorCode) {
		this.doctorCode = doctorCode;
	}
	public String getDoctorName() {
		return doctorName;
	}
	public void setDoctorName(String doctorName) {
		this.doctorName = doctorName;
	}
	public String getOrgCode() {
		return orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	public String getOrgName() {
		return orgName;
	}
	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	public String getPatientCode() {
		return patientCode;
	}
	public void setPatientCode(String patientCode) {
		this.patientCode = patientCode;
	}
	public String getPatientName() {
		return patientName;
	}
	public void setPatientName(String patientName) {
		this.patientName = patientName;
	}
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	public String getDataFrom() {
		return dataFrom;
	}
	public void setDataFrom(String dataFrom) {
		this.dataFrom = dataFrom;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getFollowupContentPhone() {
		return followupContentPhone;
	}
	public void setFollowupContentPhone(String followupContentPhone) {
		this.followupContentPhone = followupContentPhone;
	}
	public String getCreater() {
		return creater;
	}
	public void setCreater(String creater) {
		this.creater = creater;
	}
	public Integer getSignType() {
		return signType;
	}
	public void setSignType(Integer signType) {
		this.signType = signType;
	}
	public Long getAdminTeamCode() {
		return adminTeamCode;
	}
	public void setAdminTeamCode(Long adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}
	public String getSignCode() {
		return signCode;
	}
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
	public String getJwdoctorCode() {
		return jwdoctorCode;
	}
	public void setJwdoctorCode(String jwdoctorCode) {
		this.jwdoctorCode = jwdoctorCode;
	}
	public String getJworgCode() {
		return jworgCode;
	}
	public void setJworgCode(String jworgCode) {
		this.jworgCode = jworgCode;
	}
	public String getPrescriptionCode() {
		return prescriptionCode;
	}
	public void setPrescriptionCode(String prescriptionCode) {
		this.prescriptionCode = prescriptionCode;
	}
	public String getAge() {
		return age;
	}
	public void setAge(String age) {
		this.age = age;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getIdcardEncrypt() {
		return idcardEncrypt;
	}
	public void setIdcardEncrypt(String idcardEncrypt) {
		this.idcardEncrypt = idcardEncrypt;
	}
	@Transient
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getJwDoctorWorkType() {
		return jwDoctorWorkType;
	}
	public void setJwDoctorWorkType(String jwDoctorWorkType) {
		this.jwDoctorWorkType = jwDoctorWorkType;
	}
	public String getJwDoctorHealth() {
		return jwDoctorHealth;
	}
	public void setJwDoctorHealth(String jwDoctorHealth) {
		this.jwDoctorHealth = jwDoctorHealth;
	}
	public String getHealthFollowupType() {
		return healthFollowupType;
	}
	public void setHealthFollowupType(String healthFollowupType) {
		this.healthFollowupType = healthFollowupType;
	}
	public Date getHealthFollowupNextDate() {
		return healthFollowupNextDate;
	}
	public void setHealthFollowupNextDate(Date healthFollowupNextDate) {
		this.healthFollowupNextDate = healthFollowupNextDate;
	}
	public String getRuralDoctorsFlag() {
		return ruralDoctorsFlag;
	}
	public void setRuralDoctorsFlag(String ruralDoctorsFlag) {
		this.ruralDoctorsFlag = ruralDoctorsFlag;
	}
}

+ 104 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/followup/FollowupDrugs.java

@ -0,0 +1,104 @@
package com.yihu.jw.entity.followup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
/**
 * 随访用药记录
 * @author hzp add 2016-12-07
 *
 */
@Entity
@Table(name = "wlyy_followup_drugs")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_followup_drugs")
public class FollowupDrugs extends IdEntity {
	//随访ID
	private Long followupId;
	//药品代码
	private String drugsCode;
	//药品名称
	private String drugsName;
	//药品分组(糖尿病--胰岛特殊处理)胰岛素分类insulin,其他药品为normal
	private String drugsGroup;
	//次剂量
	private String dose;
	//用药单位【字典MEASURE_UNIT_DICT】
	private String unit;
	//用药频率【字典RECIPE_FREQUENCY_DICT】
	private String frequency;
	//创建时间
	private Date createTime;
	public Long getFollowupId() {
		return followupId;
	}
	public void setFollowupId(Long followupId) {
		this.followupId = followupId;
	}
	public String getDrugsCode() {
		return drugsCode;
	}
	public void setDrugsCode(String drugsCode) {
		this.drugsCode = drugsCode;
	}
	public String getDrugsName() {
		return drugsName;
	}
	public void setDrugsName(String drugsName) {
		this.drugsName = drugsName;
	}
	public String getDrugsGroup() {
		return drugsGroup;
	}
	public void setDrugsGroup(String drugsGroup) {
		this.drugsGroup = drugsGroup;
	}
	
	public String getDose() {
		return dose;
	}
	
	public void setDose(String dose) {
		this.dose = dose;
	}
	
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public String getFrequency() {
		return frequency;
	}
	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
}

+ 22 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@ -273,6 +274,9 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private String voucherNo;
    private String diagnosisName;
    private String diagnosisSubName;
    /**
     * 处方审方唯一标识
     */
@ -693,4 +697,22 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setVoucherNo(String voucherNo) {
        this.voucherNo = voucherNo;
    }
    @Transient
    public String getDiagnosisName() {
        return diagnosisName;
    }
    public void setDiagnosisName(String diagnosisName) {
        this.diagnosisName = diagnosisName;
    }
    @Transient
    public String getDiagnosisSubName() {
        return diagnosisSubName;
    }
    public void setDiagnosisSubName(String diagnosisSubName) {
        this.diagnosisSubName = diagnosisSubName;
    }
}

+ 67 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -14,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_specialist_patient_relation")
public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator implements Serializable {
public class SpecialistPatientRelationDO extends UuidIdentityEntity implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
@ -87,7 +88,13 @@ public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "manage_time")
    private Date manageTime;
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String remindTime;
    public String getSaasId() {
        return saasId;
@ -298,4 +305,62 @@ public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator
    public void setManageTime(Date manageTime) {
        this.manageTime = manageTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(String remindTime) {
        this.remindTime = remindTime;
    }
}

+ 58 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -14,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_patient_rehabilitation_plan")
public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator implements Serializable {
public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements Serializable{
    @Column(name = "saas_id")
    private String saasId;
@ -50,6 +51,12 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    private String adviceContent;//康复建议(wlyy_rehabilitation_advice 的content)
    @Column(name = "team_code")
    private Integer teamCode;//专科医生签约团队
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String healthStatusCode;//健康情况
@ -213,4 +220,54 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    public void setHealthStatusCode(String healthStatusCode) {
        this.healthStatusCode = healthStatusCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 55 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanLogDO.java

@ -0,0 +1,55 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by liub on 2021/1/12.
 */
@Entity
@Table(name="wlyy_patient_rehabilitation_plan_log")
public class PatientRehabilitationPlanLogDO extends UuidIdentityEntity implements Serializable {
    private String planId;
    private String createUser;
    private String createUserName;
    private Date createTime;
    public String getPlanId() {
        return planId;
    }
    public void setPlanId(String planId) {
        this.planId = planId;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 58 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -15,7 +16,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_rehabilitation_plan_detail")
public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationDetailDO extends UuidIdentityEntity implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
@ -52,6 +53,12 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    private String relationCode;//业务关联code
    private Integer reservationType;//复诊类型:1线上,2线下,3远程
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    @Column(name = "reservation_type")
    public Integer getReservationType() {
@ -206,4 +213,54 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 59 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationOperateRecordsDO.java

@ -1,5 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -13,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_rehabilitation_operate_records")
public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationOperateRecordsDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String rehabilitationDetailId;//康复计划明细表id
    private String patientCode;//居民code
@ -29,6 +31,12 @@ public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperat
    private String node;//服务完成笔记
    private String relationCode;//业务id
    private String flag;//标记(1随访2临时随访)
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    @Column(name = "saas_id")
    public String getSaasId() {
@ -164,4 +172,54 @@ public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperat
    public void setFlag(String flag) {
        this.flag = flag;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 3 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -442,6 +442,9 @@ public class BaseHospitalRequestMapping {
        //医生待办事项列表
        public static final String doctorUpcomingList = "/doctorUpcomingList";
        //医生待办事项列表 不关联处方
        public static final String doctorUpcomingList2 = "/doctorUpcomingList2";
        public static final String setRecord = "/setRecord";
        public static final String findPatientRecord = "/findPatientRecord";

+ 9 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyInspectionVO.java

@ -15,7 +15,7 @@ public class WlyyInspectionVO extends UuidIdentityVO {
    private String outpatientId;//门诊id',
    private String prescriptionId;//处方id',
    private String chargeAmount;//单价
    private String dept;//执行科室
    private String deptName;//执行科室名称
    private String groupName;//检查检验方法
@ -60,6 +60,14 @@ public class WlyyInspectionVO extends UuidIdentityVO {
    private String mzpg;//麻醉评估 0否,1有
    private String sfzg;//是否做过 0 否 和 1是
    public String getChargeAmount() {
        return chargeAmount;
    }
    public void setChargeAmount(String chargeAmount) {
        this.chargeAmount = chargeAmount;
    }
    public String getOutpatientId() {
        return outpatientId;
    }

+ 11 - 1
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -72,6 +72,16 @@ public class DateUtil {
        return formatter.format(date);
    }
    public static String dateToChineseDate(Date date) {
        SimpleDateFormat formatter =   new SimpleDateFormat( "yyyy年MM月dd日", Locale.CHINA);
        return formatter.format(date);
    }
    public static String dateToChineseTime(Date date) {
        SimpleDateFormat formatter =   new SimpleDateFormat( "yyyy年MM月dd日 hh:mm:ss", Locale.CHINA);
        return formatter.format(date);
    }
    public static Date getNight23(){
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY,22);
@ -905,7 +915,7 @@ public class DateUtil {
    public static int getSignYear(){
        Calendar ca = Calendar.getInstance();
        if(getNowMonth()>=4){
        if(getNowMonth()>=7){
            return getNowYear();
        }
        return getNowYear()-1;

+ 20 - 4
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -55,12 +55,12 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    private static final String DEFAULT_PATIENT_DETAILS_IDCARD_STATEMENT = "SELECT * FROM base_patient p WHERE p.idcard = ? ";
    private static final String DEFAULT_PATIENT_INSERT_STATEMENT =
            "INSERT into base_patient (`id`,`photo`,`idcard`,`password`,`salt`,`name`,`birthday`,`sex`,`mobile`," +
                    "`province_code`,`province_name`,`city_code`,`city_name`,`town_code`,`town_name`,`street_code`,`street_name`,`address`," +
                    "`del`,`locked`,`enabled`,`login_failure_count`,`login_date`) " +
            "INSERT into base_patient (id,photo,idcard,password,salt,name,birthday,sex,mobile," +
                    "province_code,province_name,city_code,city_name,town_code,town_name,street_code,street_name,address," +
                    "del,locked,enabled,login_failure_count,login_date) " +
                    " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
    private static final String PATIENT_INSERT_WEHCAT = "insert into base_patient_wechat (`id`,`wechat_id`,`patient_id`,`openid`,`create_time`) values(?,?,?,?,?)";
    private static final String PATIENT_INSERT_WEHCAT = "insert into base_patient_wechat (id,wechat_id,patient_id,openid,create_time) values(?,?,?,?,?)";
    private static final String BespeakRegist = "bespeakRegist:";
@ -266,6 +266,22 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    user.setLocked(false);
                    user.setLockedDate(null);
                    users.add(user);
                    BasePatientDO patientDO = patientDao.findByIdcardAndDel(idcard,"1");
                    WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                    if (basePatientFamilyMemberDO==null){
                        basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                        basePatientFamilyMemberDO.setPatient(patientDO.getId());
                        basePatientFamilyMemberDO.setFamilyRelation("7");
                        basePatientFamilyMemberDO.setFamilyRelationName("自己");
                        basePatientFamilyMemberDO.setCardType("身份证");
                        basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
                        basePatientFamilyMemberDO.setCreateTime(new Date());
                        basePatientFamilyMemberDO.setUpdateTime(new Date());
                        basePatientFamilyMemberDO.setIsAuthorize(1);
                        basePatientFamilyMemberDO.setIsDel(1);
                        basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
                        familyMemberDao.save(basePatientFamilyMemberDO);
                    }
                }else if("xm_zsyy_wx".equals(getWechatId())){
                    JSONObject jsonObject=new JSONObject();

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

@ -9,7 +9,6 @@ import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -19,7 +18,6 @@ import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.WechatDao;
import com.yihu.jw.security.dao.patient.WlyyHospitalSysDictDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.*;
@ -32,6 +30,7 @@ import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.utils.network.HttpResponse;
@ -132,6 +131,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    @Autowired
    private ZBSmsService zbSmsService;
    @Autowired
    private OauthCaConfigSerivce oauthCaConfigSerivce;
    @Autowired
    private OauthWjwConfigService oauthWjwConfigService;
@ -608,15 +609,84 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        throw new IllegalStateException("验证码发送失败!");
    }
    /**
     * 福州健康之路短信接口
     * @param parameters
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oauth/sendZBCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendZBCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        if (username.length()>12){
            throw new InvalidRequestException("请输入正确的手机号!");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            int result =  zbSmsService.sendMessage(username,captcha);
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
    @RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String wxId = parameters.get("wxId");
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            }
        }
        if("xm_ykyy_wx".equals(wxId)){
           return sendYKCaptcha(parameters);
        }else if("xm_zsyy_wx".equals(wxId)){
           return sendZSCaptcha(parameters);
        }else if ("xm_xzzx_wx".equals(wxId)){
            return sendXZCaptcha(parameters);
        }else if ("sd_tnzyy_wx".equals(wxId)){
            return sendZBCaptcha(parameters);
        }
        throw new IllegalStateException("验证码发送失败");
    }
@ -1746,6 +1816,48 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                return ObjEnvelop.getSuccess("修改成功!");
            }
            return ObjEnvelop.getError("手机号未注册!");
        }else if ("sd_tnzyy_wx".equalsIgnoreCase(wechatId)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
            if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
                if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                }else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }else {
                if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                    //验证码正确
                } else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }
            String rs = registerService.updateDoctorPw(mobile,pw,wechatId);
            if("ok".equals(rs)){
                return ObjEnvelop.getSuccess("修改成功!");
            }
            return ObjEnvelop.getError("手机号未注册!");
        }else if ("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
            if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
                if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                }else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }else {
                if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                    //验证码正确
                } else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }
            String rs = registerService.updateDoctorPw(mobile,pw,wechatId);
            if("ok".equals(rs)){
                return ObjEnvelop.getSuccess("修改成功!");
            }
            return ObjEnvelop.getError("手机号未注册!");
        }else {
            return ObjEnvelop.getError("暂未开放");

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -562,6 +562,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            if (oldDoctor!=null&&!oldDoctor.getIdcard().equalsIgnoreCase(baseDoctorDO.getIdcard())){
              List<BaseDoctorDO> isExist =  baseDoctorDao.findByIdcard(baseDoctorDO.getIdcard());
              if (isExist!=null&&isExist.size()>0){
                  result.put("msg","当前身份证号已存在,请检查身份证号是否正确");
                  result.put("response", ConstantUtils.FAIL);
                  return result.toJSONString();
              }
            }
            baseDoctorDO.setPassword(oldDoctor.getPassword());
            baseDoctorDO.setEnabled(baseDoctorDO.getDel().equalsIgnoreCase("1")?1:0);
        } catch (IOException e) {

+ 78 - 6
svr/svr-door-serivce/pom.xml

@ -69,6 +69,10 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity-es</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
@ -146,6 +150,10 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity-es</artifactId>
        </dependency>
        <!-- redis end  -->
    </dependencies>
@ -154,19 +162,83 @@
        <finalName>svr-door-service</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <mainClass>com.yihu.SvrDoorServiceApplication</mainClass>
                    <archive>
                        <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <!-- 是否要把第三方jar加入到类构建路径 -->
                            <addClasspath>true</addClasspath>
                            <!-- 外部依赖jar包的最终位置 -->
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.yihu.SvrDoorServiceApplication</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--拷贝依赖到jar外面的lib目录-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-lib</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!-- 依赖包输出目录,将来不打进jar包里 -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--指定配置文件,将resources打成外部resource-->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                    <archive>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
                        <manifestEntries>
                            <Class-Path>resources/</Class-Path>
                        </manifestEntries>
                    </archive>
                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件) -->
                    <excludes>
                        <exclude>**/*.yml</exclude>
                        <exclude>**/*.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- 拷贝资源文件 外面的resource目录-->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <!-- 资源文件输出目录 -->
                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 85 - 43
svr/svr-door-serivce/sql/初始sql.sql


+ 393 - 0
svr/svr-door-serivce/sql/随访记录详情新增索引.txt

@ -0,0 +1,393 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_followup
查询索引
GET http://172.19.103.68:9200/wlyy_followup/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_followup/wlyy_followup_content/_mapping
{
    "wlyy_followup_content": {
        "properties": {
            "followup_id": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_project": {
                "type": "string",
                "index": "not_analyzed"
            },
            "create_time": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NO_SYMPTOM": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEADACHE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NAUSEA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "VERTIGO_TINNITUS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIFFICULTY_BREATHING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "PALPITATIONS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EPISTAXIS_BLEEDING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "LIMBS_NUMB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXTREMITY_EDEMA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SYMPTOM_OTHER": {
                "type": "string",
                "index": "not_analyzed"
            },
            "POLYDIPSIA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MORE_FOOD": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MORE_URINE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLURRED_VISION": {
                "type": "string",
                "index": "not_analyzed"
            },
            "INFECTION": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NUMB_HANDS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT_LOSS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYPOG_REACT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEIGHT_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BP_D": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BP_U": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NO_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RANDOM_BLOOD_SUGAR": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BMI": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BMI_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "OTHER_POSITIVE_SIGNS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "POFDA_MARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEART_RATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "GHB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RENAL_FUNCTION_CREATININE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RENAL_FUNCTION_BUN": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MICROALBUMINURIA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXAM_DATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_TRIGLYCERIDE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_TC": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_LDLC": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_SMOKING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SOMKING_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_DRINKING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRINK_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_FREQ_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_FREQ_CODE_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_DURATION_MINS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_DURATION_MINS_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SALT_TAKEN_LEVEL_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SALT_TAKEN_LEVEL_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "PSY_ADJUST_RESULT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "COMPLIANCE_RESULT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_STAPLE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYP_FOLLOWUP_TYPE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYP_COMPLICATION_DETAIL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIA_FOLLOWUP_TYPE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIA_COMPLICATION_DETAIL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRUG_COMPLIANCE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_DATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR_DOCTORCODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR_JWDOCTORCODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BP_U": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BP_D": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_NO_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_GHB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_TRIGLYCERIDE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_TOTAL_CHOLESTEROL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_LDL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_WEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_EXERCISE_FREQ_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_EXERCISE_DURATION_MINS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_TIME": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_OPERATOR_NAME": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEALTH_EDUCATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EDUCATE_CONTENT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRUG_ADVERSE_MARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ADR_REMARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "TRANSFER_RESON": {
                "type": "string",
                "index": "not_analyzed"
            },
            "TRANSFER_ORG_DEPT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "REFUSE_REFERRAL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "REFUSE_REFERRAL_WHY": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_ID": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CHECK_FEE_TYPE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "FAMILY_FOLLOWUP_ID": {
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }
}
增加索引搜索大小
PUT  http://172.19.103.68:9200/wlyy_followup/_settings
{
  "index": {
    "max_result_window": 500000
  }
}
续方完成之后的随访保存,BLOOD_SUGAR、BLOOD_SUGAR_TYPE
POST http://172.26.0.112:9200/wlyy_followup/wlyy_followup_content/_mapping
{
    "wlyy_followup_content": {
        "properties": {
            "BLOOD_SUGAR": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_SUGAR_TYPE": {
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }
}

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

@ -78,6 +78,20 @@ public class DoorOrderController extends BaseController {
    }
    @GetMapping("/getDoorOrderNum")
    @ApiOperation(value = "获取医生待服务工单数量")
    public String getDoorOrderNum(
            @ApiParam(name = "doctor", value = "医生codedoctor")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", doorOrderService.getDoorOrderNum(doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!" + e.getMessage());
        }
    }
    @PostMapping("/dispatchOrderSwitch")
    @ApiOperation(value = "分派订单开关修改")
    public String dispatchOrderSwitch(
@ -532,7 +546,6 @@ public class DoorOrderController extends BaseController {
    @RequestMapping(value = "selectServiceTypes", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "获取服务项目类型-上门服务")
    public String selectServiceTypes(){
        try {
@ -579,7 +592,7 @@ public class DoorOrderController extends BaseController {
            @ApiParam(value = "jsonData", name = "jsonData")
            @RequestParam(value = "jsonData", required = false) String jsonData) {
        try {
            doorOrderService.updatePackageItemInfo(jsonData);
            doorOrderService.updatePackageItemInfo(jsonData,getUID());
            return write(200, "修改成功");
        } catch (Exception e) {
            error(e);
@ -1364,4 +1377,23 @@ public class DoorOrderController extends BaseController {
        return null;
    }
    @ApiOperation("医生修改上门服务项")
    @RequestMapping(value = "updServiceItems" , method = RequestMethod.POST)
    public String updServiceItems(   @ApiParam(value = "医生code", name = "doctor")
                                         @RequestParam(value = "doctor", required = true) String doctor,
                                         @ApiParam(value = "工单id", name = "orderId")
                                         @RequestParam(value = "orderId", required = false) String orderId,
                                         @ApiParam(name = "level", value = "医院等级,1.三级医院,2.二级医院,3.一级及以下")
                                         @RequestParam(value = "level",required = true)Integer level ){
        try {
            return write(200, "修改成功", "data", "");
        }catch (Exception e){
            e.printStackTrace();
        }
        return write(-1,"修改失败");
    }
}

+ 159 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/followup/DoctorFollowUpController.java

@ -0,0 +1,159 @@
package com.yihu.jw.door.controller.doctor.followup;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.DoorOrderService;
import com.yihu.jw.door.service.followup.FollowUpService;
import com.yihu.jw.followup.FollowupContentESDO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/1/9.
 */
@RestController
@RequestMapping(value = "/doctor/followup", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-随访接口")
public class DoctorFollowUpController extends BaseController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private FollowUpService followUpService;
    @Autowired
    private DoorOrderService doorOrderService;
    @ApiOperation("暂不需要新增随访")
    @PostMapping(value = "/notAddFollowup")
    public String notAddFollowup(@ApiParam(name = "orderId", value = "订单id", defaultValue = "4")
                              @RequestParam(value = "orderId", required = true) String orderId) {
        try {
            doorOrderService.notAddFollowup(orderId);
            return write(200, "操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @ApiOperation("新增临时随访记录(返回ID)")
    @PostMapping(value = "/addFollowup")
    public String addFollowup(@ApiParam(name = "patient", value = "患者代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "date", value = "下次随访时间", defaultValue = "2016-12-15 20:00:00")
                              @RequestParam(value = "date", required = false) String date,
                              @ApiParam(name = "followupType", value = "随访方式【字典FOLLOWUP_WAY_DICT】", defaultValue = "25")
                              @RequestParam(value = "followupType", required = true) String followupType,
                              @ApiParam(name = "followupClass", value = "随访类别【1.高血压 2.糖尿病 3高糖】", defaultValue = "1")
                              @RequestParam(value = "followupClass", required = true) String followupClass,
                              @ApiParam(name = "followupManagerStatus", value = "随访管理状态【字典FOLLOWUP_MANAGER_STATUS】", defaultValue = "1")
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                              @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                              @RequestParam(value = "plandate", required = false) String plandate,
                              @ApiParam(name = "relateCode", value = "关联code", defaultValue = "关联code")
                              @RequestParam(value = "relateCode", required = false) String relateCode,
                              @ApiParam(name = "type", value = "随访类型", defaultValue = "0")
                              @RequestParam(value = "type", required = false) Integer type) {
        try {
            followUpService.addFollowup(getUID(), patient, date, followupType, followupClass, followupManagerStatus,plandate,relateCode,type);
            return write(200, "新增临时随访记录成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增临时随访记录失败!" + e.getMessage());
        }
    }
    @ApiOperation("获取随访信息")
    @GetMapping(value = "/getFollowup")
    public String getFollowup(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            Map<String, String> response = followUpService.getFollowup(id);
            try {
                String sql = "UPDATE`wlyy_followup` SET `doctor_read_status`='1' WHERE (`id`='"+id+"') ";
                jdbcTemplate.update(sql);
            }catch (Exception e){
                e.printStackTrace();
            }
            return write(200, "获取随访信息成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访信息失败!" + e.getMessage());
        }
    }
    @ApiOperation("获取随访项目列表")
    @GetMapping(value = "/getFollowupProject")
    public String getFollowupProject(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
                                     @RequestParam(value = "id", required = true) String id) {
        try {
            List<Map<String, String>> list = followUpService.getFollowupProject(id);
            return write(200, "获取随访项目列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目列表失败!" + e.getMessage());
        }
    }
    @ApiOperation("获取随访项目数据")
    @GetMapping(value = "/getFollowupProjectData")
    public String getFollowupProjectData(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
                                         @RequestParam(value = "id", required = true) String id,
                                         @ApiParam(name = "followupProject", value = "随访项目")
                                         @RequestParam(value = "followupProject", required = false) String followupProject) {
        try {
            FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectDataList(id, followupProject);
            String jsonString = JSON.toJSONString(followupContentESDO);
            Map maps = (Map)JSON.parse(jsonString);
            return write(200, "获取随访项目数据成功!", "data", maps);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
        }
    }
    @ApiOperation("保存随访项目数据")
    @PostMapping(value = "/saveFollowupProjectData")
    public String saveFollowupProjectData(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
                                          @RequestParam(value = "id", required = true) String id,
                                          @ApiParam(name = "followupProject", value = "随访项目", defaultValue = "2")
                                          @RequestParam(value = "followupProject", required = false) String followupProject,
                                          @ApiParam(name = "followupProjectData", value = "随访项目数据", defaultValue = "{\"BLOOD_SUGAR\":\"33.3\",\"BLOOD_SUGAR_TYPE\":\"1\",\"WEIGHT\":\"76\",\"WEIGHT_EXP\":\"60\",\"BMI\":\"11\"}")
                                          @RequestParam(value = "followupProjectData", required = true) String followupProjectData) {
        try {
            followUpService.esSaveFollowupProjectData(id, followupProject, followupProjectData);
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
        }
    }
    @ApiOperation("完成随访记录")
    @PostMapping(value = "/finishFollowup")
    public String finishFollowup(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                 @RequestParam(value = "id", required = true) String id) {
        try {
            followUpService.finishFollowup(id);
            return write(200, "完成随访记录成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "完成随访记录失败!" + e.getMessage());
        }
    }
}

+ 64 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/followup/DoctorFollowupDrugsController.java

@ -0,0 +1,64 @@
package com.yihu.jw.door.controller.doctor.followup;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.followup.FollowupDrugsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
 * 医生端:随访接口
 * 
 * @author hzp add 2016-12-07
 *
 */
@RestController
@RequestMapping(value = "/doctor/followup/drugs", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-随访用药接口")
public class DoctorFollowupDrugsController extends BaseController {
	@Autowired
	private FollowupDrugsService followupDrugsService;
	@ApiOperation("获取面访用药数据")
	@RequestMapping(value = "/getFollowupDrugs", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	public String getFollowupDrugs(@ApiParam(name="id",value="随访记录ID",defaultValue = "")
									@RequestParam(value="id",required = true) String id)
	{
		try {
			Map<String,Object> response = followupDrugsService.getFollowupDrugs(id);
			return write(200, "获取面访用药数据成功!","data",response);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取面访用药数据失败!"+e.getMessage());
		}
	}
	@ApiOperation("保存面访用药数据")
	@RequestMapping(value = "/saveFollowupDrugs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
	public String saveFollowupDrugs(@ApiParam(name="id",value="随访记录ID",defaultValue = "")
										  @RequestParam(value="id",required = true) String id,
									      @ApiParam(name="drugsData",value="面访用药数据",defaultValue = "[]")
										  @RequestParam(value="drugsData",required = true) String drugsData)
	{
		try {
			followupDrugsService.saveFollowupDrugs(id,drugsData);
			return write(200, "保存面访用药数据成功!");
		} catch (Exception e) {
			return invalidUserException(e, -1, "保存面访用药数据失败!"+e.getMessage());
		}
	}
}

+ 15 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java

@ -2,6 +2,7 @@ package com.yihu.jw.door.controller.patient;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.dao.common.SignFamilyDao;
import com.yihu.jw.door.service.common.ServerPackageService;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.SignFamily;
@ -19,6 +20,7 @@ import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@ -43,6 +45,19 @@ public class PatientController extends BaseController {
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ServerPackageService serverPackageService;
    @RequestMapping(value = "serviceOrder/selectServiceTypes", method = RequestMethod.POST)
    @ApiOperation(value = "获取服务项目类型-上门服务")
    public String selectServiceTypes(){
        try {
            return write(200, "查询成功", "data",serverPackageService.selectPatientTypes());
        } catch (Exception ex) {
            error(ex);
            return error(-1, "查询失败");
        }
    }
    @GetMapping(value = "getProfessionalDict")
    @ApiOperation("职业状态字典")

+ 26 - 3
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java

@ -75,7 +75,7 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
        if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            return failed(result.getString(ResponseContant.resultMsg));
        }
        return success(result.get(ResponseContant.resultMsg));
        return success(result);
    }
    @PostMapping(value = "delete")
@ -283,7 +283,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getPrescriptionByCode")
    @ResponseBody
    @ApiOperation("获取长处方详情")
    public Envelop getPrescriptionByCode(@ApiParam(name = "recipeNo", value = "挂号号",required = true)
                                         @RequestParam String recipeNo) {
@ -296,7 +295,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getProxyPatientList")
    @ResponseBody
    @ApiOperation("获取代预约服务对象列表")
    public Envelop getProxyPatientList() {
        try {
@ -307,5 +305,30 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getServiceItemFees")
    @ApiOperation("获取未付款的服务项")
    public Envelop getServiceItemFees(@ApiParam(name = "orderId", value = "订单id",required = true)
                                         @RequestParam String orderId) {
        try {
            JSONObject json = wlyyDoorServiceOrderService.getServiceItemFees(orderId);
            return success(json);
        } catch (Exception e) {
            return failed(e.getMessage());
        }
    }
    @PostMapping(value = "payServiceItemFees")
    @ApiOperation("付服务项费用")
    public Envelop payServiceItemFees(@ApiParam(name = "orderId", value = "订单id",required = true)
                                          @RequestParam String orderId,
                                      @ApiParam(name = "ids", value = "订单id",required = true)
                                      @RequestParam String[] ids) {
        try {
            JSONObject json = wlyyDoorServiceOrderService.payServiceItemFees(ids,orderId);
            return success(json);
        } catch (Exception e) {
            return failed(e.getMessage());
        }
    }
}

+ 8 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/WlyyDoorFeeDetailDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.door.dao;
import com.yihu.jw.entity.door.WlyyDoorFeeDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
@ -29,6 +30,13 @@ public interface WlyyDoorFeeDetailDao extends PagingAndSortingRepository<WlyyDoo
    @Query("select d from WlyyDoorFeeDetailDO d where d.orderId = ?1 and d.type=?2 and d.status <> 3")
    List<WlyyDoorFeeDetailDO> findByOrderIdAndType(String orderId, Integer type);
    @Query("select d from WlyyDoorFeeDetailDO d where d.orderId = ?1 and d.payStatus=?2 and d.status <> 3")
    List<WlyyDoorFeeDetailDO> findByOrderIdAndPayStatus(String orderId, Integer payStatus);
    @Query("select d.id as id,d.fee as fee,d.orderId as orderId from WlyyDoorFeeDetailDO d where d.code in(:codes) and d.type = :type")
    List<Map<String,Object>> findIdByCodeAndType(@Param("codes") List<String> codes, @Param("type") Integer type);
    @Modifying
    @Query("update WlyyDoorFeeDetailDO  set payStatus = 1 where id in (?1) ")
    int updatePayStatusById(String[] ids);
}

+ 90 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/followup/FollowUpDao.java

@ -0,0 +1,90 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.door.dao.followup;
import com.yihu.jw.entity.followup.Followup;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
import java.util.Set;
public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>, JpaSpecificationExecutor<Followup> {
    @Query("select a.followupDate from Followup a where a.doctorCode = ?1 and a.patientCode = ?2 and a.followupClass = '9'" )
    List<Date> findFollowupDateList(String doctor, String patientCode) throws Exception;
    @Query("select a.status from Followup a where a.doctorCode = ?1 and a.patientCode = ?2 and a.followupClass = '9'" )
    Set findStatusList(String doctor, String patientCode) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.patientCode = ?2 and a.followupClass = '9' order by a.followupPlanDate asc")
    List<Followup> findFollowupList(String doctor, String patientCode) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.patientCode = ?2 and a.followupDate = ?3 and a.followupClass = '9'")
    Followup findFollowupByDate(String doctor, String patientCode, Date followupDate) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    //查询未完成有效随访记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctor(String doctor, Date begin, Date end) throws Exception;
    //查询未完成有效随访计划记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctorPlan(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status <> '0' and a.followupClass=?4 and a.patientName like ?5 order by a.followupPlanDate DESC")
    List<Followup> findAllDoctorPlan(String doctor, Date begin, Date end, String followupClass, String patientName) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status <> '0' and a.patientCode = ?4 and a.followupClass = ?5 and a.patientName like ?6 order by a.followupPlanDate DESC")
    List<Followup> findAllDoctorPlan(String doctor, Date begin, Date end, String patientCode, String followupClass, String patientName) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status <> '0' and a.patientCode = ?4 and a.followupClass = ?5 and a.patientName like ?6 and a.followupClass in(5,6,7,8,9) order by a.followupPlanDate DESC")
    List<Followup> findAllDoorDoctorPlan(String doctor, Date begin, Date end, String patientCode, String followupClass, String patientName) throws Exception;
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status <> '0' and a.followupClass=?4 and a.patientName like ?5 and a.followupClass in(5,6,7,8,9) order by a.followupPlanDate DESC")
    List<Followup> findAllDoorDoctorPlan(String doctor, Date begin, Date end, String followupClass, String patientName) throws Exception;
    @Query("select a from Followup a where a.patientCode = ?1 and a.status <> '0' and a.doctorCode = ?2 order by a.followupPlanDate DESC")
    List<Followup> findAllPatientPlan(String patientCode, String doctorCode) throws Exception;
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    @Query(value = "select a.* from wlyy_followup a where a.doctor_code in ?1 and a.patient_code = ?2 and a.followup_class=?3 and a.status ='1' order by a.followup_date DESC limit 1",nativeQuery = true)
    Followup findLastFollowup(String[] doctors, String patientCode, String followClass) throws Exception;
    /**
     * 根据续方CODE获取随访记录
     * @param prescriptionCode
     * @return
     */
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.status <> '0'")
	Followup getFollowupByPrescriptionCode(String prescriptionCode);
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.followupClass = ?2 and a.status <> '0'")
    Followup getFollowupByPrescriptionCode(String prescriptionCode,String followupClass);
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.followupClass = ?2 and a.status <> '0'")
    List<Followup> getFollowupListByPrescriptionCode(String prescriptionCode,String followupClass);
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.status <> '0'")
    List<Followup> getFollowupListByPrescriptionCode(String prescriptionCode);
    
    @Modifying
    @Query("update Followup a set a.status=?2 where a.prescriptionCode = ?1 ")
    void updateStatusByPrescriptionCode(String prescriptionCode, String status);
    @Query("select a from Followup a where a.patientCode = ?1 and a.followupClass = ?2 and a.status = 1 order by a.followupDate desc")
    List<Followup> findAllByPatientCodeAndClass(String patientCode, String followupClass);
}

+ 22 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/followup/FollowupDrugsDao.java

@ -0,0 +1,22 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.door.dao.followup;
import com.yihu.jw.entity.followup.FollowupDrugs;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface FollowupDrugsDao extends PagingAndSortingRepository<FollowupDrugs, Long>, JpaSpecificationExecutor<FollowupDrugs> {
    @Modifying
    @Query("delete FollowupDrugs a where a.followupId=?1")
    int deleteByFollowupId(Long followupId) throws Exception;
    List<FollowupDrugs> findByFollowupId(Long followupId) throws Exception;
}

+ 109 - 13
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -5,18 +5,24 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.door.dao.*;
import com.yihu.jw.door.dao.followup.FollowUpDao;
import com.yihu.jw.door.util.MessageUtil;
import com.yihu.jw.door.util.StreamUtil;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.door.*;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
@ -25,6 +31,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang.StringUtils;
@ -87,6 +94,8 @@ public class DoorOrderService {
    private WlyyDoorDoctorStatusDao doctorStatusDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
/*    @Autowired
    private ServerPackageItemPatientDao serverPackageItemPatientDao;
    @Autowired
@ -134,6 +143,24 @@ public class DoorOrderService {
    private SystemMessageDao systemMessageDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private FollowUpDao followupDao;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    /**
     * 互联网查询待服务工单数
     * @param doctor
     * @return
     */
    public Integer getDoorOrderNum(String doctor){
        String sql = "SELECT COUNT(DISTINCT a.id) as num FROM wlyy_door_service_order a " ;
            sql +=  "LEFT JOIN wlyy_door_doctor d on d.order_id = a.id WHERE  (d.doctor ='"+doctor+"' or a.doctor = '"+doctor+"') and a.status = 4";
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    /**
@ -282,7 +309,7 @@ public class DoorOrderService {
     * @return
     */
    public List<Map<String, Object>> getDoorFeeDetailGroupByStatus(String orderId) {
        String sql = "SELECT d.id, d.status,d.name,d.code,sum(d.number) num,fee,sum(d.number)*fee sum from wlyy_door_fee_detail d where order_id=? and type=1 GROUP BY status,code";
        String sql = "SELECT d.id, d.status, CONCAT(d.pay_status,'') payStatus,d.name,d.code,sum(d.number) num,fee,sum(d.number)*fee sum from wlyy_door_fee_detail d where order_id=? and type=1 GROUP BY status,code";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, orderId);
        return list;
    }
@ -339,7 +366,7 @@ public class DoorOrderService {
        //获取咨询
        ConsultDo consult = consultDao.queryByRelationCode(id);
        if (null != consult) {
            doorServiceOrder.setSessionId(doorServiceOrder.getProxyPatient() + "_" + consult.getId() + "_"  + doorServiceOrder.getNumber() +  "_" +  consult.getType());
            doorServiceOrder.setSessionId(doorServiceOrder.getPatient() + "_" + consult.getId() + "_"  + doorServiceOrder.getNumber() +  "_" +  consult.getType());
        }
        // 设置服务小结
@ -350,13 +377,46 @@ public class DoorOrderService {
        doorConclusion.setServiceCount(count);
        doorServiceOrder.setDoorConclusion(doorConclusion);
        //获取上门前后开方详情
        getPrescription(doorServiceOrder);
        doorServiceOrder.setFollowupList(followupDao.getFollowupListByPrescriptionCode(doorServiceOrder.getId()));
        return doorServiceOrder;
    }
    public void notAddFollowup(String orderId){
        WlyyDoorServiceOrderDO doorServiceOrder = this.doorServiceOrderDao.findOne(orderId);
        if(StringUtils.isEmpty(doorServiceOrder.getFollowupDate())){
            doorServiceOrder.setFollowupDate(DateUtil.getStringDate());
            doorServiceOrderDao.save(doorServiceOrder);
        }
    }
    /**
     *  //获取上门前后开方详情
     * @param doorServiceOrder
     */
    public void getPrescription(WlyyDoorServiceOrderDO doorServiceOrder){
        String id = doorServiceOrder.getId();
        List<WlyyPrescriptionDO> doorBeforePrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 1);
        List<WlyyPrescriptionDO> doorAfterPrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 2);
        getPrescriptionList(doorBeforePrescriptionDOList);
        getPrescriptionList(doorAfterPrescriptionDOList);
        doorServiceOrder.setPrescriptionDOList(doorBeforePrescriptionDOList);
        doorServiceOrder.setAfterPrescriptionList(doorAfterPrescriptionDOList);
    }
        return doorServiceOrder;
    public void getPrescriptionList(List<WlyyPrescriptionDO> prescriptionDOList){
        for (WlyyPrescriptionDO one : prescriptionDOList){
            List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(one.getId() ,1);
            for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOs){
                if(diagnosisDO.getType()==1){
                    one.setDiagnosisName(diagnosisDO.getName());
                }else if(diagnosisDO.getType()==2&&StringUtils.isEmpty(one.getDiagnosisSubName())){
                    one.setDiagnosisSubName(diagnosisDO.getName());
                }
            }
        }
    }
    /**
@ -500,7 +560,9 @@ public class DoorOrderService {
        JSONArray docArr = new JSONArray();
        docArr.add(doc);
        jsonObjectParam.put("doctorArr",docArr);
        if (wlyyDoorServiceOrderService.orderWithDoctorAdd(new JSONObject(), jsonObjectParam, doorServiceOrder)) return null;
        if (wlyyDoorServiceOrderService.orderWithDoctorAdd(new JSONObject(), jsonObjectParam, doorServiceOrder)){
            return null;
        }
        doorServiceOrderDao.save(doorServiceOrder);
@ -551,8 +613,11 @@ public class DoorOrderService {
            String first = "key1,您好!您的上门预约服务已由【key2】医生接单了";
            first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
            first = first.replace("key2", null != doorServiceOrder.getDoctorName() ? doorServiceOrder.getDoctorName() : "");
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",patient.getOpenid(),first,null,null,30,json,DateUtil.dateToStrShort(new Date()),"上门服务已接单");
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            String openId = basePatientWechatDos.get(0).getOpenid();
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",openId,first,null,null,30,json,DateUtil.dateToChineseDate(new Date()),"上门服务已接单");
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        //  待接单消息设为已操作, 434 医生接单-- 王五接受了服务工单12345678
@ -758,7 +823,7 @@ public class DoorOrderService {
            //获取咨询
            ConsultDo consult = consultDao.queryByRelationCode(id);
            if (null != consult) {
                doorServiceOrder.setSessionId(doorServiceOrder.getProxyPatient() + "_" + consult.getId() + "_"  + doorServiceOrder.getNumber() +  "_" +  consult.getType());
                doorServiceOrder.setSessionId(doorServiceOrder.getPatient() + "_" + consult.getId() + "_"  + doorServiceOrder.getNumber() +  "_" +  consult.getType());
            }
            object.put("sessionId",doorServiceOrder.getSessionId());
@ -988,8 +1053,10 @@ public class DoorOrderService {
                finish = "1";
                json.put("finish",finish);
            }
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            String openId = basePatientWechatDos.get(0).getOpenid();
            String first="key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,31,json,DateUtil.dateToStrShort(new Date()),"服务医生评分");
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",openId,first,null,null,31,json,DateUtil.dateToChineseDate(new Date()),"服务医生评分");
        }catch (Exception e){
            logger.error(e.getMessage());
@ -1047,8 +1114,10 @@ public class DoorOrderService {
                finish = "1";
                json.put("finish",finish);
            }
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            String openId = basePatientWechatDos.get(0).getOpenid();
            String first="key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,31,json,DateUtil.dateToStrShort(new Date()),"服务医生评分");
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",openId,first,null,null,31,json,DateUtil.dateToChineseDate(new Date()),"服务医生评分");
        }catch (Exception e){
            logger.error(e.getMessage());
        }
@ -1247,7 +1316,7 @@ public class DoorOrderService {
        if (doorDoctorDOList != null && doorDoctorDOList.size() > 0) {
            List<String> jobCodeList = doorDoctorDOList.stream().map(WlyyDoorDoctorDO::getDoctorJobCode).collect(Collectors.toList());
//            Double jobFeeCost = dmJobService.getJobFeeCost(jobCodeList, level, times);
            Double jobFeeCost = 120d;
            Double jobFeeCost = 30d;
            if(null != jobFeeCost){
                price = price.add(BigDecimal.valueOf(jobFeeCost));
            }
@ -1267,7 +1336,7 @@ public class DoorOrderService {
        if (doorDoctorDOList != null && doorDoctorDOList.size() > 0) {
            for(WlyyDoorDoctorDO wlyyDoorDoctorDO:doorDoctorDOList){
//                Double jobFeeCost = dmJobService.getJobFee(wlyyDoorDoctorDO.getDoctorJobCode(), level, times);
                Double jobFeeCost = 120d;
                Double jobFeeCost = 30d;
                wlyyDoorDoctorDO.setJobFeeCost(jobFeeCost);
                doorDoctorDao.save(wlyyDoorDoctorDO);
                djDetailList.add(wlyyDoorDoctorDO);
@ -1295,14 +1364,14 @@ public class DoorOrderService {
     * @param jsonData
     */
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public void updatePackageItemInfo(String jsonData) {
    public void updatePackageItemInfo(String jsonData,String doctorId) {
        JSONObject jsonObjectParam = JSONObject.parseObject(jsonData);
        String orderId = String.valueOf(jsonObjectParam.get("orderId"));
        WlyyDoorServiceOrderDO order = doorServiceOrderDao.findOne(orderId);
        // 删除出诊医生或服务项
        wlyyDoorServiceOrderService.orderWithFeeDelete(jsonObjectParam,order);
        // 更新服务包信息
        wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order);
        wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order,doctorId);
        // 发送微信模板消息,通知居民服务项目已经变更(smyyyjjd-服务项目变更通知)
       BasePatientDO patient = patientInfoService.findById(order.getProxyPatient());//·
@ -1682,4 +1751,31 @@ public class DoorOrderService {
       List<Map<String,Object>> list = jdbcTemplate.queryForList(sqlList+sql);
        return list;
   }
    /**
     *
     * @param doctorId
     * @param orderDO
     */
   public void putTemplateTobePay(WlyyDoorServiceOrderDO orderDO,String doctorId){
       if(StringUtils.isEmpty(doctorId)){
           return;
       }
       JSONObject json = new JSONObject();
       String orderId = orderDO.getId();
       String payTypeName = "上门服务";
       List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,orderDO.getPatient());
       String openId = basePatientWechatDos.get(0).getOpenid();
       String patientName = orderDO.getPatientName();
       BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
       String doctorName = doctorDO.getName();
       String deptName = "";
       List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByOrgCodeAndDoctorCode("350211A1002",doctorId);
       if(doctorHospitalDOs.size()>0){
           deptName = doctorHospitalDOs.get(0).getDeptName();
       }
       json.put("orderId",orderId);
       messageUtil.putTemplateWxMessage(wxId,"template_to_be_pay","smfwqrfk",openId,DateUtil.dateToStr(new Date(), "yyyy/MM/dd HH:mm"),null,null,35,json,patientName,deptName,payTypeName,doctorName,DateUtil.dateToChineseTime(new Date()));
   }
}

+ 8 - 25
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java

@ -21,6 +21,7 @@ import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.jsoup.helper.DataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
@ -584,11 +585,11 @@ public class DoorServiceApplicationService {
        if(null!=wlyyDoorServiceApplicationDo1){
            //给代理申请资质的居民发送微信模板消息-审核结果//·
            BasePatientDO patient = patientInfoService.findById(wlyyDoorServiceApplicationDo1.getProxyPatient());
            String first ="key1您好,key2的资格审核医生已处理。";
            first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
            first = first.replace("key2", (wlyyDoorServiceApplicationDo1.getPatientName() == null ? "" : wlyyDoorServiceApplicationDo1.getPatientName()));
            wlyyDoorServiceApplicationDo1.getAuditorName();
            messageUtil.putTemplateWxMessage(wxId,"template_doctor_audit",scene,patient.getOpenid(),first,null,null,19,null,null,wlyyDoorServiceApplicationDo1.getAuditorName());
//            String first ="key1您好,key2的资格审核医生已处理。";
//            first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
//            first = first.replace("key2", (wlyyDoorServiceApplicationDo1.getPatientName() == null ? "" : wlyyDoorServiceApplicationDo1.getPatientName()));
//            wlyyDoorServiceApplicationDo1.getAuditorName();
//            messageUtil.putTemplateWxMessage(wxId,"template_doctor_audit",scene,patient.getOpenid(),first,null,null,19,null,null,wlyyDoorServiceApplicationDo1.getAuditorName());
        }
@ -650,26 +651,8 @@ public class DoorServiceApplicationService {
    }
    public String myMyTest(){
        messageUtil.putTemplateWxMessage("xm_test_ihealth_wx","template_process_feedback","smyyyqx","ojsU-1XvRLx_IjDj96S4gxIRBNlY","您的上门服务知情同意书已送达",null,null,30,null,DateUtil.dateToStrShort(new Date()),"知情同意书已推送");
//        BasePatientDO patient = patientDao.findById("3ae2673512154d5280d1dcf5ffa5626d");
//        WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_test_ihealth_wx", "template_process_feedback", "smyyyqx", 1);
//        String first = templateConfig.getFirst().replace("key1", null != patient.getName() ? patient.getName() : "");
//        org.json.JSONObject json = new org.json.JSONObject();
//        templateConfig.setFirst("白海灵您好!您的上门服务知情同意书已送达");
//        templateConfig.setKeyword1(DateUtil.dateToStrShort(new Date()));
//        templateConfig.setKeyword2("知情同意书已推送");
//        json.put("url", templateConfig.getUrl());
//        json.put("url", "appoint_service/html/appoint-serviceDetail.html?id="+orderId);
////        appoint_service/html/appoint-serviceDetail.html?openid=ojsU-1XJVftkfdbP1F5bi8JVPtOo&consult=e0d17c67ab07477f8e96534bc610e51b
//        json.put("remark", templateConfig.getRemark());
//        if(consult != null) {
//            json.put("consult", consult.getCode());
//        }else {
//            json.put("id", orderDO.getId());
//        }
//        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json);
//        messageUtil
        messageUtil.putTemplateWxMessage("xm_test_ihealth_wx","template_to_be_pay","smfwqrfk","ojsU-1XvRLx_IjDj96S4gxIRBNlY",DateUtil.dateToStr(new Date(), "yyyy/MM/dd HH:mm"),null,null,30,null,null,null,null,null,DateUtil.dateToChineseTime(new Date()));
        return "ss";
    }

+ 9 - 5
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorPrescriptionService.java

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.door.dao.DoorServiceOrderDao;
import com.yihu.jw.door.dao.WlyyDoorPrescriptionDao;
@ -16,10 +15,10 @@ import com.yihu.jw.door.util.MessageUtil;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.door.WlyyDoorPrescriptionDO;
import com.yihu.jw.entity.door.WlyyDoorPrescriptionDrugDO;
import com.yihu.jw.entity.door.WlyyDoorServiceOrderDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.util.ImUtil;
@ -27,6 +26,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -90,6 +90,8 @@ public class WlyyDoorPrescriptionService  extends BaseJpaService<WlyyDoorPrescri
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Value("${server.server_url}")
    private String server_url;
@ -108,7 +110,7 @@ public class WlyyDoorPrescriptionService  extends BaseJpaService<WlyyDoorPrescri
     */
    public JSONArray getPrescription(String doctor, String patient, String visitDept, String visitTimeFrom, String visitTimeEnd) throws Exception {
        JSONArray array = new JSONArray();
        if (StringUtils.isEmpty(visitTimeFrom)) {
/*        if (StringUtils.isEmpty(visitTimeFrom)) {
            visitTimeEnd = DateUtil.getStringDateShort();
            Calendar c = Calendar.getInstance();
            c.setTime(new Date());
@ -121,7 +123,7 @@ public class WlyyDoorPrescriptionService  extends BaseJpaService<WlyyDoorPrescri
        array = JSONObject.parseObject(re).getJSONArray("returnData");
        if(array.size() > 0) {
            array.getJSONArray(0).sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("VISIT_NO")).reversed());
        }
        }*/
//        String jsonString = "[]";
        /*String jsonString = "[{\"RECIPE_NO\": \"123456\",\"DIAGNOSE_NAME\": \"高血压\",\"DIAGNOSE_CODE\":\"1\",\"TOTAL_FEE\":\"125\",\"APPLY_TIME\": \"2019-04-24 09:15:00\", \"RECIPE_DETAIL\":[{\"ITEM_CODE\": \"12\",\"ITEM_NAME\": \"尿液分析\",\"ITEM_PRICE\": \"25.00\",\"ITEM_QUANTITY\": \"1\",\"COST\": \"25\"}," +
                "{\"ITEM_CODE\": \"13\",\"ITEM_NAME\": \"出诊费\",\"ITEM_PRICE\": \"50\",\"ITEM_QUANTITY\": \"2\",\"COST\": \"100\"}]},{\"RECIPE_NO\": \"23333\",\"DIAGNOSE_NAME\": \"高血压,糖尿病\",\"DIAGNOSE_CODE\":\"2\",\"TOTAL_FEE\":\"125\",\"APPLY_TIME\": \"2019-04-23 09:15:00\", " +
@ -271,7 +273,9 @@ public class WlyyDoorPrescriptionService  extends BaseJpaService<WlyyDoorPrescri
        json.put("orderId", orderDO.getId());
        json.put("openId", patient.getOpenid());
        json.put("authorizeImage", orderDO.getAuthorizeImage());
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","authorize",patient.getOpenid(),first,null,null,34,json,DateUtil.dateToStrShort(new Date()));
        List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
        String openId = basePatientWechatDos.get(0).getOpenid();
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","authorize",openId,first,null,null,34,json,DateUtil.dateToChineseDate(new Date()));
/*        Patient patient = patientDao.findByCode(orderDO.getPatient());//·
        //发送微信模板消息

+ 70 - 18
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.door.*;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
@ -28,6 +29,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
@ -119,6 +121,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
/*    @Autowired
    private PushMsgTask pushMsgTask;
@ -174,6 +178,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
     * 上门服务工单服务基本信息
     *
@ -230,13 +235,15 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public boolean orderWithPackageItemFeeAdd(JSONObject result, JSONObject jsonObjectParam, WlyyDoorServiceOrderDO order ) {
    public boolean orderWithPackageItemFeeAdd(JSONObject result, JSONObject jsonObjectParam, WlyyDoorServiceOrderDO order,String doctorId) {
        List<WlyyDoorFeeDetailDO> feeDetailDOList = new ArrayList<>();
        List<WlyyDoorOrderItemDO> orderItemDOList = new ArrayList<>();
        BigDecimal totalFee = order.getTotalFee();
        if(null == totalFee){
            totalFee = new BigDecimal(0);
        }
        //新增服务项
        int addNum = 0;
        //服务项费用
        JSONArray packageItemArray = jsonObjectParam.getJSONArray("packageItemArr");
        if (!CollectionUtils.isEmpty(packageItemArray)) {
@ -249,7 +256,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                    orderItemDO.setDoctor(order.getDoctor());
                    orderItemDO.setCode(feeDetailDO.getCode());
                    orderItemDO.setCreateTime(new Date());
                    orderItemDO.setPatient(orderItemDO.getPatient());
                    orderItemDO.setPatient(order.getPatient());
                    orderItemDOList.add(orderItemDO);
                } catch (Exception e) {
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
@ -276,6 +283,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                }else{
                    feeDetailDO.setStatus(status);
                }
//                feeDetailDO.setNumber(1);
                feeDetailDO.setOrderId(order.getId());
                if(StringUtils.isBlank(feeDetailDO.getId())) {
@ -283,7 +291,12 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                }else {
                    feeDetailDO.setUpdateTime(new Date());
                }
                feeDetailDOList.add(feeDetailDO);
                if(StringUtils.isBlank(feeDetailDO.getId())){
                    feeDetailDO.setPayStatus(0);
                    addNum++;
                    feeDetailDOList.add(feeDetailDO);
                }
            }
//            order.setTotalFee(totalFee);
//            this.save(order);
@ -303,6 +316,10 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            order.setTotalFee(new BigDecimal(0));
            this.save(order);
        }*/
        if(addNum>0){
            doorOrderService.putTemplateTobePay(order,doctorId);
        }
        return false;
    }
@ -342,11 +359,12 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            for(Object oneId : itemArray) {
                JSONObject oneIdJson = (JSONObject) oneId;
                WlyyDoorFeeDetailDO doorFeeDetail = wlyyDoorFeeDetailDao.findOne(String.valueOf(oneIdJson.get("id")));
                doorFeeDetail.setStatus(3);
                doorFeeDetail.setUpdateTime(new Date());
                list.add(doorFeeDetail);
                itemFee = itemFee.add(doorFeeDetail.getFee().multiply(BigDecimal.valueOf(doorFeeDetail.getNumber())));
                if(doorFeeDetail.getPayStatus()==0){
                    doorFeeDetail.setStatus(3);
                    doorFeeDetail.setUpdateTime(new Date());
                    list.add(doorFeeDetail);
                    itemFee = itemFee.add(doorFeeDetail.getFee().multiply(BigDecimal.valueOf(doorFeeDetail.getNumber())));
                }
            }
            wlyyDoorFeeDetailDao.save(list);
//            orderDO.setTotalFee(totalFee.subtract(itemFee));
@ -467,7 +485,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                // 被服务的居民的次数(非代理居民)
                Integer tiems = countPatientDoorTimes(orderDO.getPatient());
//                BigDecimal fee = BigDecimal.valueOf(dmJobService.getJobFee(doorDoctorDO.getDoctorJobCode(),doorDoctorDO.getHospitalLevel(),tiems));
                BigDecimal fee = BigDecimal.valueOf(120);
                BigDecimal fee = BigDecimal.valueOf(30);
                feeDetailDO.setFee(fee);
                totalFee = totalFee.add(fee);
                feeDetailDOList.add(feeDetailDO);
@ -623,7 +641,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }
        orderDO.setServiceStatus("1");
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        //创建咨询
        JSONObject successOrNot = null;
        try {
@ -642,8 +660,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        ConsultTeamDo consultTeam = (ConsultTeamDo)successOrNot.get(ResponseContant.resultMsg);
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO)) {return result;}
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}
        if ( StringUtils.isNotBlank(orderDO.getDoctor())) {
            orderDO.setStatus(2);
@ -1023,7 +1040,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        //获取上门前后开方详情
        List<WlyyPrescriptionDO> doorBeforePrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 1);
        List<WlyyPrescriptionDO> doorAfterPrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 2);
        doorOrderService.getPrescriptionList(doorBeforePrescriptionDOList);
        doorOrderService.getPrescriptionList(doorAfterPrescriptionDOList);
        orderJson.put("doorBeforePrescription",doorBeforePrescriptionDOList);
        orderJson.put("doorAfterPrescription", doorAfterPrescriptionDOList);
        return orderJson;
@ -1465,8 +1483,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }else {
            json.put("id", orderDO.getId());
        }
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",patient.getOpenid(),first,null,null,30,json,DateUtil.dateToStrShort(new Date()),"上门预约已取消");
        List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
        String openId = basePatientWechatDos.get(0).getOpenid();
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,30,json,DateUtil.dateToChineseDate(new Date()),"上门预约已取消");
/*        Consult consult = consultDao.queryByRelationCode(orderId);
        // 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
@ -1514,7 +1533,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }else {
            json.put("id", orderDO.getId());
        }
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",patient.getOpenid(),first,url,null,30,json,DateUtil.dateToStrShort(new Date()),"知情同意书已推送");
        List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
        String openId = basePatientWechatDos.get(0).getOpenid();
        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,url,null,30,json,DateUtil.dateToChineseDate(new Date()),"知情同意书已推送");
/*        BasePatientDO patient = patientDao.findById(orderDO.getPatient());
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_process_feedback","smyyyqx");
@ -2742,7 +2763,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO)) {return result;}
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,doctorCode)) {return result;}
        if("1".equals(orderDO.getShortcutType())){
            //快捷的当前医生直接接单
@ -2842,7 +2863,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO)){
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,doctorCode)){
            return result;
        }
@ -2927,4 +2948,35 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        result.put(ResponseContant.resultMsg, wlyyDoorServiceOrder);
        return result;
    }
    /**
     * 获取未付款的服务项
     * @param orderId
     * @return
     */
    public JSONObject getServiceItemFees(String orderId){
        JSONObject json = new JSONObject();
        List<WlyyDoorFeeDetailDO> feeDetailDOs = wlyyDoorFeeDetailDao.findByOrderIdAndPayStatus(orderId, 0);
        BigDecimal sum = new BigDecimal(0);
        for (WlyyDoorFeeDetailDO feeDetailDO: feeDetailDOs){
            sum = sum.add(feeDetailDO.getFee().multiply(new BigDecimal(feeDetailDO.getNumber())));
        }
        sum = sum.setScale(1, BigDecimal.ROUND_DOWN);
        json.put("orderId",orderId);
        json.put("sum",sum);
        json.put("feeDetailDOs",feeDetailDOs);
        return json;
    }
    @Transactional
    public JSONObject payServiceItemFees(String[] ids,String orderId){
        JSONObject json = new JSONObject();
        wlyyDoorFeeDetailDao.updatePayStatusById(ids);
//        WlyyDoorServiceOrderDO orderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        json.put("patient",consult.getPatient());
        json.put("consult",consult.getId());
        return json;
    }
}

+ 14 - 4
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/ServerPackageService.java

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
@ -22,8 +21,6 @@ import java.util.Map;
@Transactional
public class ServerPackageService  {
    private static org.slf4j.Logger logger = LoggerFactory.getLogger(ServerPackageService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.id}")
@ -94,7 +91,7 @@ public class ServerPackageService  {
                //上门护理
                sql = "SELECT code,value title,'' unit,0 expense   from base_system_dict_entry WHERE dict_code = 'door_service_door_dict' ORDER BY sort";
            }else{
                sql = "SELECT a.FYXH code,a.FYMC title,a.FYDW unit,a.FYDJ expense from gy_ylsf a ";
                sql = "SELECT DISTINCT a.FYXH code,a.FYMC title,a.FYDW unit,a.FYDJ expense from gy_ylsf a ";
                if("used".equals(type)){
                    sql += " JOIN wlyy_door_order_item i on i.code = a.FYXH and (i.patient = '"+patient+"' or i.doctor='"+doctor+"') ";
                }else if("other".equals(type)){
@ -137,7 +134,20 @@ public class ServerPackageService  {
        return mapList;
    }
    /**
     * 居民端服务项类型
     * @return
     */
    public List<Map<String,Object>> selectPatientTypes(){
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict' and code = 'door'";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 医生端服务项类型
     * @return
     */
    public List<Map<String,Object>> selectTypes(){
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict' ORDER BY sort";
        List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);

+ 46 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/WlyySystemDictService.java

@ -0,0 +1,46 @@
package com.yihu.jw.door.service.common;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * Created by yeshijie on 2021/1/9.
 */
@Service
@Transactional
public class WlyySystemDictService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public List<SystemDictEntryDO> getDictByDictName(String dictCode) {
        String sql = "select d.* from base_system_dict_entry d where d.dict_code = '"+dictCode+"'";
        return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SystemDictEntryDO.class));
    }
    /**
     * 查找字典项
     * @param dictCode
     * @param code
     * @return
     */
    public String getDictValue(String dictCode, String code) {
        String re = null;
        try {
            String sql = "select d.value from base_system_dict_entry d where d.dict_code = '"+dictCode+"' and d.code = '"+code+"'";
            re = jdbcTemplate.queryForObject(sql,String.class);
        }catch (Exception e){
            e.printStackTrace();
        }
        return re;
    }
}

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

@ -0,0 +1,485 @@
package com.yihu.jw.door.service.followup;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.door.dao.WlyyDoorServiceOrderDao;
import com.yihu.jw.door.dao.followup.FollowUpDao;
import com.yihu.jw.door.service.common.WlyySystemDictService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.jw.entity.door.WlyyDoorServiceOrderDO;
import com.yihu.jw.entity.followup.Followup;
import com.yihu.jw.es.es.ElasticFactory;
import com.yihu.jw.es.es.ElastricSearchSave;
import com.yihu.jw.followup.FollowupContentESDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.util.*;
/**
 * Created by yeshijie on 2021/1/9.
 */
@Component
@Transactional(rollbackOn = Exception.class)
public class FollowUpService {
    private static Logger logger = LoggerFactory.getLogger(FollowUpService.class);
    @Autowired
    private FollowUpDao followupDao;
    @Autowired
    private WlyySystemDictService systemDictService;
    @Value("${es.type.FollowUpContent}")
    private String esType;
    @Value("${es.index.FollowUp}")
    private String esIndex;
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private WlyyDoorServiceOrderDao doorServiceOrderDao;
    /**
     * ES获取面访项目数据
     */
    public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
        JestClient jestClient = null;
        FollowupContentESDO followupContentESDO = null;
        try {
            //根据随访ID、分类ID获取随访记录详情
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
                            .must(QueryBuilders.matchQuery("followup_project", followupProject))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return followupContentESDO;
    }
    /**
     * 新增临时随访记录(返回ID)
     */
    public void addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus, String plandate, String relateCode,Integer type) throws Exception {
        //获取医生信息
        BaseDoctorDO doctor = doctorDao.findById(doctorCode);
        if (doctor == null) {
            throw new Exception("not exit doctor:" + doctorCode + ".\r\n");
        }
        //获取患者信息
        BasePatientDO patient = patientDao.findById(patientCode);
        if (patient == null) {
            throw new Exception("not exit patient:" + patientCode + ".\r\n");
        }
        String followupClasss[] = followupClass.split(",");
        for (String followupClassTemp:followupClasss){
            List<Followup> followupTemp = followupDao.getFollowupListByPrescriptionCode(relateCode,followupClassTemp);
            if(followupTemp.size()>0){
                continue;
            }
            Followup followup = new Followup();
            if(StringUtils.isNoneBlank(date)){
                Date followDate = DateUtil.strToDate(date);
                followup.setFollowupDate(followDate);
                followup.setFollowupPlanDate(followDate);
            }else{
                followup.setFollowupDate(new Date());
            }
            followup.setDoctorCode(doctorCode);
            followup.setDoctorName(doctor.getName());
//        followup.setOrgCode(doctor.getHospital());
//        followup.setOrgName(doctor.getHospitalName());
            followup.setPatientCode(patientCode);
            followup.setPatientName(patient.getName());
            followup.setIdcard(patient.getIdcard());
            followup.setFollowupType(followupType);
            followup.setFollowupClass(followupClassTemp);
            followup.setFollowupManagerStatus(followupManagerStatus);
            followup.setDataFrom("2");//数据来源 1基卫 2APP
            followup.setStatus("2");     //状态 0取消 1已完成 2未开始 3进行中
            followup.setCreateTime(new Date());
            followup.setCreater(doctorCode);
            followup.setSignType(2);
            if (type!=null&&type!=0){
                followup.setType(type);
            }
            //如果有填入续方CODE,则添加续方关联--huangwenjie.2017.11.02
            if (StringUtils.isNotBlank(relateCode)) {
                followup.setPrescriptionCode(relateCode);
            }
            //计划下次随访时间--ysj.2017.10.26
            if (StringUtils.isNoneBlank(plandate)) {
                followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                Followup nextFollowup = new Followup();
                nextFollowup.setDataFrom(followup.getDataFrom());
                nextFollowup.setStatus("2");
                nextFollowup.setFollowupType(followupType);
                nextFollowup.setFollowupNo(followup.getFollowupNo());
                nextFollowup.setFollowupDate(DateUtil.strToDate(plandate));
                nextFollowup.setFollowupPlanDate(DateUtil.strToDate(plandate));
                nextFollowup.setJwdoctorCode(followup.getJwdoctorCode());
                nextFollowup.setJworgCode(followup.getJworgCode());
                nextFollowup.setOrgCode(followup.getOrgCode());
                nextFollowup.setOrgName(followup.getOrgName());
                nextFollowup.setCreater(followup.getCreater());
                nextFollowup.setSignCode(followup.getSignCode());
                nextFollowup.setAdminTeamCode(followup.getAdminTeamCode());
                nextFollowup.setFollowupClass(followupClassTemp);
                nextFollowup.setFollowupManagerStatus(followupManagerStatus);
                nextFollowup.setPatientName(followup.getPatientName());
                nextFollowup.setPatientCode(followup.getPatientCode());
                nextFollowup.setCreateTime(new Date());
                nextFollowup.setUpdateTime(new Date());
                nextFollowup.setDoctorCode(followup.getDoctorCode());
                nextFollowup.setDoctorName(followup.getDoctorName());
                nextFollowup.setIdcard(followup.getIdcard());
                nextFollowup.setSignType(followup.getSignType());
                nextFollowup.setType(type);
                followupDao.save(nextFollowup);
            }
            followupDao.save(followup);
        }
        WlyyDoorServiceOrderDO orderDO = doorServiceOrderDao.findOne(relateCode);
        if(orderDO!=null){
            orderDO.setFollowupDate(DateUtil.getStringDate());
        }
    }
    /**
     * 完成随访记录,并上传随访记录
     */
    public void finishFollowup(String id) throws Exception {
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if (followup != null) {
            followup.setStatus("1");  //状态 0取消 1已完成 2未开始 3进行中
            followupDao.save(followup);
        } else {
            throw new Exception("not exit follow:" + id + ".\r\n");
        }
    }
    /**
     * ES 保存随访记录详情
     *
     * @author huangwenjie
     * @date 2017/11/1 14:57
     */
    @Transactional
    public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
        JestClient jestClient = null;
        try {
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
                            .must(QueryBuilders.matchQuery("followup_project", followupProject))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            FollowupContentESDO followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
            List<FollowupContentESDO> dataList = new ArrayList<>();
            if(followupContentESDO != null){
                dataList.add(followupContentESDO);
                //删除原有记录
                this.esDeleteFollowUpContent(dataList);
            }
            //保存新的随访详情信息
            List<FollowupContentESDO> newdatalist = new ArrayList<>();
            followupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
            followupContentESDO.setFollowup_id(id);
            followupContentESDO.setFollowup_project(followupProject);
            followupContentESDO.setCreate_time(new Date());
            newdatalist.add(followupContentESDO);
            elastricSearchSave.save(newdatalist, esIndex, esType);
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
    /**
     * ES 删除随访详情信息
     *
     * @author huangwenjie
     * @date 2017/11/1 15:17
     */
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception {
        JestClient jestClient = null;
        try {
            jestClient = elasticFactory.getJestClient();
            //根据id批量删除
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (FollowupContentESDO obj : datalist) {
                Delete index = new Delete.Builder(obj.getId()).build();
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("delete data count:" + datalist.size());
            logger.info("delete flag:" + br.isSucceeded());
            jestClient.shutdownClient();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
    /**
     * ES获取表单项目数据
     */
    public FollowupContentESDO esGetFollowupProjectDataList(String id, String followupProject) throws Exception {
        JestClient jestClient = null;
        FollowupContentESDO followupContentESDO = null;
        try {
            //根据随访ID、分类ID获取随访记录详情
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            if(StringUtils.isNotBlank(followupProject)) {
                searchSourceBuilder.query(
                        new BoolQueryBuilder()
                                .must(QueryBuilders.matchQuery("followup_id", id))
                                .must(QueryBuilders.matchQuery("followup_project", followupProject))
                );
            }else {
                searchSourceBuilder.query(
                        new BoolQueryBuilder()
                                .must(QueryBuilders.matchQuery("followup_id", id))
                                .mustNot(QueryBuilders.existsQuery("followup_project"))
                );
            }
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return followupContentESDO;
    }
    /**
     * 获取面访项目列表
     */
    public List<Map<String, String>> getFollowupProject(String id) throws Exception {
        List<Map<String, String>> re = new ArrayList<>();
        //获取已填写的面访项目
        List<String> project = esfindProjectByFollowupId(id);
        //获取所有面访项目
        List<SystemDictEntryDO> dictList = systemDictService.getDictByDictName("FOLLOWUP_PROJECT");
        if (dictList != null && dictList.size() > 0) {
            for (SystemDictEntryDO dict : dictList) {
                Map<String, String> map = new HashMap<>();
                String code = dict.getCode();
                map.put("projectCode", code);
                map.put("projectName", dict.getValue());
                if (project != null && project.contains(code)) {
                    map.put("status", "1"); //已填写
                } else {
                    map.put("status", "0");//未填写
                }
                re.add(map);
            }
        }
        return re;
    }
    /**
     * 获取面访项目列表
     */
    public Map<String, String> getFollowup(String id) throws Exception {
        Map<String, String> re = new HashMap<>();
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if (followup != null) {
            re = getFollowupDetail(followup);
        } else {
            throw new Exception("not exit follow:" + id + ".\r\n");
        }
        return re;
    }
    /**
     * 转译随访信息
     */
    private Map<String, String> getFollowupDetail(Followup followup) throws Exception {
        Map<String, String> re = new HashMap<>();
        //患者信息
        String patientCode = followup.getPatientCode();
        BasePatientDO patient = patientDao.findById(patientCode);
        if (patient != null) {
            re.put("patientCode", patientCode);
            re.put("patientName", patient.getName());
            re.put("idcard", patient.getIdcard());
            String mobile = patient.getMobile();
            if (StringUtils.isEmpty(mobile)) {
                mobile = patient.getMobileRemarks();
            }
            re.put("mobile", mobile);
            re.put("sex", String.valueOf(patient.getSex()));
            re.put("birthday", DateUtil.dateToStrLong(patient.getBirthday()));
            re.put("photo", patient.getPhoto());
        } else {
            throw new Exception("not exit patient:" + patientCode);
        }
        re.put("id", String.valueOf(followup.getId()));
        re.put("followupNo", followup.getFollowupNo());
        re.put("followupDate", DateUtil.dateToStrLong(followup.getFollowupDate()));
        re.put("followupNextDate", DateUtil.dateToStrLong(followup.getFollowupNextDate()));
        //随访方式转译
        re.put("followupType", followup.getFollowupType());
        String followupTypeName = systemDictService.getDictValue("FOLLOWUP_WAY_DICT", followup.getFollowupType());
        re.put("followupTypeName", followupTypeName);
        //随访类别转译
        String followupClass = followup.getFollowupClass();
        re.put("followupClass", followupClass);
        String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
        if (StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")) {
            String[] followupClassArray = followupClass.split(",");
            followupClassName = "";
            for (int i = 0; i < followupClassArray.length; i++) {
                followupClassName += systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followupClassArray[i]);
                if (i != followupClassArray.length - 1) {
                    followupClassName += ",";
                }
            }
        }
        re.put("followupClassName", followupClassName);
        //随访管理状态转译
        re.put("followupManagerStatus", followup.getFollowupManagerStatus());
        if(StringUtils.isNoneBlank(followup.getFollowupManagerStatus())){
            String followupManagerStatusName = systemDictService.getDictValue("FOLLOWUP_MANAGER_STATUS", followup.getFollowupManagerStatus());
            re.put("followupManagerStatusName", followupManagerStatusName);
        }
        re.put("doctorCode", followup.getDoctorCode());
        re.put("doctorName", followup.getDoctorName());
        re.put("orgCode", followup.getOrgCode());
        re.put("orgName", followup.getOrgName());
        re.put("dataFrom", followup.getDataFrom());
        re.put("status", followup.getStatus());
        re.put("followupContentPhone", followup.getFollowupContentPhone());
        re.put("createTime", DateUtil.dateToStrLong(followup.getCreateTime()));
        re.put("creater", followup.getCreater());
        re.put("prescriptionCode",followup.getPrescriptionCode());
        return re;
    }
    /**
     * ES获取面访项目数据列表
     *
     * @author huangwenjie
     * @date 2017/11/1 19:41
     */
    public List<String> esfindProjectByFollowupId(String id) throws Exception {
        JestClient jestClient = null;
        List<String> resultList = new ArrayList<>();
        try {
            //根据随访ID、分类ID获取随访记录详情
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
            followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
            if (!followupContentESDOList.isEmpty()) {
                for (FollowupContentESDO followupContentESDO : followupContentESDOList) {
                    if("2".equals(followupContentESDO.getFollowup_project())){
                        //判断血压必填
                        if(StringUtils.isNotBlank(followupContentESDO.getBP_D()) && StringUtils.isNotBlank(followupContentESDO.getBP_U())){
                            resultList.add(followupContentESDO.getFollowup_project());
                        }
                        if(StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR()) && StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR_TYPE())){
                            resultList.add(followupContentESDO.getFollowup_project());
                        }
                    }else if("3".equals(followupContentESDO.getFollowup_project())){
                        //判断血糖必填
                        if(StringUtils.isNotBlank(followupContentESDO.getBS_FPG()) ||
                                StringUtils.isNotBlank(followupContentESDO.getNO_BS_FPG())||
                                StringUtils.isNotBlank(followupContentESDO.getRANDOM_BLOOD_SUGAR())){
                            resultList.add(followupContentESDO.getFollowup_project());
                        }
                    }else{
                        resultList.add(followupContentESDO.getFollowup_project());
                    }
                }
            }
            jestClient.shutdownClient();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return resultList;
    }
}

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

@ -0,0 +1,80 @@
package com.yihu.jw.door.service.followup;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.door.dao.followup.FollowupDrugsDao;
import com.yihu.jw.entity.followup.FollowupDrugs;
import com.yihu.jw.followup.FollowupContentESDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.util.*;
/**
 * Created by yeshijie on 2021/1/11.
 */
@Component
@Transactional(rollbackOn = Exception.class)
public class FollowupDrugsService {
    @Autowired
    private FollowupDrugsDao followupDrugsDao;
    @Autowired
    private FollowUpService followUpService;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 获取面访用药数据
     */
    public Map<String,Object> getFollowupDrugs(String id) throws Exception
    {
        Map<String,Object> re = new HashMap<>();
        FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(id, "6");
        if(followupContentESDO != null){
            re.put("DRUG_COMPLIANCE_CODE",followupContentESDO.getDRUG_COMPLIANCE_CODE());
        }
        //获取用药记录
        List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(id));
        re.put("DRUG_LIST",drugsList);
        return re;
    }
    /**
     *保存面访用药数据
     */
    @Transactional
    public void saveFollowupDrugs(String id,String drugsData) throws Exception {
        JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, Map.class);
        List<Map<String,String>> list = objectMapper.readValue(drugsData,javaType);
        Long followupId = Long.valueOf(id);
        //删除原有用药记录
        followupDrugsDao.deleteByFollowupId(Long.valueOf(followupId));
        if(list!=null && list.size()>0)
        {
            List<FollowupDrugs> newList = new ArrayList<>();
            for(Map<String,String> item:list)
            {
                FollowupDrugs drug = new FollowupDrugs();
                drug.setFollowupId(followupId);
                drug.setDrugsGroup(item.get("drugsGroup"));
                drug.setDrugsCode(item.get("drugsCode"));
                drug.setDrugsName(item.get("drugsName"));
                drug.setDose(item.get("dose"));
                drug.setUnit(item.get("unit"));
                drug.setFrequency(item.get("frequency"));
                drug.setCreateTime(new Date());
                newList.add(drug);
            }
            followupDrugsDao.save(newList);
        }
    }
}

+ 5 - 2
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/statics/StatisticsUtilService.java

@ -113,6 +113,9 @@ public class StatisticsUtilService {
        } else if (SaveModel.deptLevel.equals(lowLevel)) {
            map.put("code", saveModel.getDept());
            map.put("name", saveModel.getDeptName());
        }else if (SaveModel.doctorLevel.equals(lowLevel)) {
            map.put("code", saveModel.getDoctor());
            map.put("name", saveModel.getDoctorName());
        }
        return map;
    }
@ -248,9 +251,9 @@ public class StatisticsUtilService {
     */
    public void sortDoubleList(List<Map<String,Object>> resultList, String sortName){
        resultList.sort((x,y)->{
            if ( (Double) x.get(sortName) > (Double) y.get(sortName)) {
            if ( (Long) x.get(sortName) > (Long) y.get(sortName)) {
                return 1;
            } else if ((Double) x.get(sortName) < (Double) y.get(sortName)) {
            } else if ((Long) x.get(sortName) < (Long) y.get(sortName)) {
                return -1;
            } else {
                return 0;

+ 41 - 18
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/util/MessageUtil.java

@ -22,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -58,8 +59,8 @@ public class MessageUtil {
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Value("${server.server_url}")
    private String server_url;
    @Value("${tnzyy.tnzyy_url}")
    private String tnzyy_url;
    //发送微信模板消息
    private  String sendMessageUrl = "http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage";
@ -153,15 +154,32 @@ public class MessageUtil {
    }
    //推送模板消息
    /**
     *
     * @param wechatId
     * @param templateName
     * @param scene
     * @param openId
     * @param first
     * @param url 跳转链接
     * @param remark
     * @param type  模板通知类型
     * @param josn 用于对跳转连接的修改,
     * @param keywords
     */
    public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first,String url, String remark, Integer type,JSONObject josn,String ...keywords) {
        try {
            System.out.println(wechatId);
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (wxAccessTokenDO == null) {
                logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                return;
            }
            WxTemplateConfigDO newConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
            WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            BeanUtils.copyProperties(templateConfig,newConfig);
            if (newConfig == null) {
                logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                return;
@ -171,7 +189,7 @@ public class MessageUtil {
                newConfig.setFirst(first);
            }
            if (StringUtils.isNoneBlank(url)){
                newConfig.setUrl(url);
               newConfig.setUrl(url);
            }
            if (StringUtils.isNoneBlank(remark)){
                newConfig.setRemark(remark);
@ -185,32 +203,32 @@ public class MessageUtil {
            }
            if (keyLength >= 2) {
                if(StringUtils.isNoneBlank(keywords[1])){
                    newConfig.setKeyword1(keywords[1]);
                    newConfig.setKeyword2(keywords[1]);
                }
            }
            if (keyLength >= 3) {
                if(StringUtils.isNoneBlank(keywords[2])){
                    newConfig.setKeyword1(keywords[2]);
                    newConfig.setKeyword3(keywords[2]);
                }
            }
            if (keyLength >= 4) {
                if(StringUtils.isNoneBlank(keywords[3])){
                    newConfig.setKeyword1(keywords[3]);
                    newConfig.setKeyword4(keywords[3]);
                }
            }
            if (keyLength >= 5) {
                if(StringUtils.isNoneBlank(keywords[4])){
                    newConfig.setKeyword1(keywords[4]);
                    newConfig.setKeyword5(keywords[4]);
                }
            }
            if (keyLength >= 6) {
                if(StringUtils.isNoneBlank(keywords[5])){
                    newConfig.setKeyword1(keywords[5]);
                    newConfig.setKeyword6(keywords[5]);
                }
            }
            if (keyLength >= 7) {
                if(StringUtils.isNoneBlank(keywords[6])){
                    newConfig.setKeyword1(keywords[6]);
                    newConfig.setKeyword7(keywords[6]);
                }
            }
            //发起微信消息模板推送
@ -223,7 +241,10 @@ public class MessageUtil {
    }
    public WxTemplateConfigDO setTemPlateUrl(WxTemplateConfigDO wxTemplateConfigDO,Integer type,String openid,JSONObject json){
        String url = server_url + "wx/html/";
        String url = tnzyy_url + "taian-wx/html/";
        if (json==null){
            return wxTemplateConfigDO;
        }
        if (type==30){//反馈通知 测试 TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
            if(json.containsKey("consult")) {
                wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?openid=" + openid + "&consult=" + json.getString("consult"));
@ -235,17 +256,17 @@ public class MessageUtil {
                wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?resultCode=" + json.getString("resultCode"));
            }
        }
        if (type==31){ //上门服务医生评分   //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
        if (type==31){ //上门服务医生评分   //
            wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl()+"?openid=" + openid + "&id=" + json.getString("id")+ "&finish=" + json.getString("finish"));
        }
        if(type==32){  //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
            String url1 = server_url + "wx/common/";
        if(type==32){  //
            String url1 = tnzyy_url + "wx/common/";
            wxTemplateConfigDO.setUrl(url1 + wxTemplateConfigDO.getUrl()+"?openid=" + openid + "&consult=" + json.getString("consult") + "&status=" + json.getInteger("status"));
        }
        if(type==34){ //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
            wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?openid=" + openid + "&orderId=" + json.get("orderId")+ "&authorizeImage=" + json.getString("authorizeImage"));
        if(type==34){ //居民授权电子健康卡
            wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?openid=" + openid + "&orderId=" + json.getString("orderId")+ "&authorizeImage=" + json.getString("authorizeImage"));
        }
        if (type==19){  //zSR9w5AjfZFLc_g8AxGBvDKZASoKAeXQuGnvPAQzvps
        if (type==19){  //
            String urlStr= wxTemplateConfigDO.getUrl();
            boolean status = urlStr.contains("openid=");
            if(!status){
@ -253,6 +274,9 @@ public class MessageUtil {
            }
            wxTemplateConfigDO.setUrl(url + urlStr );
        }
        if (type==35){//支付提醒
            wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl()+json.getString("orderId")+"&isMask=1");
        }
        return wxTemplateConfigDO;
    }
@ -287,7 +311,6 @@ public class MessageUtil {
                logger.error("当前工单没有医生待接单消息!orderId:" + orderId);
            }else {
                messages.forEach(message->{
                    systemMessageDao.orderMessageDel(message.getReceiver(),message.getRelationCode());
                    if (message.getType().equals("403") ) {
                        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doorServiceOrder.getDispatcher());//·
                        String msg=doorServiceOrder.getDispatcherName() + "接受了服务工单"+ doorServiceOrder.getNumber();

+ 21 - 26
svr/svr-door-serivce/src/main/resources/application.yml

@ -24,25 +24,6 @@ spring:
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
  # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.26.0.112:9200
#      uris: http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
#      username: # Login user.
#      password: # Login password.
#      proxy.port:  # Proxy port the HTTP client should use.
#      proxy.host:  # Proxy host the HTTP client should use.
#hibernate 配置
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
@ -111,8 +92,10 @@ es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
    FollowUp: wlyy_followup
  type:
    Statistics: hlw_quota_test
    FollowUpContent: wlyy_followup_content
  host:  http://172.26.0.55:9000
  tHost: 172.26.0.55:9300
  clusterName: jkzl
@ -167,6 +150,9 @@ fast-dfs:
server:
  server_url: http://ehr.yihu.com/wlyy/
tnzyy:
  tnzyy_url: http://172.26.0.107:10001/
neiwang:
  enable: true
  wlyy: http://172.26.0.110:22122/
@ -192,8 +178,10 @@ es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
    FollowUp: wlyy_followup
  type:
    Statistics: hlw_quota_test
    FollowUpContent: wlyy_followup_content
  host:  http://172.26.0.55:9000
  tHost: 172.26.0.55:9300
  clusterName: jkzl
@ -270,8 +258,10 @@ es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
    FollowUp: wlyy_followup
  type:
    Statistics: hlw_quota_test
    FollowUpContent: wlyy_followup_content
  host:  http://172.26.0.55:9000
  tHost: 172.26.0.55:9300
  clusterName: jkzl
@ -316,11 +306,11 @@ spring:
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://365q88j171.oicp.vip:44840/fastdfs/
  fastdfs_file_url: https://zyy.jkta.com.cn/fastdfs/
fast-dfs:
  tracker-server: 10.9.1.247:22122
  public-server: http://365q88j171.oicp.vip:44840/fastdfs/
  public-server: https://zyy.jkta.com.cn/fastdfs/
neiwang:
  enable: true
@ -329,16 +319,19 @@ neiwang:
server:
  server_url: http://ehr.yihu.com/wlyy/
tnzyy:
  tnzyy_url: https://zyy.jkta.com.cn/
base:
  url: http://127.0.0.1:10020/svr-base/
  hospitalUrl: http://10.9.1.247:10022/
wechat:
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fwlyy
  accId: gh_ffd64560fb21
  appId: wxad04e9c4c5255acf1
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d31
  wechat_token: 27eb3bb24f149a7760cf1bb154b080401
  wechat_base_url: http%3a%2f%2fwww.xmt1yw.cn%2fwlyy
  accId: gh_ffd64560fb211
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
@ -349,8 +342,10 @@ es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
    FollowUp: wlyy_followup
  type:
    Statistics: hlw_quota_prod
    FollowUpContent: wlyy_followup_content
  host:  http://10.9.1.247:9200
  tHost: 10.9.1.247:9300
  clusterName: jkzl

+ 50 - 0
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -282,6 +282,56 @@ express:
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
# 眼科医院前置机
spring:
  profiles: jwOracleProd
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@192.168.20.55:1521:orcl
    username: system
    password: hxyk9573
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
#心脏中心前置机配置
spring:
  profiles: xzprod_in

+ 45 - 24
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -306,12 +306,22 @@ public class PrescriptionStatusUpdateService {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int i = calendar.get(Calendar.HOUR_OF_DAY);
        if(i==0){
            //将所有的已接诊的处方记录
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                System.out.println(outpatientDOs.get(0).getId()+"id______-");
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){
        //将所有的已接诊的处方记录
        List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
        if(outpatientDOs!=null&&outpatientDOs.size()>0){
            System.out.println(outpatientDOs.get(0).getId()+"id______-");
            for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                long currentTime = new Date().getTime();
                Date temp = new Date();
                if (outpatientDO.getConDate()==null){
                    temp = outpatientDO.getCreateTime();
                }else {
                    temp = outpatientDO.getConDate();
                }
                long outpatientTime = outpatientDO.getAdmDate()==null?temp.getTime():outpatientDO.getAdmDate().getTime();
                if(currentTime-outpatientTime>24*60*60*1000){
                    logger.info("结束接诊时间满足条件");
                    //结束门诊
                    outpatientDO.setStatus("3");
                    outpatientDO.setEndTime(new Date());
@ -328,30 +338,41 @@ public class PrescriptionStatusUpdateService {
                    }
                    logger.info(outpatientDO.getId()+"的处方记录设置为结束");
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
            }
            outpatientDao.save(outpatientDOs);
            //退费
            for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                long currentTime = new Date().getTime();
                Date temp = new Date();
                if (outpatientDO.getConDate()==null){
                    temp = outpatientDO.getCreateTime();
                }else {
                    temp = outpatientDO.getConDate();
                }
                long outpatientTime = outpatientDO.getAdmDate()==null?temp.getTime():outpatientDO.getAdmDate().getTime();
                if(currentTime-outpatientTime>24*60*60*1000) {
                    logger.info("退费时间满足条件");
                    try {
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        if (businessOrderDO.getPayType()==1){
                            businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                        }else if (businessOrderDO.getPayType()==3){
        /*
                            businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
        */
                        }
                    } } catch (Exception e) {
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        if (businessOrderDO!=null){
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
    /*
                        businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
    */
                            }
                        } } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());
            }else {
                logger.info("setOutPatientOver count :"+0);
            }
            logger.info("setOutPatientOver end ");
            logger.info("setOutPatientOver count :"+outpatientDOs.size());
        }else {
            logger.info("setOutPatientOver count :"+0);
        }
        logger.info("setOutPatientOver end ");
    }

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

@ -190,7 +190,7 @@ public class UnSettledHISPrescriptionService {
                        String doctor = pre.get(0).get("DOCTOR").toString();
                        String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                        //修改处方状态
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11 where id = '"+prescriptionId+"'";
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11,check_status=1,check_reason='处方驳回' where id = '"+prescriptionId+"'";
                        hibenateUtils.updateBySql(updateSql);
                        com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
                        msgObj.put("outpatientid",outpatientId);
@ -198,7 +198,7 @@ public class UnSettledHISPrescriptionService {
                        msgObj.put("reason","处方驳回");
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                        System.out.println("发送诊断消息开始+"+wlyyOutpatientDO.getId());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                        System.out.println("发送诊断消息成功:"+immsg);
                    }
                }

+ 2 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java

@ -27,9 +27,9 @@ import java.util.List;
@EnableScheduling
public class OverdueJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(OverdueJob.class);
    private static String cron = "0 0 0 * * ?";
    private static String cron = "0 */5 * * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    public OverdueJob(){
        cron="0 0 0 * * ?";
        cron="0 */5 * * * ?";
        System.out.println("初始化时的corn"+cron);
    }
    @Autowired

+ 7 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/account/PatientEndpoint.java

@ -37,6 +37,12 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = false)String orgPw)throws Exception{
        return success(basePatientService.updatePatientPw(id,pw,orgPw));
        Boolean isSuccess = basePatientService.updatePatientPw(id,pw,orgPw);
        if (isSuccess){
            return success(isSuccess);
        }else {
            return failed("修改失败,请检查原密码是否正确");
        }
    }
}

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

@ -208,9 +208,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
					if("2".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(16);//视频复诊
						if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
							prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
						}
					}else{
						consult.setType(9);//图文复诊
					}
@ -219,9 +216,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())){
					if("2".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(17);//视频咨询
						if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
							prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"17","outpatientMsgRemind","");
						}
					}else if ("1".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(1);//图文咨询
					}
@ -252,7 +246,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							rsCode="0";
							mes="已挂号";
						}
						if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
						/*if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
							if ("2".equalsIgnoreCase(outpatientDO.getType())){
								prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
							}
@ -261,7 +255,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							if ("2".equalsIgnoreCase(outpatientDO.getType())){
								prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"17","outpatientMsgRemind","");
							}
						}
						}*/
					}else {
						if (demoFlag.equalsIgnoreCase("true")){
@ -370,9 +364,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
				if("2".equalsIgnoreCase(outpatientDO.getType())){
					consult.setType(16);//视频复诊
					if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
						prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
					}
				}else{
					consult.setType(9);//图文复诊
				}
@ -381,9 +372,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())){
				if("2".equalsIgnoreCase(outpatientDO.getType())){
					consult.setType(17);//视频咨询
					if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
						prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"17","outpatientMsgRemind","");
					}
				}else if ("1".equalsIgnoreCase(outpatientDO.getType())){
					consult.setType(1);//图文咨询
				}
@ -917,6 +905,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("imgConsultCount",prescriptionService.getWaitVideoCount(doctor,"1","3",wxId));//图文咨询数量
		result.put("videoConsultCount",prescriptionService.getWaitVideoCount(doctor,"2","3",wxId));//视频咨询数量
		result.put("homeConsultCount",prescriptionService.getWaitVideoCount(doctor,"3","3",wxId));//家医咨询数量
		if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
            result.put("doorServiceCount",prescriptionService.waitUpdoorCount(doctor));//上门服务数量
        }
		logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
		return success("请求成功",result);
	}

+ 36 - 7
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -1,8 +1,6 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.sun.media.jfxmedia.logging.Logger;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
@ -18,9 +16,9 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -29,11 +27,11 @@ import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.ArrayList;
@ -68,6 +66,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private ZBSmsService zbSmsService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    private String wxId;
@ -91,6 +91,15 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        String medicareType = obj.getString("medicareType");
        String medicare = obj.getString("medicare");
        String clinicId = obj.getString("clinicId");
        /*String key = obj.getString("key");
        String text = obj.getString("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("图形验证码输入错误");
                return mixEnvelop;
            }
        }*/
        net.sf.json.JSONArray jsonArray = new JSONArray();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,clinicId,false);
@ -241,6 +250,17 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else if("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
                //发送短信获取验证码
                String content = captcha;
                int result =  zbSmsService.sendMessage(phoneNum,content);
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }
        }
@ -375,4 +395,13 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                                    @RequestParam(value = "id", required = false) String id) throws ParseException {
        return success(wlyyFamilyMemberService.findMemberById(id));
    }
    public boolean verifyCaptcha(String key,String text){
        boolean pass = false;
        String captcha = redisTemplate.opsForValue().get(key).toString();
        if (org.apache.commons.lang3.StringUtils.isNotBlank(captcha)&& captcha.equals(text.toLowerCase())){
            pass = true;
            redisTemplate.delete(key);
        }
        return pass;
    }
}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 12 - 19
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java


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

@ -140,14 +140,20 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                              @RequestParam(value = "ksdm",required = false) String ksdm,
                                          @ApiParam(name = "cardNo", value = "就诊卡", required = false)
                                              @RequestParam(value = "cardNo",required = false)String cardNo) throws Exception {
        startTime = startTime+" 00:00:00";
        endTime =endTime+" 23:59:59";
                                              @RequestParam(value = "cardNo",required = false)String cardNo,
                                          @ApiParam(name = "flag", value = "标识", required = false)
                                              @RequestParam(value = "flag",required = false)String flag) throws Exception {
        if(StringUtils.isNoneBlank(startTime)){
            startTime = startTime+" 00:00:00";
        }
        if(StringUtils.isNoneBlank(endTime)){
            endTime =endTime+" 23:59:59";
        }
        List<WlyyOutpatientVO> vos = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm);
            vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm,flag);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -1709,7 +1715,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                msgObj.put("outpatientid",wlyyPrescriptionDO.getOutpatientId());
                msgObj.put("prescriptionId",prescriptionId);
                msgObj.put("reason",reason);
                String immsg = imService.pushPrescriptionBackMsg(msgObj,operate,operateName,wlyyPrescriptionDO.getOutpatientId(),wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType());
                String immsg = imService.pushPrescriptionBackMsg(msgObj,operate,operateName,wlyyPrescriptionDO.getOutpatientId(),wlyyOutpatientDO.getConsumer(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                System.out.println("发送诊断消息成功:"+immsg);
            }else if (status==2){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
@ -2415,6 +2421,41 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(tnyyEntranceService.findJKTA_ZY_RECORD(brid));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.doctorUpcomingList2)
    @ApiOperation(value = "医生待办事项列表")
    public Envelop doctorUpcomingList2(@ApiParam(name = "doctorCode", value = "医生CODE")
                                      @RequestParam(value = "doctorCode",required = true) String doctorCode,
                                      @ApiParam(name = "type", value = "类型:1.视频复诊(16)、2.专科协同(12)、3.图文复诊(9)、4.专家咨询(1,15)")
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<Map<String,Object>>  data = imService.doctorUpcomingList2(doctorCode, type);
        if (data != null) {
            for (Map<String,Object> consult : data) {
                if("1,15,17".equals(type)){//专家咨询
                    Integer consultType =  Integer.parseInt(consult.get("type").toString());
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else if (17==consultType){//视频咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_17");
                    }
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_9");
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_16");
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_12");
                    consult.put("type",type);
                }else{}
                array.add(consult);
            }
        }
        return success(array);
    }
}

+ 12 - 6
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

@ -1,7 +1,6 @@
package com.yihu.jw.hospital.service.wechat;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
@ -96,6 +95,17 @@ public class WeiXinEventProcess {
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://intel.yanketong.com/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl = "https://intel.yanketong.com/"+picUrl;
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "厦门眼科中心医院互联网医院");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }else {
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "海沧医院互联网医院");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }
            // 图文消息URL
@ -103,11 +113,7 @@ public class WeiXinEventProcess {
            //图片地址
//            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", keys[1] + "医生个人诊间");
            article.put("Description", "厦门眼科中心医院互联网医院");
            article.put("PicUrl", picUrl);
            articles.add(article);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -1727,7 +1727,7 @@ public class MonitorPlatformService  {
    public JSONObject savePatientDeviceLocation(){
        String sql = "select DISTINCT pd.category_code ,pd.czrq create_time,pd.device_sn ,pd.device_name, p.disease_condition ,p.`code`,p.idcard ,p.address,sf.hospital_name\n" +
                "from  wlyy.wlyy_patient_device pd \n" +
                "INNER JOIN wlyy.wlyy_sign_family sf on pd.`user` = sf.patient and sf.`status`>0 \n" +
                "INNER JOIN wlyy.wlyy_sign_family sf on pd.`user` = sf.patient and sf.type=2 \n" +
                "INNER JOIN wlyy.wlyy_patient p on p.idcard = sf.idcard and p.`status`=1\n" +
                "where  pd.del=0 and pd.category_code in (1,2)";
//        sql="select * from device.wlyy_patient_device_location_tmp";
@ -1741,12 +1741,12 @@ public class MonitorPlatformService  {
                Map<String, String> json = null;
                if (map.get("address")!=null){
                    if (org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("address").toString())) {
                        json = LatitudeUtils.getGeocoderLatitude(map.get("address").toString().replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                        json = LatitudeUtils.getGeocoderLatitude(("福建省厦门市"+map.get("address").toString()).replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                    }
                }
                if (json==null||map.get("address")==null){
                    if (map.get("hospital_name")!=null){
                        if (!org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("hospital_name").toString())) {
                        if (org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("hospital_name").toString())) {
                            json = LatitudeUtils.getGeocoderLatitude(("福建省厦门市"+map.get("hospital_name").toString()).replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                        }
                    }

+ 16 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -531,4 +531,20 @@ public class SpecialistController extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value="/transferPatients")
    @ApiOperation(value = "专科端转移居民")
    public Envelop transferPatients(@ApiParam(name="teamCode",value = "医生所在团队",required = true)@RequestParam(value = "teamCode",required = true) String teamCode,
                                    @ApiParam(name="toTeamCode",value = "转移医生医生所在所在团队,跨团队时必传",required = true)@RequestParam(value = "toTeamCode",required = false) String toTeamCode,
                                    @ApiParam(name="doctorCode",value = "当前医生code",required = true)@RequestParam(value = "doctorCode",required = true)String doctorCode,
                                    @ApiParam(name="toDoctorCode",value = "接收患者医生code",required = true)@RequestParam(value = "toDoctorCode",required = true)String toDoctorCode,
                                    @ApiParam(name="patients",value = "患者JsonArray列表(包含code)",required = true)@RequestParam(value = "patients",required = true)String patients){
        try {
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,specialistService.transferPatients(teamCode,toTeamCode,doctorCode, toDoctorCode, patients));
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -32,4 +32,7 @@ public interface SpecialistPatientRelationDao extends PagingAndSortingRepository
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and p.patient =?2 and p.teamCode =?3 and p.status>=0 and p.signStatus=1")
    public SpecialistPatientRelationDO findByDoctorAndPatientAndTeamCode(String doctor,String patient,Integer teamCode);
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.doctor=?3 and p.status>=0 and p.status >=0 and p.signStatus=1")
    List<SpecialistPatientRelationDO> findListByTeamCodeAndPatientAndDoctor(Integer teamCode,String patient,String doctor);
}

+ 4 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java

@ -21,6 +21,9 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 and p.createUser=?2 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatientAndCreateUser(String patient, String doctor);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 and p.createUser=?2 and p.teamCode=?3 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatientAndCreateUserAndTeamCode(String patient, String doctor,Integer teamCode);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatients(String patientCode);
@ -53,4 +56,5 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Query("update PatientRehabilitationPlanDO a set a.status=?1,a.abortTime= ?3 where a.id =?2 ")
    @Modifying
    int updateStatusAndTimeById(Integer status, String id, Date date);
}

+ 11 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanLogDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.dao.rehabilitation;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by liub on 2021/1/12.
 */
public interface PatientRehabilitationPlanLogDao extends PagingAndSortingRepository<PatientRehabilitationPlanLogDO,Long>, JpaSpecificationExecutor<PatientRehabilitationPlanLogDO> {
}

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationDetailDao.java

@ -88,4 +88,7 @@ public interface RehabilitationDetailDao extends PagingAndSortingRepository<Reha
    @Modifying
    @Query("delete from RehabilitationDetailDO t where t.planId = ?1 and (t.executeTime > ?2 OR t.executeTime is null OR t.executeTime<>'')  and t.status <> 1 ")
    void deleteDetailByPlanId(String planId, Date dateShort);
    @Query("select d from RehabilitationDetailDO d where d.planId = ?1 and d.type=?2 and d.doctor=?3 and d.status<>?4 ")
    List<RehabilitationDetailDO> findByPlanIdAndTypeAndDoctorAndStatusNot(String planId,Integer type,String doctor,Integer status);
}

+ 7 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationOperateRecordsDao.java

@ -24,4 +24,11 @@ public interface RehabilitationOperateRecordsDao extends PagingAndSortingReposit
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.node=?1,a.relationRecordImg=?2,a.status=1 where a.rehabilitationDetailId =?3 ")
    int updateNodeAndRelationRecordImg(String node,String rehabilitationRecordImg,String rehabilitataioDetailId);
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.node=?1,a.status=1 where a.rehabilitationDetailId =?2 ")
    int updateNodeByPlanDetailId(String node,String rehabilitataioDetailId);
    @Query("select a from RehabilitationOperateRecordsDO a where a.rehabilitationDetailId=?1 and a.doctorCode=?2 and a.status<>?3")
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailIdAndDoctorCodeAndStatusNot(String rehabilitationDetailId,String doctorCode,Integer status);
}

+ 155 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -1,9 +1,15 @@
package com.yihu.jw.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dao.PatientHospitalRecordDao;
import com.yihu.jw.dao.SpecialistPatientRelationDao;
import com.yihu.jw.dao.rehabilitation.*;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -47,6 +53,16 @@ public class SpecialistService{
    private String basedb;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PatientRehabilitationPlanDao patientRehabilitationPlanDao;
    @Autowired
    private RehabilitationDetailDao rehabilitationDetailDao;
    @Autowired
    private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
    @Autowired
    private PatientRehabilitationPlanLogDao patientRehabilitationPlanLogDao;
    @Autowired
    private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
    public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){
        specialistPatientRelationDao.save(specialistPatientRelationDO);
@ -1275,4 +1291,143 @@ public class SpecialistService{
        specialistPatientRelationDao.updateSpecialistByPatient(patient, doctor, doctorName);
        return Envelop.getSuccess("更新成功!");
    }
    public JSONObject transferPatients(String teamCode,String toTeamCode,String doctorCode,String toDoctorCode,String patients){
        String[] patient = patients.split(",");
        boolean flag=false;//同团队时 teamCode==toTeamCode
        if (!teamCode.equals(toTeamCode)){//跨团队
            flag=true;
        }
        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        String doctorName = jdbcTemplate.queryForObject(sql,String.class);
        JSONObject result = new JSONObject();
        JSONArray planObject = new JSONArray();
        JSONArray planDetailObject = new JSONArray();
        JSONArray specialistPatientRelation = new JSONArray();
        JSONArray rehabilitationOperateRecords = new JSONArray();
        for (String patientCode:patient){
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
                for (PatientRehabilitationPlanDO plan:planList){
                    plan.setCreateUser(toDoctorCode);
                    plan.setCreateUserName(toDoctorName);
                    plan.setUpdateUser(doctorCode);
                    plan.setUpdateUserName(doctorName);
                    plan.setUpdateTime(new Date());
                    if (flag){
                        plan.setTeamCode(Integer.parseInt(toTeamCode));
                    }
                    patientRehabilitationPlanDao.save(plan);
                    planObject.add(plan.getId());
                    PatientRehabilitationPlanLogDO planLogDO = new PatientRehabilitationPlanLogDO();
                    planLogDO.setId(UUID.randomUUID().toString().replace("-",""));
                    planLogDO.setPlanId(plan.getId());
                    planLogDO.setCreateTime(new Date());
                    planLogDO.setCreateUser(doctorCode);
                    planLogDO.setCreateUserName(doctorName);
                    patientRehabilitationPlanLogDao.save(planLogDO);
                    List<RehabilitationDetailDO> planDetails  = rehabilitationDetailDao.findByPlanIdAndTypeAndDoctorAndStatusNot(plan.getId(),2,doctorCode,1);//未完成的任务
                    for (RehabilitationDetailDO planDetail:planDetails){
                        planDetail.setCreateUser(toDoctorCode);
                        planDetail.setCreateUserName(toDoctorName);
                        planDetail.setDoctor(toDoctorCode);
                        planDetail.setDoctorName(toDoctorName);
                        planDetail.setUpdateTime(new Date());
                        planDetail.setUpdateUser(doctorCode);
                        planDetail.setUpdateUserName(doctorName);
                        rehabilitationDetailDao.save(planDetail);
                        planDetailObject.add(planDetail.getId());
                        List<RehabilitationOperateRecordsDO> operateList = rehabilitationOperateRecordsDao.findByRehabilitationDetailIdAndDoctorCodeAndStatusNot(planDetail.getId(),doctorCode,1);
                        for (RehabilitationOperateRecordsDO operateRecordsDO:operateList){
                            operateRecordsDO.setDoctorCode(toDoctorCode);
                            operateRecordsDO.setDoctorName(toDoctorName);
                            operateRecordsDO.setUpdateTime(new Date());
                            operateRecordsDO.setUpdateUser(doctorCode);
                            operateRecordsDO.setUpdateUserName(doctorName);
                            rehabilitationOperateRecordsDao.save(operateRecordsDO);
                            rehabilitationOperateRecords.add(operateRecordsDO.getId());
                        }
                    }
                }
            }
            if (flag){
                SpecialistPatientRelationDO relations = specialistPatientRelationDao.findByTeamCodeAndPatient(Integer.parseInt(toTeamCode),patientCode);
                SpecialistPatientRelationDO relationDoBefore = specialistPatientRelationDao.findByTeamCodeAndPatient(Integer.parseInt(teamCode),patientCode);
                if (relations==null){//跨团队时  患者未与目标团队签约
                    SpecialistPatientRelationDO relationDO = new SpecialistPatientRelationDO();
                    relationDO.setId(UUID.randomUUID().toString().replace("-",""));
                    relationDO.setDoctorName(toDoctorCode);
                    relationDO.setDoctorName(toDoctorName);
                    relationDO.setPatient(patientCode);
                    relationDO.setPatientName(patientName);
                    relationDO.setTeamCode(Integer.parseInt(toTeamCode));
                    relationDO.setSignStatus("1");
                    relationDO.setStatus("1");
                    relationDO.setSignYear(DateUtil.getSignYear()+"");
                    relationDO.setSignDate(new Date());
                    relationDO.setCreateTime(new Date());
                    relationDO.setCreateUser(toDoctorCode);
                    relationDO.setCreateUserName(toDoctorName);
                    relationDO.setUpdateTime(new Date());
                    if (StringUtils.isNotBlank(relationDoBefore.getDiseaseCode())){
                        relationDO.setDiseaseCode(relationDoBefore.getDiseaseCode());
                    }
                    if (relationDoBefore.getDiseaseCode()!=null){
                        relationDO.setIsManage(relationDoBefore.getIsManage());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getManageUser())){
                        relationDO.setManageUser(relationDoBefore.getManageUser());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getManageTime().toString())){
                        relationDO.setManageTime(relationDoBefore.getManageTime());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getRemindTime())){
                        relationDO.setRemindTime(relationDoBefore.getRemindTime());
                    }
                    specialistPatientRelationDao.save(relationDO);
                    specialistPatientRelation.add(relationDO.getId());
                    sql = "UPDATE wlyy.wlyy_patient_disease_server set specialist_relation_code='"+relationDO.getId()+"' \n" +
                            "where specialist_relation_code='"+relationDoBefore.getId()+"'";
                    jdbcTemplate.execute(sql);
                }
                else{
                    relations.setCreateUser(toDoctorCode);
                    relations.setCreateUserName(toDoctorName);
                    relations.setDoctor(toDoctorCode);
                    relations.setDoctorName(toDoctorName);
                    relations.setUpdateTime(new Date());
                    relations.setUpdateUser(doctorCode);
                    relations.setUpdateUserName(doctorName);
                    specialistPatientRelationDao.save(relations);
                    specialistPatientRelation.add(relations.getId());
                    sql = "UPDATE wlyy.wlyy_patient_disease_server set specialist_relation_code='"+relations.getId()+"' \n" +
                            "where specialist_relation_code='"+relationDoBefore.getId()+"'";
                    jdbcTemplate.execute(sql);
                }
            }
            else{//
                List<SpecialistPatientRelationDO> relations = specialistPatientRelationDao.findListByTeamCodeAndPatientAndDoctor(Integer.parseInt(teamCode),patientCode,doctorCode);
                for (SpecialistPatientRelationDO relation:relations){
                    relation.setCreateUser(toDoctorCode);
                    relation.setCreateUserName(toDoctorName);
                    relation.setDoctor(toDoctorCode);
                    relation.setDoctorName(toDoctorName);
                    relation.setUpdateTime(new Date());
                    relation.setUpdateUser(doctorCode);
                    relation.setUpdateUserName(doctorName);
                    specialistPatientRelationDao.save(relation);
                    specialistPatientRelation.add(relation.getId());
                }
            }
        }
        result.put("planList",planObject);
        result.put("planDetailList",planDetailObject);
        result.put("relationList",specialistPatientRelation);
        result.put("rehabilitationOperateRecords",rehabilitationOperateRecords);
        return  result;
    }
}

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

@ -753,6 +753,9 @@ public class RehabilitationManageService {
                " LEFT JOIN wlyy_specialist.wlyy_plan_detail_appointment a on d.id=.a.rehabilitation_plan_detail_id " +
                " where d.id = '"+planDetailId+"'";
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
        if (serviceItemList.size()==0){
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,new HashMap<>());
        }
        Map<String,Object> one = serviceItemList.get(0);
        Map<String,Object> resultMap = new HashMap<>();
        List<String> executeDoctorList = new ArrayList<>();
@ -842,7 +845,11 @@ public class RehabilitationManageService {
            resultMap.put("recordRelationCode",temp.getRelationCode());
            resultMap.put("recordFlag",temp.getFlag());
            resultMap.put("recordId",temp.getId());
            resultMap.put("relationRecordImg",(temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg()))?(new JSONArray(temp.getRelationRecordImg())):null);//json格式
            JSONArray imgs = new JSONArray();
            if (temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg())){
                imgs.put(temp.getRelationRecordImg());
            }
            resultMap.put("relationRecordImg",imgs);
         /*   if(itemType!=1&&itemType!=0){*/
                resultMap.put("relationRecordCode",temp.getRelationRecordCode());
                resultMap.put("completeTimeShort",DateUtil.dateToStr(completeTime,"yyyy/MM/dd"));
@ -1357,6 +1364,9 @@ public class RehabilitationManageService {
                detailDO.setRelationCode(relationCode);
            }
            rehabilitationDetailDao.save(detailDO);
            if (StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
            }
            if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            }
@ -1492,6 +1502,8 @@ public class RehabilitationManageService {
            resultMap.put("status", p.getStatus());
            resultMap.put("patientImg", p.getPatientImg());
            resultMap.put("adviceContent",p.getAdviceContent());
            resultMap.put("createTimeDate",DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd"));
            resultMap.put("createTime", DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
            resultMap.put("medicalRecordsCode",p.getMedicalRecordsCode());
        }