فهرست منبع

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java
mengkang 5 سال پیش
والد
کامیت
bf55eafa38
84فایلهای تغییر یافته به همراه4294 افزوده شده و 1427 حذف شده
  1. 5 1
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  2. 297 206
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 458 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 320 10
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  5. 46 6
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  6. 2 0
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  7. 86 29
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 30 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultOrderDao.java
  9. 2 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  10. 1 1
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateDemo.java
  11. 4 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  12. 11 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java
  13. 1 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  14. 117 4
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  15. 174 160
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  16. 4 0
      business/sms-service/pom.xml
  17. 60 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/IotSMSService.java
  18. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  19. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultDo.java
  20. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  21. 5 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxPushLogDO.java
  22. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseDeptDict.java
  23. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseSuperviseDataDict.java
  24. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseSuperviseDict.java
  25. 10 8
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java
  26. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java
  27. 196 196
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java
  28. 185 184
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java
  29. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  30. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java
  31. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  32. 28 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  33. 23 2
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotDeviceDictDO.java
  34. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java
  35. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  36. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderRefundDO.java
  37. 338 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  38. 4 3
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  39. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  40. 22 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  41. 12 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  42. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientLabelVO.java
  43. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java
  44. 33 0
      common/common-util/src/main/java/com/yihu/jw/util/common/BeanUtils.java
  45. 1 1
      common/common-util/src/main/java/com/yihu/jw/util/wechat/WeixinMessagePushUtils.java
  46. 4 0
      server/svr-authentication/pom.xml
  47. 21 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  48. 15 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/iot/UserDao.java
  49. 117 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyIotLoginEndpoint.java
  50. 6 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  51. 170 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyYkyyEndpoint.java
  52. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWlyyConfigService.java
  53. 94 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java
  54. 33 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  55. 362 362
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/HttpClientUtil.java
  56. 37 0
      server/svr-authentication/src/main/resources/application.yml
  57. 7 0
      server/svr-authentication/src/main/resources/bootstrap.yml
  58. 6 1
      svr/svr-base/pom.xml
  59. 41 0
      svr/svr-base/src/main/resources/application.yml
  60. 35 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  61. 42 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java
  62. 30 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  63. 2 2
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  64. 2 1
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  65. 8 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/MultipleCode/MultipleCoderController.java
  66. 34 109
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  67. 40 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  68. 96 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java
  69. 92 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  70. 20 59
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  71. 149 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  72. 50 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  73. 39 15
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/MultipleCode/MultipleCodeService.java
  74. 2 2
      svr/svr-internet-hospital/src/main/resources/application.yml
  75. 18 13
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java
  76. 15 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java
  77. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotDeviceDictDao.java
  78. 6 2
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java
  79. 28 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotDeviceDictService.java
  80. 42 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  81. 1 1
      svr/svr-iot/src/main/resources/application.yml
  82. 1 1
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java
  83. 7 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java
  84. 24 8
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

+ 5 - 1
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -367,5 +367,9 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
        return true;
    }
    
    public List<BaseDoctorDO> findDoctorsByIdcard(String idcard){
        List<BaseDoctorDO> doctors = baseDoctorDao.findByIdcard(idcard);
        return doctors;
    }
}

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

@ -167,6 +167,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
    private String wechatId;
    /**
     * 获取居民就诊记录接口
@ -257,82 +259,97 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public MixEnvelop findReOutpatientList(String patient,Integer status,String startTime,String endTime,Integer page,Integer size){
        String totalSql = "SELECT " +
                " COUNT(1) AS total " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = ? AND o.outpatient_type != '2' ";
        List<Object> totalParams = new ArrayList<>();
        totalParams.add(patient);
                " o.patient =:patient AND o.outpatient_type != '2' ";
        Map<String,Object> totalParams = new HashedMap();
        totalParams.put("patient",patient);
        if(status!=null){
            totalSql +=  " AND o.status =:status ";
            totalParams.put("status",status);
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND o.create_time >=:createTime ";
            totalParams.put("createTime",DateUtil.strToDateLong(startTime+" 00:00:00"));
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND o.create_time <=:endTime ";
            totalParams.put("endTime",DateUtil.strToDateLong(endTime+" 23:59:59"));
        }
       /* totalParams.add(patient);
        if(status!=null){
            totalSql +=  " AND o.status = ? ";
            totalParams.add(status);
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >= ? ";
            totalParams.add(startTime+" 00:00:00");
            totalParams.add(DateUtil.strToDateLong(startTime+" 00:00:00"));
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <= ? ";
            totalParams.add(endTime+" 23:59:59");
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray());
            totalParams.add(DateUtil.strToDateLong(endTime+" 23:59:59"));
        }*/
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql,totalParams);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String sql ="SELECT " +
                " o.id, " +
                " o.adm_no AS admNo, " +
                " o.origin_adm_no AS originAdmNo, " +
                " o.register_no AS registerNo, " +
                " o.origin_register_no AS originRegisterNo, " +
                " o.origin_con_no AS originConNo," +
                " o.con_no AS conNo," +
                " o.hospital," +
                " o.hospital_name AS hospitalName," +
                " o.win_no AS winNo," +
                " o.type," +
                " o.dept AS dept, " +
                " o.dept_name AS deptName, " +
                " o.patient AS patient, " +
                " o.patient_name AS patientName, " +
                " o.doctor AS doctor, " +
                " o.doctor_name AS doctorName, " +
                " o.idcard AS idcard, " +
                " o.card_no AS cardNo," +
                " o.mjz AS mjz, " +
                " o.icd10 AS icd10, " +
                " o.icd10_name AS icd10Name, " +
                " o.adm_date AS admDate, " +
                " o.con_date AS conDate, " +
                " o.description AS description, " +
                " o.disease_img AS diseaseImg, " +
                " o.create_time AS createTime, " +
                " o.`status` AS `status`," +
                " o.register_date AS registerDate," +
                " o.evaluate_status AS evaluateStatus   " +
                " o.id AS \"id\", " +
                " o.adm_no AS \"admNo\", " +
                " o.origin_adm_no AS \"originAdmNo\", " +
                " o.register_no AS \"registerNo\", " +
                " o.origin_register_no AS \"originRegisterNo\", " +
                " o.origin_con_no AS \"originConNo\"," +
                " o.con_no AS \"conNo\"," +
                " o.hospital AS \"hospital\"," +
                " o.hospital_name AS \"hospitalName\"," +
                " o.win_no AS \"winNo\"," +
                " o.type AS  \"type\"," +
                " o.dept AS \"dept\", " +
                " o.dept_name AS \"deptName\", " +
                " o.patient AS \"patient\", " +
                " o.patient_name AS \"patientName\", " +
                " o.doctor AS \"doctor\", " +
                " o.doctor_name AS \"doctorName\", " +
                " o.idcard AS \"idcard\", " +
                " o.card_no AS \"cardNo\"," +
                " o.mjz AS \"mjz\", " +
                " o.icd10 AS \"icd10\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " o.adm_date AS \"admDate\", " +
                " o.con_date AS \"conDate\", " +
                " o.description AS \"description\", " +
                " o.disease_img AS \"diseaseImg\", " +
                " o.create_time AS \"createTime\", " +
                " o.status AS \"status\"," +
                " o.register_date AS \"registerDate\"," +
                " o.evaluate_status AS \"evaluateStatus\"" +
                " o.pay_status as \"payStatus\" "+
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = ? ";
        List<Object> params = new ArrayList<>();
        params.add(patient);
                " o.patient =:patient ";
        Map<String,Object> params = new HashedMap();
        params.put("patient",patient);
        if(status!=null){
            sql +=  " AND o.status = ? ";
            params.add(status);
            sql +=  " AND o.status =:status ";
            params.put("status",status);
        }
        if(StringUtils.isNotBlank(startTime)){
            sql += " AND o.create_time >= ? ";
            params.add(startTime+" 00:00:00");
            sql += " AND o.create_time >=:createTime ";
            params.put("createTime",DateUtil.strToDateLong(startTime+" 00:00:00"));
        }
        if(StringUtils.isNotBlank(endTime)){
            sql += " AND o.create_time <= ? ";
            params.add(endTime+" 23:59:59");
            sql += " AND o.create_time <=:endTime ";
            params.put("endTime",DateUtil.strToDateLong(endTime+" 23:59:59"));
        }
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class),params.toArray());
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,size);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
@ -398,14 +415,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expressage",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);
        }
        }*/
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
@ -452,7 +469,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        String sql ="SELECT " +
@ -692,13 +709,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
        String outPatientSql="";
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
            jdbcTemplate.execute(sql);
        } else if ("2".equals(status)) {
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            //变更门诊状态
            outPatientSql="UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'";
            jdbcTemplate.execute(outPatientSql);
@ -884,21 +901,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " d.outpatient_type AS outpatientType," +
                " d.consult_status AS consultStatus" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " 1=1";
        Map<String,Object> params = new HashedMap();
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code = '" + dept + "'";
        }
@ -937,14 +955,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >=:startDate" +
                    " AND t.start_time <=:endDate" +
                    " )";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-ss HH:mm:ss"));
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-ss HH:mm:ss"));
        }
        logger.info("findDoctorByHospitalAndDept sql:" + sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,params);
        if (list != null && list.size() > 0 && StringUtils.isNotBlank(doctorCode)) {
            //排序
@ -969,12 +990,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size) {
        String totalSql = "SELECT " +
                " count(1) AS total " +
                " count(1) AS \"total\" " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " 1=1 ";
        Map<String,Object> params = new HashedMap();
        if (StringUtils.isNotBlank(dept)) {
            totalSql += " AND h.dept_code = '" + dept + "'";
        }
@ -1018,30 +1040,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >=:startDate" +
                    " AND t.start_time <=:endDate" +
                    " )";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-ss HH:mm:ss"));
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-ss HH:mm:ss"));
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql,params);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_code AS deptCode," +
                " h.dept_Name AS deptName," +
                " d.outpatient_type AS outpatientType," +
                " d.consult_status AS consultStatus" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_code AS \"deptCode\"," +
                " h.dept_Name AS \"deptName\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1093,13 +1117,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >= :startDate" +
                    " AND t.start_time <= :endDate" +
                    " )";
        }
        sql += " AND d.del='1' AND d.outpatient_type is not null LIMIT " + (page - 1) * size + "," + size + "";
        sql += " AND d.del='1' AND d.outpatient_type is not null ";
        logger.info("withwork sql:" +sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,params,page,size);
        if (list != null && list.size() > 0) {
            //获取排班
            for (Map<String, Object> doctor : list) {
@ -1170,7 +1194,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public MixEnvelop findDoctorWithMouthWork(String orgCode, String dept, String chargeType, String date, String nameKey,String iswork, Integer page, Integer size) {
        String totalSql = "SELECT " +
                " count(1) AS total " +
                " count(1) AS \"total\" " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1204,7 +1228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }else{
                totalSql +=" AND d.id NOT IN ( " +
@ -1213,29 +1237,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_code AS deptCode," +
                " h.dept_Name AS deptName" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS  \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_code AS \"deptCode\"," +
                " h.dept_Name AS \"deptName\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1268,7 +1292,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }else{
                sql +=" AND d.id NOT IN ( " +
@ -1277,13 +1301,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,size);
        if (list != null && list.size() > 0) {
            //获取排班
            for (Map<String, Object> doctor : list) {
@ -2736,11 +2760,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //医生角色
            String sql = "SELECT " +
                    " t. CODE AS roleCode, " +
                    " t. NAME AS roleName" +
                    " t. CODE AS \"roleCode\", " +
                    " t. NAME AS \"roleName\"" +
                    " FROM " +
                    " base_doctor_role r " +
                    " JOIN base_doctor_role_dict t ON t.`code` = r.role_code " +
                    " JOIN base_doctor_role_dict t ON t.code = r.role_code " +
                    " WHERE " +
                    " r.doctor_code = '"+doctor+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -2772,7 +2796,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //专家咨询
            String zjCountsql = "SELECT id FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
    
            if(zjList!=null&&zjList.size()>0){
@ -2783,8 +2807,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS score," +
                    "a.score_type AS score_type " +
                    "AVG(a.score) AS \"score\"," +
                    "a.score_type AS \"score_type\" " +
                    "FROM base_evaluate a,base_evaluate_score b " +
                    "WHERE " +
                    "a.relation_code=b.id " +
@ -2796,7 +2820,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            if(listscore!=null&&listscore.size()>0){
                for(Map<String,Object> _listscore :listscore){
                    doctorScore += (Double)_listscore.get("score");
                    doctorScore += Double.parseDouble(_listscore.get("score").toString());
                }
            }
            doctorScore = doctorScore/3;
@ -2810,16 +2834,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //查询评价明细
            String sqlScoreList = "SELECT " +
                    "a.score as score," +
                    "b.score as doctorscore," +
                    "a.score_type as score_type," +
                    "a.content as content," +
                    "b.create_time as create_time," +
                    "c.type as type," +
                    "c.name as patientname," +
                    "b.id as id," +
                    "c.photo as patientphoto," +
                    "b.type as niming " +
                    "a.score as \"score\"," +
                    "b.score as \"doctorscore\"," +
                    "a.score_type as \"score_type\"," +
                    "a.content as \"content\"," +
                    "b.create_time as \"create_time\"," +
                    "c.type as \"type\"," +
                    "c.name as \"patientname\"," +
                    "b.id as \"id\"," +
                    "c.photo as \"patientphoto\"," +
                    "b.type as \"niming\" " +
                    "FROM " +
                    "base_evaluate a " +
                    "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
@ -3056,20 +3080,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type,Integer query_status,String dept) {
        
        String sql ="SELECT " +
                "room.outpatient_id AS id," +
                "room.patient_id AS patient_id," +
                "room.patient_name AS name," +
                "patient.sex AS sex," +
                "patient.idcard AS idcard," +
                "patient.photo AS photo," +
                "outpatient.mobile AS mobile," +
                "patient.birthday AS birthday," +
                "room.consult_type AS consult_type," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.description AS description," +
                "room.reservation_type AS reservation_type," +
                "outpatient.origin_con_no AS origin_con_no " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
                "room.patient_name AS \"name\"," +
                "patient.sex AS \"sex\"," +
                "patient.idcard AS \"idcard\"," +
                "patient.photo AS \"photo\"," +
                "outpatient.mobile AS \"mobile\"," +
                "patient.birthday AS \"birthday\"," +
                "room.consult_type AS \"consult_type\"," ;
        if("xm_ykyy_wx".equals(wechatId)){
            sql += "to_char(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\"," ;
        }else{
            sql +=  "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format," ;
        }
        sql += "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.origin_con_no AS \"origin_con_no\" " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
@ -3210,7 +3238,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.doctor AS doctor, " +
                "room.doctor_name AS doctorName " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "WHERE op.`status`=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "AND room.doctor IS NOT NULL ";
        if(StringUtils.isNoneBlank(dept)){
            waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
@ -3392,30 +3420,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
        if(page >=1){
      /*  if(page >=1){
            page --;
        }
    
        if (pagesize <= 0) {
            pagesize = 10;
        }
        }*/
    
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_name AS deptName," +
                " d.consult_status AS consultStatus," +
                " d.outpatient_type AS outpatientType," +
                " a.total as consultTotal," +
                " h.org_name as orgName," +
                " follow.patient as followid," +
                " h.org_code as orgCode" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_name AS \"deptName\"," +
                " d.consult_status AS \"consultStatus\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " h.org_name AS \"orgName\"," +
                " follow.patient AS \"followid\"," +
                " h.org_code AS \"orgCode\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
@ -3427,6 +3455,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql +=  " WHERE  1=1 ";
        Map<String, Object> params = new HashedMap();
        if(StringUtils.isBlank(chargType)){
            sql +=" AND d.charge_type is not null ";
        }
@ -3434,13 +3465,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if("all".equals(chargType)){
                //不过滤
            }else{
                sql+=" AND d.charge_type = '"+chargType+"'";
                sql+=" AND d.charge_type = :chargType";
                params.put("chargType",chargType);
            }
        }
        if(StringUtils.isNotBlank(iswork)&&"1".equals(iswork)){
            logger.info("iswork:"+iswork);
            String date = DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss");
            Date date = new Date();
            sql+=" AND (" +
                    " EXISTS ( " +
                    " SELECT " +
@ -3449,28 +3481,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time <='" +date+"'" +
                    " AND t.end_time >='"+date+"'"+
                    " AND t.start_time <=:startTime" +
                    " AND t.end_time >=:endTime"+
                    " ) OR " +
                    " d.consult_status = '1') ";
            params.put("startTime",date);
            params.put("endTime",date);
        }
        if(StringUtils.isNotBlank(orgCode)){
            sql += " AND  h.org_code = '"+orgCode+"'";
            sql += " AND  h.org_code = :orgCode";
            params.put("orgCode",orgCode);
        }
        if(StringUtils.isNotBlank(diseaseKey)){
            sql+=" AND d.expertise like '%"+diseaseKey+"%'";
            sql+=" AND d.expertise like :diseaseKey";
            params.put("diseaseKey","%"+diseaseKey+"%");
        }
    
        if(StringUtils.isNotBlank(doctorNameKey)){
            sql+=" AND d.name like '%"+doctorNameKey+"%'";
            sql+=" AND d.name like :doctorNameKey";
            params.put("doctorNameKey","%"+doctorNameKey+"%");
        }
        
        if(StringUtils.isNotBlank(dept)){
            sql+=" AND h.dept_code = '"+dept+"' ";
            sql+=" AND h.dept_code = :dept ";
            params.put("dept",dept);
        }
    
        if(StringUtils.isNotBlank(jobTitleNameKey)){
            sql+=" AND d.job_title_name  = '"+jobTitleNameKey+"' ";
            sql+=" AND d.job_title_name  = :jobTitleNameKey ";
            params.put("jobTitleNameKey",jobTitleNameKey);
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
@ -3497,17 +3537,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    
        if(StringUtils.isNotBlank(workingTime)){
            sql+=" AND wk.date = '"+workingTime+"' ";
            sql+=" AND wk.date = :workingTime ";
            params.put("workingTime",workingTime);
        }
    
    
        if(StringUtils.isNotBlank(consultStatus)){
            sql+=" AND d.consult_status = '"+consultStatus+"' ";
            sql+=" AND d.consult_status = :consultStatus ";
            params.put("consultStatus",consultStatus);
        }
    
        sql += " and d.del='1' order by a.total "+ consutlSort +" limit "+page * pagesize +","+pagesize;
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        sql += " and d.del='1' order by a.total "+ consutlSort;
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pagesize);
        logger.info("findDoctorByHospitalAndDiseaseAndDept end:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        logger.info("sql:"+sql);
@ -3520,7 +3564,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public List<Map<String,Object>> findHotDeptAndDiseaseDict(String dictName) {
        String sql ="SELECT * from wlyy_hospital_sys_dict where dict_name='"+dictName+"' ORDER BY sort ASC;";
        String sql ="SELECT * from wlyy_hospital_sys_dict where dict_name='"+dictName+"' ORDER BY sort ASC";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        
@ -3571,10 +3615,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if("1".equals(type)){
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3588,10 +3632,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3604,10 +3648,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else if("3".equals(type)){
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -4104,7 +4148,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long waitVideoCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            waitVideoCount = (Long) rstotal.get(0).get("total");
            waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
        }
    
        return waitVideoCount;
@ -4583,7 +4627,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long totalsqlAll = 0l;
        if (alltotal != null && alltotal.size() > 0) {
            totalsqlAll = (Long) alltotal.get(0).get("total");
            totalsqlAll = Long.parseLong(alltotal.get(0).get("total").toString());
        }
    
        object.put("all",totalsqlAll);
@ -4602,7 +4646,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long twCount = 0l;
        if (imgtotal != null && imgtotal.size() > 0) {
            twCount = (Long) imgtotal.get(0).get("total");
            twCount = Long.parseLong(imgtotal.get(0).get("total").toString());
        }
    
        object.put("twCount",twCount);
@ -4621,7 +4665,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long spcount = 0l;
        if (sptotal != null && sptotal.size() > 0) {
            spcount = (Long) sptotal.get(0).get("total");
            spcount = Long.parseLong(sptotal.get(0).get("total").toString());
        }
    
        object.put("spCount",spcount);
@ -4641,7 +4685,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long xtcount = 0l;
        if (xttotal != null && xttotal.size() > 0) {
            xtcount = (Long) xttotal.get(0).get("total");
            xtcount = Long.parseLong(xttotal.get(0).get("total").toString());
        }
    
        object.put("xtCount",xtcount);
@ -4806,6 +4850,63 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
       return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
    }
    /**
     * 查找未配送处方订单
     */
    public List<WlyyPrescriptionVO> findUndeliveredList(){
        String sql ="SELECT " +
                " p.id AS \"id\", " +
                " p.real_order AS \"realOrder\"," +
                " p.origin_real_order AS \"originRealOrder\"," +
                " p.adm_no AS \"admNo\"," +
                " p.origin_adm_no AS \"originAdmNo\"," +
                " p.serial_no AS \"serialNo\"," +
                " p.type AS \"type\", " +
                " p.patient_code AS \"patientCode\", " +
                " p.patient_name AS \"patientName\", " +
                " p.ssc AS \"ssc\", " +
                " p.doctor AS \"doctor\", " +
                " p.doctor_name AS \"doctorName\", " +
                " p.status AS \"status\", " +
                " p.mk_fail_reason AS \"mkFailReason\", " +
                " p.mk_time AS \"mk_time\", " +
                " p.prescribe_reason AS \"prescribeReason\", " +
                " p.prescribe_time AS \"prescribeTime\", " +
                " p.pay_time AS \"payTime\", " +
                " p.dosage_time AS \"dosageTime\", " +
                " p.finish_time AS \"finishTime\", " +
                " p.create_time AS \"createTime\", " +
                " p.dept AS \"dept\", " +
                " p.dept_name AS \"deptName\", " +
                " p.hospital AS \"hospital\", " +
                " p.hospital_name AS \"hospitalName\", " +
                " p.consult AS \"consult\", " +
                " p.dispensary_type AS \"dispensaryType\", " +
                " p.reason AS \"reason\", " +
                " p.remark AS \"remark\", " +
                " p.cancel_reason AS \"cancelReason\", " +
                " p.ca_cert_data AS \"caCertData\", " +
                " p.ca_message AS \"caMessage\", " +
                " p.digital_sign_no AS \"digitalSignNo\", " +
                " p.original_data_abstract AS \"originalDataAbstract\", " +
                " p.str_original_data AS \"strOriginalData\", " +
                " p.his_dept_code AS \"hisDeptCode\", " +
                " p.his_doctor_code AS \"hisDoctorCode\", " +
                " p.his_gister_type_code AS \"hisGisterTypeCode\", " +
                " p.his_rate_type_code AS \"hisRateTypeCode\", " +
                " p.his_hospital AS \"hisHospital\", " +
                " p.his_register_fee AS \"hisRegisterFee\", " +
                " p.pay_status AS \"payStatus\" " +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE status = 60 or status = 50 ";
        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class));
        if(list!=null){
            return list;
        }
        return new ArrayList<>();
    }
    /**
     * 获取医生信息
     * @param hospital
@ -4815,7 +4916,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findDoctorByName(String hospital, String name,String chargeType){
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.`name` AS \"name\"" +
                " d.name AS \"name\"" +
                " FROM " +
                " base_doctor d ";
        if(StringUtils.isNotBlank(hospital)){
@ -4873,19 +4974,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
    
        if(page >=1){
            page --;
        }
    
        if (pagesize <= 0) {
            pagesize = 10;
        }
    
        String sql ="SELECT " +
                "dept.`code` AS deptCode," +
                "dept.`name` AS deptName," +
                "org.CODE AS orgCode, " +
                "org.NAME AS orgName " +
                "dept.code AS \"deptCode\"," +
                "dept.name AS \"deptName\"," +
                "org.CODE AS \"orgCode\", " +
                "org.NAME AS \"orgName\" " +
                "FROM " +
                "dict_hospital_dept dept," +
                "base_org org " +
@ -4895,9 +4988,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(keyWord)){
            sql = sql + "AND dept.NAME LIKE '%"+keyWord+"%' ";
        }
        sql = sql + " limit "+page * pagesize +","+pagesize ;
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pagesize);
        logger.info("sql:"+sql);
        return list;
    }

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

@ -0,0 +1,458 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
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.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.util.*;
/**
 * Created by Trick on 2019/5/17.
 */
@Service
@Transactional
public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(YkyyPrescriptionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private DoctorMappingService doctorMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao sysDictDao;
    @Autowired
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao;
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private SystemMessageService systemMessageService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDoctorPatientFollowDao baseOrgPatientDao;
    @Autowired
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    /**
     * 发起图文和视频复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(0);
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        businessOrderDO.setRelationCode(outpatient.getId());
        businessOrderDO.setRelationName("复诊-诊查费");
        businessOrderDO.setDescription("复诊-诊查费");
        businessOrderDO.setPatient(outpatient.getPatient());
        businessOrderDO.setPatientName(outpatient.getPatientName());
        businessOrderDO.setDoctor(outpatient.getDoctor());
        if (outpatientDO.getType().equalsIgnoreCase("1")) {
            businessOrderDO.setOrderType(1);
            businessOrderDO.setOrderCategory("2");
        } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
            businessOrderDO.setOrderType(3);
            businessOrderDO.setOrderCategory("3");
        }
        businessOrderService.saveOrder(businessOrderDO);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        expressageDO.setDel(1);
        expressageDO.setCreateTime(new Date());
        expressageDO.setOutpatientId(outpatient.getId());
        prescriptionExpressageDao.save(expressageDO);
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        return outpatient;
    }
    /**
     * 创建候诊室
     *
     * @param outpatientDO
     * @return
     */
    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) {
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setDept(outpatientDO.getDept());
        waitingRoom.setDeptName(outpatientDO.getDeptName());
        waitingRoom.setHospital(outpatientDO.getHospital());
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        //是否是有协同门诊医生
        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) {
            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
        waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
        waitingRoom.setVisitStatus(0);
        //设置复诊类型
        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) {
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctorName(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        if (StringUtils.isNotBlank(chargeType)) {
            waitingRoom.setChargeType(chargeType);
        }
        hospitalWaitingRoomDao.save(waitingRoom);
        return true;
    }
    /**
     * 获取药品
     *
     `prescription_id` varchar(50) DEFAULT NULL COMMENT '处方code 关联表wlyy_prescription code',
     `drug_no` varchar(50) DEFAULT NULL COMMENT '药品编号',
     `drug_name` varchar(50) DEFAULT NULL COMMENT '药品名称',
     `disp_deposite` varchar(50) DEFAULT NULL COMMENT '库房号',
     `dosage` varchar(50) DEFAULT NULL COMMENT '药量',
     `quantity` varchar(50) DEFAULT NULL COMMENT '数量',
     `unit` varchar(50) DEFAULT NULL COMMENT '用量单位',
     `unit_name` varchar(50) DEFAULT NULL COMMENT '用量单位中文',
     `pack_unit` varchar(50) DEFAULT NULL COMMENT '包装单位',
     `pack_unit_name` varchar(50) DEFAULT NULL COMMENT '包装单位名称',
     `usage_code` varchar(50) DEFAULT NULL COMMENT '频率code',
     `usage_name` varchar(50) DEFAULT NULL COMMENT '频次名称',
     `supply_code` varchar(50) DEFAULT NULL COMMENT '用法',
     `supply_name` varchar(50) DEFAULT NULL COMMENT '用法名称',
     `days` varchar(50) DEFAULT NULL COMMENT '天数',
     `frequency` varchar(50) DEFAULT NULL COMMENT '组号',
     `serial` varchar(50) DEFAULT NULL COMMENT '药品序列号',
     `group_no` varchar(50) DEFAULT NULL COMMENT '库房号',
     `specification` varchar(50) DEFAULT NULL COMMENT '规格(10mgx10片/盒)',
     `pack_retprice` double(10,4) DEFAULT NULL COMMENT '包装价格',
     `herbal_count` varchar(10) DEFAULT NULL COMMENT '草药数量',
     `post_count` varchar(10) DEFAULT NULL COMMENT '贴数',
     `comm` varchar(50) DEFAULT NULL COMMENT '中药用法',
     `del` int(2) DEFAULT '1' COMMENT '1可用 0删除',
     `drug_place` varchar(100) DEFAULT NULL COMMENT '药品产地',
     `pack_quantity` int(11) DEFAULT NULL COMMENT '包装数量',
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey);
        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("ypdm"));
            object.put("drugname",map.get("ypmc"));
            object.put("specification",map.get("yfgg"));
            object.put("pack_unit_name",map.get("yfdw"));
            object.put("pack_size",map.get("yfbz"));
            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("gyffmc"));//给药方式名称
            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("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            array.add(object);
        }
        return array;
    }
    /**
     * 获取药品用法
     */
    public JSONArray getDrugUse(String drugNo, String pyKey) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYpyf(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("supply_code",map.get("pydm"));
            object.put("supply_name",map.get("xmmc"));
            array.add(object);
        }
        return array;
    }
    /**
     * 医院频次
     *
     * @return
     */
    public JSONArray getDrugFrequency() throws Exception {
        JSONArray mapList = ykyyEntranceService.findSypc(null);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("FREQ_CODE",map.get("pcmc"));
            object.put("FREQ_NAME",map.get("pcmc1"));
            array.add(object);
        }
        return array;
    }
    /**
     * 获取检查检验
     *  "action": "select",
     "name": "丙型肝炎RNA测定(全自动荧光定量分析)",
     "charge_unit": "项",
     "charge_amount": "150",
     "py_code": "BXGYRNAC",
     "d_code": "GGEORNAI",
     "code": "393333",
     "exec_unit": "2160000",
     "win_no": "0",
     "exec_unit_name": "检验科"
     *
     * @return
     */
    public JSONArray getInspectionDictionary(String pyKey, String codes, String winNo) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYkJcxm(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("name",map.get("xmmc"));
            object.put("code",map.get("zlxmid"));
            object.put("py_code",map.get("pydm"));
            object.put("wbdm",map.get("wbdm"));
            object.put("jxdm",map.get("jxdm"));
            object.put("qtdm",map.get("qtdm"));
            object.put("ydyzlb",map.get("ydyzlb"));
            object.put("mlbh",map.get("mlbh"));
            object.put("zxpc",map.get("zxpc"));
            object.put("jfpc",map.get("jfpc"));
            object.put("jsfs",map.get("jsfs"));
            object.put("jszq",map.get("jszq"));
            object.put("charge_unit",map.get("jsdw"));
            object.put("syxb",map.get("syxb"));
            object.put("mxsy",map.get("mxsy"));
            object.put("zysy",map.get("zysy"));//住院使用
            object.put("tjsy",map.get("tjsy"));
            object.put("zxlb",map.get("zxlb"));//执行类别
            object.put("exec_unit",map.get("zxks"));//执行科室
            object.put("zxgzid",map.get("zxgzid"));//执行规则
            object.put("ywzx",map.get("ywzx"));
            object.put("zxap",map.get("zxap"));
            object.put("cpzx",map.get("cpzx"));
            object.put("szzx",map.get("szzx"));
            object.put("jjlx",map.get("jjlx"));
            object.put("ycxzsl",map.get("ycxzsl"));
            object.put("yblx",map.get("yblx"));
            object.put("zxbz",map.get("zxbz"));
            object.put("txid",map.get("txid"));
            object.put("bgbh",map.get("bgbh"));
            object.put("czsy",map.get("czsy"));
            object.put("lzsy",map.get("lzsy"));
            object.put("lccs",map.get("lccs"));
            object.put("bwbz",map.get("bwbz"));
            object.put("yblb",map.get("yblb"));
            array.add(object);
        }
        return array;
    }
}

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

@ -3,6 +3,8 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.webkit.dom.CSSStyleRuleImpl;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -16,9 +18,7 @@ import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
@ -27,23 +27,28 @@ import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.common.utils.DateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.io.IOException;
import java.util.*;
/**
 * 眼科医院专用service
@ -58,6 +63,8 @@ public class YkyyEntranceService {
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    private final static String saveUrl="http://192.168.20.55:10023/ykyy/save";
    private final static String orgCode ="350211A5004";
    private final static String orgName ="厦门大学附属厦门眼科中心";
@ -83,9 +90,6 @@ public class YkyyEntranceService {
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private OutpatientDao outpatientDao;
@ -101,6 +105,12 @@ public class YkyyEntranceService {
    @Autowired
    private BaseEvaluateDao baseEvaluateDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private ObjectMapper objectMapper;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
@ -157,6 +167,25 @@ public class YkyyEntranceService {
        return "success";
    }
    /**
     * 查找眼科his 已审核未付款的处方
     * @throws Exception
     */
    public JSONArray getUnsettledPrescription() throws Exception{
        String sql = "SELECT h.BRID,h.CFSB from HLW_CF01 h WHERE h.SPZT = 1 and h.FKZT = 0";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            return rs.getJSONArray("detailModelList");
        }
        return new JSONArray();
    }
    public String updateYkyyDoctor()throws Exception{
        String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.jobtitlecode AS \"jobTitleCode\",y.jobTitleName AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null";
        Map<String,Object> params = new HashedMap();
@ -557,4 +586,285 @@ public class YkyyEntranceService {
        BasePatientDO patientDO = basePatientDao.findById(patientMappingDO.getPatient());
        return patientDO;
    }
    /**
     * 查询药品信息
     * @param ypdm
     * @param ypmc
     * @param kusl
     * @return
     */
    public JSONArray findYkYpxx(String ypdm,String ypmc,String kusl,String pydm) throws Exception {
        String sql ="SELECT yp.ypxh AS \"ypxh\", yp.ypdm AS \"ypdm\", yp.ypmc AS \"ypmc\", yp.yfgg AS \"yfgg\"," +
                "yp.yfdw AS \"yfdw\"," +
                "yp.yfbz AS \"yfbz\"," +
                "yp.ypsx AS \"ypsx\"," +
                "yp.ypjl AS \"ypjl\"," +
                "yp.jldw AS \"jldw\"," +
                "yp.pydm AS \"pydm\"," +
                "yp.fyfs AS \"fyfs\"," +
                "yp.gyff AS \"gyff\"," +
                "yp.yfzf AS \"yfzf\"," +
                "yp.ybfl AS \"ybfl\"," +
                "yp.lsjg AS \"lsjg\"," +
                "yp.kcsl AS \"kcsl\"," +
                "yp.ypcd AS \"ypcd\"," +
                "yp.zfpb AS \"zfpb\"," +
                "yp.jbywbz AS \"jbywbz\"," +
                "yp.ydyp AS \"ydyp\"," +
                "yp.ypmc2 AS \"ypmc2\"," +
                "yp.gyffmc as \"gyffmc\""+  " FROM " +
                "V_ZKSG_MZ_YPXX yp where 1=1 ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and yp.ypdm like '%"+ypdm+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and yp.ypmc like '%"+ypmc+"%' ";
        }
        if (StringUtils.isNoneBlank(kusl)){
            sql+=" and yp.kusl like '%"+kusl+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and yp.pydm like '%"+pydm+"%' ";
        }
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
             array = rs.getJSONArray("detailModelList");
        }
       /* List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
        return array;
    }
    /**
     * 查询检查项目
     *
     * @return
     */
    public JSONArray findYkJcxm(String pydm) throws Exception {
        String sql ="SELECT\n" +
                "\tmz.zlxmid AS \"zlxmid\",\n" +
                "\tmz.xmmc AS \"xmmc\",\n" +
                "\tmz.pydm AS \"pydm\",\n" +
                "\tmz.wbdm AS \"wbdm\",\n" +
                "\tmz.jxdm AS \"jxdm\",\n" +
                "\tmz.qtdm AS \"qtdm\",\n" +
                "\tmz.ydyzlb AS \"ydyzlb\",\n" +
                "\tmz.mlbh AS \"mlbh\",\n" +
                "\tmz.zxpc AS \"zxpc\",\n" +
                "\tmz.jfpc AS \"jfpc\",\n" +
                "\tmz.jsfs AS \"jsfs\",\n" +
                "\tmz.jszq AS \"jszq\",\n" +
                "\tmz.jsdw AS \"jsdw\",\n" +
                "\tmz.syxb AS \"syxb\",\n" +
                "\tmz.mxsy AS \"mxsy\",\n" +
                "\tmz.zysy AS \"zysy\",\n" +
                "\tmz.tjsy AS \"tjsy\",\n" +
                "\tmz.zxlb AS \"zxlb\",\n" +
                "\tmz.zxks AS \"zxks\",\n" +
                "\tmz.zxgzid AS \"zxgzid\",\n" +
                "\tmz.ywzx AS \"ywzx\",\n" +
                "\tmz.zxap AS \"zxap\",\n" +
                "\tmz.cpzx AS \"cpzx\",\n" +
                "\tmz.szzx AS \"szzx\",\n" +
                "\tmz.jjlx AS \"jjlx\",\n" +
                "\tmz.ycxzsl AS \"ycxzsl\",\n" +
                "\tmz.yblx AS \"yblx\",\n" +
                "\tmz.zxbz AS \"zxbz\",\n" +
                "\tmz.txid AS \"txid\",\n" +
                "\tmz.bgbh AS \"bgbh\",\n" +
                "\tmz.czsy AS \"czsy\",\n" +
                "\tmz.lzsy AS \"lzsy\",\n" +
                "\tmz.lccs AS \"lccs\",\n" +
                "\tmz.bwbz AS \"bwbz\",\n" +
                "\tmz.yblb AS \"yblb\"\n" +
                "FROM\n" +
                "\tV_ZKSG_JCXM_MZ mz where 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and pydm = '%"+pydm+"%'";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 获取频次
     * @return
     */
    public JSONArray findSypc(String pcbm) throws Exception {
        String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and s.pcbm='"+pcbm+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 获取用法
     * @return
     */
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    public String findByRealOrder(String code) throws Exception {
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findByPatientCode(code);
        if (wlyyPrescriptionDOs!=null&&wlyyPrescriptionDOs.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
            JSONObject objectString = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO =  JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO);
        }
        return null;
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        if (wlyyPrescriptionVO!=null){
            hlwCf01DO.setSPZT(0);
            hlwCf01DO.setFKZT(wlyyPrescriptionVO.getPayStatus());
            hlwCf01DO.setYFSB(3);
            hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
            hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
            hlwCf01DO.setZFPB(1);
            hlwCf01DO.setFYBZ(0);
            hlwCf01DO.setPYBZ(0);
            hlwCf01DO.setDJYBZ(0);
            hlwCf01DO.setCFTS(1);
            hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
            hlwCf01DO.setYXPB(1);
            hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
            String patient = wlyyPrescriptionVO.getPatientCode();
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
            hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
            hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
            String doctor = wlyyPrescriptionVO.getDoctor();
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
            hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
            hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
            hlwCf01DO.setGUID(getCode());
           /* hibenateUtils.save(hlwCf01DO);*/
            String jsonString = JSONObject.toJSONString(hlwCf01DO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HLW_CF01");
            logger.info("HLW_CF01:"+jsonString);
            HttpResponse response = HttpUtils.doGet(url,params);
            if (response.getStatus()==200){
                logger.info("表HLW_CF01同步成功!");
            }else {
                logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
            }
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
            for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                HlwCf02DO hlwCf02DO = new HlwCf02DO();
                hlwCf02DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
                hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                hlwCf02DO.setXMLX(1);
                hlwCf02DO.setCFTS(1);
                hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
                hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice());
                hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice());//划价价额
                hlwCf02DO.setYPZS(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                hlwCf02DO.setYCSL("0");
                hlwCf02DO.setFYGB(17);//费用归并
                hlwCf02DO.setZFBL(1.0);//自负比例
                hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
              /*  hibenateUtils.save(hlwCf02DO);*/
                String jsonString1 = JSONObject.toJSONString(hlwCf01DO);
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HLW_CF02");
                logger.info("HLW_CF02:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                if (response1.getStatus()==200){
                    logger.info("表HLW_CF02同步成功!");
                }else {
                    logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
                }
            }
        }
        return null;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}

+ 46 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -5,16 +5,17 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.charts.LineChartSeries;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.Map;
/**
@ -26,6 +27,8 @@ import java.util.Map;
@Service
public class YkyyService {
    private Logger logger = LoggerFactory.getLogger(YkyyService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
@ -102,6 +105,7 @@ public class YkyyService {
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
    }
@ -120,6 +124,7 @@ public class YkyyService {
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
    }
@ -135,6 +140,7 @@ public class YkyyService {
        param.put("user_id",userId);
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取就诊卡数据接口:"+response);
        return response;
    }
@ -151,6 +157,7 @@ public class YkyyService {
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
        response = httpClientUtil.get(url,"GBK");
        logger.info("添加就诊卡接口:"+response);
        return response;
    }
@ -178,12 +185,13 @@ public class YkyyService {
            url+="&pay_accout="+payAccount;
        }
        if (StringUtils.isNoneBlank(pcCallbackUrl)){
            url+="&pc_callback_url="+pcCallbackUrl;
            url+="&pc_callback_url="+ URLEncoder.encode(pcCallbackUrl);
        }
        if (StringUtils.isNoneBlank(appCallbackUrl)){
            url+="&app_callback_url="+appCallbackUrl;
            url+="&app_callback_url="+URLEncoder.encode(appCallbackUrl);
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通新增订单接口:"+response);
        return response;
    }
@ -198,6 +206,7 @@ public class YkyyService {
        String response="";
        String url = yktUrl+"doc_jkzl/update_order_state?order_no="+orderNo+"&state="+state;
        response = httpClientUtil.get(url,"GBK");
        logger.info("更新订单支付状态:"+response);
        return response;
    }
@ -218,6 +227,34 @@ public class YkyyService {
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
    }
    /**
     * 获取userId
     * @param tel
     * @return
     */
    public String getUserId(String tel){
        String response="";
        String url = yktUrl+"doc_jkzl/get_user_id_by_tel?tel="+tel;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
    }
    /**
     * 获取医生code
     * @param doctorMapping
     * @return
     */
    public String getYktDoctor(String doctorMapping){
        String response="";
        String url = yktUrl+"doc_jkzl/get_ykt_doctorid_by_doctorcode?doctor_code="+doctorMapping;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
    }
@ -231,7 +268,7 @@ public class YkyyService {
     */
    public String getFamilyList(String tel,String userId){
        String response="";
        String url = yktUrl+"doc_jkzl/get_family_list?tel=13720881220&user_id=5a1271a6-e0b5-b99a-9928-5b2b8dcb6940";
        String url = yktUrl+"doc_jkzl/get_family_list?";
        if (StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
            url+="&user_id="+userId;
@ -241,6 +278,7 @@ public class YkyyService {
            url+="user_id="+userId;
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
    }
@ -351,7 +389,8 @@ public class YkyyService {
                                patientDao.save(basePatientDO);
                            }
                        }else {
                            String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                            userId=object1.getString("user_id");
                            String birdth = DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()));
                            Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                            Integer sex = basePatientDO.getSex();
                            String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
@ -361,6 +400,7 @@ public class YkyyService {
                                String yktId = object3.getString("ID");
                                basePatientDO.setYktId(yktId);
                                userId = object3.getString("ASSUSERID");
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -289,6 +289,8 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(jb);
        logger.info("入参:"+jsonArray.toJSONString()+"入参:"+jb.toJSONString());
        String token = upNsUserToken(url);
        String res = postToInter(token, api, jsonArray,url);

+ 86 - 29
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1,40 +1,39 @@
package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.service.WxPayLogService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.json.JSONObject;
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.Service;
import org.springframework.transaction.annotation.Transactional;
@ -49,6 +48,8 @@ import java.util.*;
@Service
public class BusinessOrderService {
    private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
@ -67,6 +68,11 @@ public class BusinessOrderService {
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private ConsultOrderDao consultOrderDao;
    @Autowired
    private OutpatientDao outpatientDao;
    /**
@ -79,11 +85,26 @@ public class BusinessOrderService {
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/zjzx");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/consult");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/twzs");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/review");
        }
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        String totalFee = null;
        if (hospitalSysDictDOS!=null&&hospitalSysDictDOS.size()!=0){
            totalFee= hospitalSysDictDOS.get(0).getDictValue();
        }
        businessOrderDO.setPayPrice(StringUtils.isNoneBlank(totalFee)?Double.parseDouble(totalFee):0.0);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        String orderNo = businessOrderDO.getOrderNo();
        String patientId = basePatientDO.getUserId();
        String patientId = basePatientDO.getYktId();
        String orderAmout = businessOrderDO.getPayPrice().toString();
        String description = businessOrderDO.getDescription();
        String state = businessOrderDO.getStatus().toString();
@ -94,7 +115,26 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String yktDoctor ="";
        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
            String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
            JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
            if (jsonObject.getInteger("code")==200){
                JSONArray array = jsonObject.getJSONArray("data");
                if (array!=null&&array.size()!=0){
                    yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
                }
            }
        }else {
            throw new Exception("医生映射表不存在!");
        }
        String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("code")==200){
            businessOrderDO.setUploadStatus(1);
            businessOrderDao.save(businessOrderDO);
        }
        return businessOrderDO;
    }
@ -124,7 +164,7 @@ public class BusinessOrderService {
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        String orderNo = businessOrderDO.getOrderNo();
        String patientId = basePatientDO.getUserId();
        String patientId = basePatientDO.getYktId();
        String orderAmout = businessOrderDO.getPayPrice().toString();
        String description = businessOrderDO.getDescription();
        String state = businessOrderDO.getStatus().toString();
@ -136,7 +176,7 @@ public class BusinessOrderService {
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
        String doctorId = "";
        if (doctorMappingDO!=null){
@ -181,11 +221,7 @@ public class BusinessOrderService {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        String body = businessOrderDO.getDescription();
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        String totalFee = null;
        if (hospitalSysDictDOS!=null&&hospitalSysDictDOS.size()!=0){
            totalFee= hospitalSysDictDOS.get(0).getDictValue();
        }
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        String patient = businessOrderDO.getPatient();
        String openid = "";
        if (StringUtils.isNoneBlank(patient)){
@ -197,7 +233,7 @@ public class BusinessOrderService {
        String ourTradeNo = businessOrderDO.getOrderNo();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        return map;
    }
@ -214,7 +250,6 @@ public class BusinessOrderService {
     * @return
     * @throws Exception
     */
    @Transactional(rollbackFor = Exception.class)
    public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
@ -240,6 +275,7 @@ public class BusinessOrderService {
        map.put("mch_id",wxWechatDO.getMchId());
        map.put("body",body);
        map.put("out_trade_no",ourTradeNo);
        map.put("fee_type","CNY");
        map.put("total_fee",totalFee);
        map.put("spbill_create_ip",getServerIp());
        map.put("notify_url",notifyUrl);
@ -257,6 +293,7 @@ public class BusinessOrderService {
            String result1 = HttpUtil.sendGet(openidList_url, params1);
            JSONObject json1 = new JSONObject(result1);
        }*/
        logger.info("map:"+map.toString());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        String returnCode = pay.get("return_code").toString();
@ -267,12 +304,11 @@ public class BusinessOrderService {
            String prepayId = pay.get("prepay_id").toString();
            Map<String,String> param = new HashedMap();
            param.put("appid",appid);
            param.put("partnerid",mchId);
            param.put("prepayid",prepayId);
            param.put("package","Sign=WXPay");
            param.put("noncestr",nonceStr);
            param.put("timestamp",getTimeStamp());
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("nonceStr",nonceStr);
            param.put("signType","MD5");
            param.put("timeStamp",getTimeStamp());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            pay.put("jsapi",param);
        }
@ -421,6 +457,7 @@ public class BusinessOrderService {
    public Map<String,String> getWxPayResultNotify(String result) {
        Map<String,String> rs = new HashedMap();
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        logger.info("回调参数");
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
@ -433,6 +470,17 @@ public class BusinessOrderService {
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setStatus(1);
            if (businessOrderDO!=null){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                    consultDo.setPayStatus(1);
                    consultOrderDao.save(consultDo);
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            //操作微信日志表记录
            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
@ -457,7 +505,7 @@ public class BusinessOrderService {
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        String patientId = basePatientDO.getUserId();
        String patientId = basePatientDO.getYktId();
        String orderAmout = businessOrderDO.getPayPrice().toString();
        String description = businessOrderDO.getDescription();
        String state = businessOrderDO.getStatus().toString();
@ -468,7 +516,16 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
            }
        }
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        return response;
    }

+ 30 - 0
business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultOrderDao.java

@ -0,0 +1,30 @@
package com.yihu.jw.order.dao;
import com.yihu.jw.entity.base.im.ConsultDo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 咨询表DAO类
 * @author huangwenjie
 */
public interface ConsultOrderDao extends PagingAndSortingRepository<ConsultDo, String>, JpaSpecificationExecutor<ConsultDo> {
	
//	@Query("from ConsultDo a where a.relationCode = ?1")
//	ConsultDo findByRelationCode(String outpatientid);
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, String id, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.id < ?2 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, String id, Pageable pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, Pageable pageRequest);
}

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java

@ -36,6 +36,8 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    @Query("from BasePatientDO p where p.mobile = ?1 and p.del=?2")
    List<BasePatientDO> findByMobileAndDel(String mobile,String del);
    
    BasePatientDO findByIdcard(String idcard);
//    @Modifying
//    @Query(" update BasePatientDO a set a.openid=?2 where a.id=?1 ")

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

@ -57,7 +57,7 @@ public class HibenateDemo {
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
        if(count!=null){
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }

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

@ -2,6 +2,7 @@ package com.yihu.jw.utils.hibernate;
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;
@ -158,7 +159,10 @@ public class HibenateUtils {
    public void save(Object object) {
        Session session = (Session) entityManager.getDelegate();
        Transaction transaction = session.beginTransaction();
        transaction.begin();
        session.save(object);
        transaction.commit();
    }
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2020/4/27.
 */
public interface WxPushLogDao extends PagingAndSortingRepository<WxPushLogDO, String>, JpaSpecificationExecutor<WxPushLogDO> {
}

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

@ -66,7 +66,7 @@ public class WechatInfoService {
            WxWechatDO wxWechat = null;
            
            //中山医院互联网医院
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId)){
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
                jsapiTickets = wxAccessTokenService.findJsapiTicket(wxId);
            }else{
                wxWechat = wxAccessTokenService.getWxInfo(wxId);

+ 117 - 4
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -4,18 +4,20 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.base.wx.WxTemplateDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.oauth.OauthSsoService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import org.slf4j.Logger;
@ -28,6 +30,7 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/5/19 0019.
@ -62,6 +65,14 @@ public class WxTemplateService {
    
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    
    
    /**
@ -115,6 +126,72 @@ public class WxTemplateService {
        return "success";
    }
    /**
     * 查询HIS的01表中的审方状态,如果已审方,且未结算,则推送一条模板消息给居民,让居民进行支付结算。
     */
    public void unSettledHISPrescription() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            //获取已审核未结算的处方
            JSONArray array = ykyyEntranceService.getUnsettledPrescription();
//            JSONArray array = new JSONArray();
//            JSONObject tmpjson = new JSONObject();
//            tmpjson.put("BRID","1234");
//            tmpjson.put("CFSB","1159744");
//            array.add(tmpjson);
            //发送模板
            if(array!=null&&array.size()>0) {
                for (int i = 0; i<array.size(); i++){
                    JSONObject json = array.getJSONObject(i);
                    String brid = json.getString("BRID");
                    String cfsb = json.getString("CFSB");
                    //查找居民信息
                    BasePatientDO patientDO = ykyyEntranceService.findPatientByMapingCode(brid);
                    if(patientDO!=null){
                        //查找对应的处方
                        String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' ORDER BY w.CREATE_TIME desc";
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
                            String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patientDO.getId()
                                    +"' and w.OPENID = '"+prescriptionId+"' and w.scene = 'djsxxtz' and w.WECHAT_ID='"+wechatId+"'";
                            List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                            if(count==null || count.size() == 0){
                                List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patientDO.getId());
                                if(ps.isEmpty()){
                                    logger.info("该用户"+patientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+patientDO.getId()+"wechatId:"+wechatId);
                                }else{
                                    ps.stream().forEach(one->{
                                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","djsxxtz",1);
                                        config.setFirst(config.getFirst().replace("key1",patientDO.getName()));
                                        config.setUrl(config.getUrl()+""+outpatientId+"&openid="+one.getOpenid());
                                        config.setKeyword3(doctorName);
                                        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),config);
                                    });
                                    //保存发送模板记录,
                                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                    wxPushLogDO.setCreateTime(new Date());
                                    wxPushLogDO.setOpenid(prescriptionId);
                                    wxPushLogDO.setReceiver(patientDO.getId());
                                    wxPushLogDO.setWechatId(wechatId);
                                    wxPushLogDO.setReceiverName(patientDO.getName());
                                    wxPushLogDO.setScene("djsxxtz");
                                    wxPushLogDao.save(wxPushLogDO);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_survey","test",1);
@ -123,6 +200,7 @@ public class WxTemplateService {
        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),openid,config);
        return "success";
    }
    
    public Envelop getAllTemp(String wechatId){
@ -169,5 +247,40 @@ public class WxTemplateService {
        }
        return rs;
    }
    
    /**
     * 发送微信模版消息
     * @param userName
     * @param senderName
     * @param idCard
     * @param phone
     * @param title
     * @param content
     * @param contentString
     * @param url
     */
    public String sendWxTemple(String userName, String senderName,
                             String idCard, String phone, String title,
                             String content, String contentString,
                             String url) throws Exception{
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        if(basePatientDO!=null){
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,basePatientDO.getId());
            if(ps.isEmpty()){
                logger.info("该用户"+basePatientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+basePatientDO.getId()+"wechatId:"+wechatId);
            }else{
                for (BasePatientWechatDo basePatientWechatDo:ps){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_im_notice","zxtx",1);
                        config.setFirst(config.getFirst().replace("key1",senderName));
                        config.setKeyword1(contentString);
                        config.setKeyword2(DateUtil.dateToStrLong(new Date()));
                        config.setUrl(url);
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                }
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }
        return "success";
    }
}

+ 174 - 160
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -45,6 +45,7 @@ import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
@ -157,6 +158,12 @@ public class ImService {
	
	@Autowired
	private StringRedisTemplate redisTemplate;
	@Autowired
	private HibenateUtils hibenateUtils;
	
	@Value("${wechat.id}")
	private String wxId;
	
	
	
@ -170,35 +177,33 @@ public class ImService {
	 * @param status 状态
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status) {
		if(page >=1){
			page --;
		}
	public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,Integer payStatus) {
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS doctorName," +
				"d.photo AS doctorphoto," +
				"d.job_title_name AS jobTitleName, " +
				"h.dept_name AS deptName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\",";
		if("xm_ykyy_wx".equals(wxId)){
			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\"," +
				"d.name AS \"doctorName\"," +
				"d.photo AS \"doctorphoto\"," +
				"d.job_title_name AS \"jobTitleName\", " +
				"h.dept_name AS \"deptName\", " +
				"a.pay_status AS \"payStatus\" "+
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d, " +
				"base_doctor_hospital h " +
				"WHERE a.id=b.consult and d.id = h.doctor_code " +
				"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+")";
		List<ConsultVO> result = new ArrayList<>();
		/*List<ConsultVO> result = new ArrayList<>();*/
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
@ -219,10 +224,13 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		if (!StringUtils.isEmpty(payStatus)) {
			sql += " and a.pay_status = " + payStatus + "";
		}
		sql += " ORDER BY a.czrq desc ";
		List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
		/*result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));*/
		return result;
	}
	
@ -237,7 +245,7 @@ public class ImService {
	public Long countConsultRecordByPatient(String patient, String id,String type, String title) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d " +
@ -256,7 +264,7 @@ public class ImService {
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		
		return count;
@ -271,16 +279,16 @@ public class ImService {
	 */
	public String  getUnfinishedConsult(String patient, String doctor) {
		
		String totalSql = "SELECT a.consult as consultCode " +
		String totalSql = "SELECT a.consult as \"consultCode\" " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND b.to_doctor='" +doctor+"' "+
				"AND a.del='1' " +
				"AND (a.type<> 9 or a.type<> 16)" +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		if (rstotal != null && rstotal.size() > 0) {
@ -309,16 +317,16 @@ public class ImService {
	public JSONObject  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
		JSONObject result = new JSONObject();
		
		String totalSql = "SELECT a.consult as consultCode,a.doctor as specialDoctor " +
		String totalSql = "SELECT a.consult as \"consultCode\",a.doctor as \"specialDoctor\"  " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND a.actual_sender='" +general_doctor+"' "+
				"AND a.del='1' " +
				"AND a.type<> 12 " +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		String specialDoctor = "";
@ -938,6 +946,7 @@ public class ImService {
		re.put("patient",patient);
		re.put("patientName",tempPatient.getName());
		re.put("patient_idcard",tempPatient.getIdcard());
		re.put("consult",consult.getId());
		return re;
		
	}
@ -959,6 +968,7 @@ public class ImService {
		consult.setSymptoms(symptoms);
		consult.setImages(images);
		consult.setType(type);
		consult.setPayStatus(0);
		return consultDao.save(consult);
	}
	
@ -1427,7 +1437,11 @@ public class ImService {
		
		ConsultTeamDo consultTeamDo = consultTeamDao.findByConsult(consult);
		
		ConsultDo consultDo = consultDao.findOne(consult);
		
		object.put("doctorCode",consultTeamDo.getDoctor());
		//支付状态
		object.put("payStatus",consultDo.getPayStatus());
		
		return object;
	}
@ -1470,8 +1484,8 @@ public class ImService {
	 * @return
	 */
	public String getConsultCodeByOutpatientId(String outpatientid) {
		String totalSql = "SELECT id FROM wlyy_consult WHERE relation_code='"+outpatientid+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		String totalSql = "SELECT id as \"id\" FROM wlyy_consult WHERE relation_code='"+outpatientid+"' ";
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("id").toString();
@ -1485,8 +1499,8 @@ public class ImService {
	 * @return
	 */
	public String getOutpatientidByConsoultCode(String consult) {
		String totalSql = "SELECT relation_code FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		String totalSql = "SELECT relation_code as \"relation_code\" FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("relation_code").toString();
@ -1582,22 +1596,27 @@ public class ImService {
	public List<Map<String,Object>> getEvaluationByConsultCode(String consult) {
		//查询评价明细
		String sqlScoreList = "SELECT " +
				"a.score as score," +
				"a.score_type as score_type," +
				"a.content as content," +
				"b.create_time as create_time," +
				"c.type as type," +
				"c.name as patientname," +
				"b.id as id," +
				"c.photo as patientphoto," +
				"b.type as niming " +
				"a.score as \"score\"," +
				"a.score_type as \"score_type\"," +
				"a.content as \"content\",";
		if("xm_ykyy_wx".equals(wxId)){
			sqlScoreList +=  "to_char(b.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"create_time\",";
		}else{
			sqlScoreList +=  "date_format(b.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"create_time\",";
		}
		
		sqlScoreList +=	"c.type as \"type\"," +
				"c.name as \"patientname\"," +
				"b.id as \"id\"," +
				"c.photo as \"patientphoto\"," +
				"b.type as \"niming\" " +
				"FROM " +
				"base_evaluate a " +
				"LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
				"LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code " +
				"WHERE a.relation_code=b.id "+
				"AND c.consult='"+consult+"'";
		List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
		List<Map<String,Object>> scoreList = hibenateUtils.createSQLQuery(sqlScoreList);
		if(scoreList.isEmpty()){
			return null;
		}else{
@ -1683,35 +1702,31 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>  findConsultRecordByDoctor(String doctor, String id,
	                                                  String type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time) {
		
		if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				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\"," +
					"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 " +
@ -1720,22 +1735,26 @@ public class ImService {
		}else{
			
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"op.id as outpatientid," +
					"op.type as consultType," +
					"op.general_doctor as generalDoctor," +
					"op.icd10_name as icd10Name," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," ;
			if("xm_ykyy_wx".equals(wxId)){
				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\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"op.id as \"outpatientid\"," +
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d, " +
@ -1745,10 +1764,6 @@ public class ImService {
		}
		
		
		
		List<ConsultVO> result = new ArrayList<>();
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
@ -1782,10 +1797,9 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc ";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql,page,pagesize);
	}
	
	/**
@ -1802,7 +1816,7 @@ public class ImService {
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d," +
@ -1845,7 +1859,7 @@ public class ImService {
			sql += " and a.id = '" + id + "'";
		}
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
@ -2077,34 +2091,30 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findexpertConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>   findexpertConsultRecordByDoctor(String doctor, String id,
	                                                  Integer type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time,String patinet) {
		
		if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS patientName," +
				"d.id as patientId," +
				"d.idcard as patientIdcard," +
				"d.sex as patientsex," +
				"d.photo AS patientphoto, " +
				"doctor.name AS doctorName, " +
				"doctor.job_title_name AS jobTitleName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," ;
		if("xm_ykyy_wx".equals(wxId)){
			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\"," +
				"d.name AS \"patientName\"," +
				"d.id as \"patientId\"," +
				"d.idcard as \"patientIdcard\"," +
				"d.sex as \"patientsex\"," +
				"d.photo AS \"patientphoto\", " +
				"doctor.name AS \"doctorName\", " +
				"doctor.job_title_name AS \"jobTitleName\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor doctor," +
@ -2147,11 +2157,11 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc ";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
//		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		return result;
		return hibenateUtils.createSQLQuery(sql,page,pagesize);
	}
	
	
@ -2170,7 +2180,7 @@ public class ImService {
	public Long findexpertConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time,String patient) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d " +
@ -2250,9 +2260,9 @@ public class ImService {
				break;
		}
		
		String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + data_base_name + "." +
		String sql = "id AS \"id\",session_id AS \"session_id\",sender_id AS \"sender_id\",sender_name AS \"sender_name\",content_type AS \"content_type\",content AS \"content\",timestamp AS \"timestamp\"  from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
		for (int i = 0; i < list.size(); i++) {
			Map<String, Object> map = list.get(i);
@ -2388,28 +2398,30 @@ public class ImService {
	 * 医生待办事项列表
	 * @param doctorCode
	 * @param type
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
	public List<Map<String,Object>> doctorUpcomingList(String doctorCode, String type) {
		String sql = "";
		if("1,15".equals(type)) {
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"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 " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				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  " +
@ -2419,21 +2431,25 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					"op.description AS title," +
					"op.description AS symptoms," +
					"op.create_time AS czrq," +
					"op.status AS status," +
					"op.evaluate_status AS evaluate," +
					"op.doctor AS doctorCode," +
					"op.general_doctor AS generalDoctor," +
					"patient.NAME AS patientName," +
					"patient.id AS patientId," +
					"patient.idcard AS patientIdcard," +
					"patient.sex AS patientsex," +
					"patient.photo AS patientphoto," +
					"op.id AS outpatientid," +
					"op.register_date AS registerDate," +
					"op.status AS outpatientstatus " +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\"," +
					"op.create_time AS \"czrq\"," +
					"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," ;
			if("xm_ykyy_wx".equals(wxId)){
				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 wlyy_outpatient op," +
					"base_patient patient " +
					"WHERE op.patient=patient.id " +
@ -2455,9 +2471,7 @@ public class ImService {
			sql =sql +" ORDER BY op.create_time DESC";
		}
		
		List<ConsultVO> result = new ArrayList<>();
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql);
	}
	
	/**
@ -2483,11 +2497,11 @@ public class ImService {
	public List<Map<String,Object>>  getDoctorConsultCount(String doctorids) throws Exception{
		//医生角色
		String sql = "SELECT " +
				"count(id) AS total," +
				"doctor " +
				"count(id) AS \"total\"," +
				"doctor as \"doctor\"" +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
		return list;
	}
}

+ 4 - 0
business/sms-service/pom.xml

@ -41,6 +41,10 @@
            <artifactId>ImApi</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 end -->
    </dependencies>
</project>

+ 60 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/IotSMSService.java

@ -0,0 +1,60 @@
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * 物联网短信网关
 *
 * @author hmf
 */
@Service
public class IotSMSService {
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    public String IotSendSMS(String mobileStr, String content) throws Exception {
        //请求i健康发送短信接口
        String url = wlyyUrl+"wlyygc/doctor/message/sendMobileMessage";
        List<NameValuePair> par = new ArrayList<NameValuePair>();
        par.add(new BasicNameValuePair("mobiles", mobileStr));
        par.add(new BasicNameValuePair("content", content));
        String result = httpClientUtil.post(url,par,"UTF-8");
        JSONObject re = JSONObject.parseObject(result);
        if (re.getInteger("status") != 10000) {
            // 发送失败
            throw new Exception("短信发送失败!");
        } else {
            return "success";
        }
    }
    public static JSONObject toJson(String result) {
        JSONObject json = new JSONObject();
        try {
            String[] temps = result.split("&");
            for (String temp : temps) {
                if (temp.split("=").length != 2) {
                    continue;
                }
                String key = temp.split("=")[0];
                String value = temp.split("=")[1];
                json.put(key, value);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }
}

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

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
/*    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
//    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultDo.java

@ -36,6 +36,8 @@ public class ConsultDo extends UuidIdentityEntity {
	private Date endTime;
	//关联业务表的code
	private String relationCode;
	//支付状态
	private Integer payStatus;
	
	public String getPatient() {
		return patient;
@ -117,4 +119,12 @@ public class ConsultDo extends UuidIdentityEntity {
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
	public Integer getPayStatus() {
		return payStatus;
	}
	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -203,6 +203,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
		this.voice = voice;
	}
	
	@Column(name = "consult_comment")
	public String getComment() {
		return comment;
	}

+ 5 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxPushLogDO.java

@ -3,12 +3,16 @@ package com.yihu.jw.entity.base.wx;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2018/8/21.
 */
public class WxPushLogDO extends UuidIdentityEntity {
@Entity
@Table(name = "wx_push_log")
public class WxPushLogDO extends UuidIdentityEntity implements java.io.Serializable{
    private String wechatId;//推送类型
    private String tempName;//模板名称

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseDeptDict.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.hospital.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -11,7 +12,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "base_dept_dict")
public class BaseDeptDict extends IntegerIdentityEntity {
public class BaseDeptDict extends UuidIdentityEntity {
    private String subject;
    private String subjectName;
    private String deptCode;

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseSuperviseDataDict.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.hospital.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -11,7 +12,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "base_supervise_data_dict")
public class BaseSuperviseDataDict extends IntegerIdentityEntity {
public class BaseSuperviseDataDict extends UuidIdentityEntity {
    private String dictName;//环境名字
    private String corporation;//单位法人姓名

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseSuperviseDict.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.hospital.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -12,7 +13,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_supervise_dict")
public class BaseSuperviseDict extends IntegerIdentityEntity {
public class BaseSuperviseDict extends UuidIdentityEntity {
    private String userName ;
    private String psw ;
    private String appId ;

+ 10 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -139,14 +140,6 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
        this.endTime = endTime;
    }
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
@ -171,4 +164,13 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    public void setSourceNumber(Integer sourceNumber) {
        this.sourceNumber = sourceNumber;
    }
    
    @Column(name = "work_date")
    public String getDate() {
        return date;
    }
    
    public void setDate(String date) {
        this.date = date;
    }
}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -99,7 +100,8 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

+ 196 - 196
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java

@ -14,548 +14,548 @@ import java.util.Date;
@Entity
@Table(name = "HLW_CF01",  catalog = "model")
public class HlwCf01DO {
    private Integer CFSB;//	NUMBER(18)	N			处方识别
    private String CFHM;//	VARCHAR2(10)	Y			处方号码
    private String FPHM;//	VARCHAR2(12)	Y			发票号码
    private Integer MZXH;//	NUMBER(18)	Y			门诊序号
    private Integer CFLX;//	NUMBER(1)	N			处方类型
    private Integer BRID;//	NUMBER(18)	Y			病人ID号
    private String BRXM;//	VARCHAR2(40)	Y			病人姓名
    private Date KFRQ;//	DATE	        N			开方日期
    private Integer CFTS;//	NUMBER(2)	N			处方贴数
    private Integer KSDM;//	NUMBER(4)	Y			科室代码
    private String YSDM;//	VARCHAR2(10)	Y			医生代码
    private Date FYRQ;//	DATE	        Y			发药日期
    private Integer FYCK;//	NUMBER(2)	Y			发药窗口
    private String HJGH;//	VARCHAR2(10)	Y			划价工号
    private String PYGH;//	VARCHAR2(10)	Y			配药工号
    private String FYGH;//	VARCHAR2(10)	Y			发药工号
    private Integer PYBZ;//	NUMBER(1)	N			配药标志
    private Integer FYBZ;//	NUMBER(1)	N			发药标志
    private Integer CFGL;//	NUMBER(18)	Y			处方关联
    private Integer ZFPB;//	NUMBER(1)	N			作废判别
    private Integer DYBZ;//	NUMBER(1)	Y			打印标志
    private Integer YFSB;//	NUMBER(3)	N			药房识别
    private Integer TSCF;//	NUMBER(2)	Y			特殊处方
    private Integer TSLX;//	INTEGER	Y			特殊类型
    private Integer TYBZ;//	NUMBER(1)	Y			退药标志
    private Integer CFBZ;//	NUMBER(1)	Y			处方标志(CFBZ = 2 处方锁定)
    private Integer JZXH;//	NUMBER(18)	Y			门诊就诊
    private Integer YXPB;//	NUMBER(1)	N			优先处方
    private String JZKH;//	VARCHAR2(20)	Y			就诊卡号
    private Integer DJYBZ;//	NUMBER(1)	N			代煎药标志
    private Date ZFSJ;//	DATE	        Y			作废时间
    private String HDGH;//	VARCHAR2(10)	Y			核对工号
    private Date HDRQ;//	DATE	        Y			核对日期
    private Integer JMPB;//	NUMBER  	Y
    private Integer YJYY;//	NUMBER(2)	Y
    private String TSBZDM;//	VARCHAR2(20)	Y
    private Integer LSCFBZ;//	NUMBER(1)	Y			零散处方标志:1是、0否
    private String TYGH;//	VARCHAR2(10)	Y
    private Integer ZJFLAG;//	NUMBER(1)	Y
    private Integer ZLXZ;//	NUMBER(5)	Y
    private String ZFGH;//	VARCHAR2(10)	Y
    private String BZ;//    VARCHAR2(100)	Y
    private String SCDDH;//	VARCHAR2(50)	N			商城订单号
    private Integer SPZT;//	NUMBER(1)	Y	0		审批状态   0未审批   1通过  2不通过
    private Integer DQPB;//	NUMBER(1)	Y	0		读取判别   0未读取   1已读取
    private Date SPRQ;//	DATE	        Y			         审批通过时间
    private Integer FKZT;//	NUMBER(1)	Y	0		0 未付款  1付款
    private String SPGH;//	VARCHAR2(10)	Y			审批工号
    private String GUID;//
    private Integer cFSB;//	NUMBER(18)	N			处方识别
    private String cFHM;//	VARCHAR2(10)	Y			处方号码
    private String fPHM;//	VARCHAR2(12)	Y			发票号码
    private Integer mZXH;//	NUMBER(18)	Y			门诊序号
    private Integer cFLX;//	NUMBER(1)	N			处方类型
    private Integer bRID;//	NUMBER(18)	Y			病人ID号
    private String bRXM;//	VARCHAR2(40)	Y			病人姓名
    private Date kFRQ;//	DATE	        N			开方日期
    private Integer cFTS;//	NUMBER(2)	N			处方贴数
    private Integer kSDM;//	NUMBER(4)	Y			科室代码
    private String ySDM;//	VARCHAR2(10)	Y			医生代码
    private Date fYRQ;//	DATE	        Y			发药日期
    private Integer fYCK;//	NUMBER(2)	Y			发药窗口
    private String hJGH;//	VARCHAR2(10)	Y			划价工号
    private String pYGH;//	VARCHAR2(10)	Y			配药工号
    private String fYGH;//	VARCHAR2(10)	Y			发药工号
    private Integer pYBZ;//	NUMBER(1)	N			配药标志
    private Integer fYBZ;//	NUMBER(1)	N			发药标志
    private Integer cFGL;//	NUMBER(18)	Y			处方关联
    private Integer zFPB;//	NUMBER(1)	N			作废判别
    private Integer dYBZ;//	NUMBER(1)	Y			打印标志
    private Integer yFSB;//	NUMBER(3)	N			药房识别
    private Integer tSCF;//	NUMBER(2)	Y			特殊处方
    private Integer tSLX;//	INTEGER	Y			特殊类型
    private Integer tYBZ;//	NUMBER(1)	Y			退药标志
    private Integer cFBZ;//	NUMBER(1)	Y			处方标志(CFBZ = 2 处方锁定)
    private Integer jZXH;//	NUMBER(18)	Y			门诊就诊
    private Integer yXPB;//	NUMBER(1)	N			优先处方
    private String jZKH;//	VARCHAR2(20)	Y			就诊卡号
    private Integer dJYBZ;//	NUMBER(1)	N			代煎药标志
    private Date zFSJ;//	DATE	        Y			作废时间
    private String hDGH;//	VARCHAR2(10)	Y			核对工号
    private Date hDRQ;//	DATE	        Y			核对日期
    private Integer jMPB;//	NUMBER  	Y
    private Integer yJYY;//	NUMBER(2)	Y
    private String tSBZDM;//	VARCHAR2(20)	Y
    private Integer lSCFBZ;//	NUMBER(1)	Y			零散处方标志:1是、0否
    private String tYGH;//	VARCHAR2(10)	Y
    private Integer zJFLAG;//	NUMBER(1)	Y
    private Integer zLXZ;//	NUMBER(5)	Y
    private String zFGH;//	VARCHAR2(10)	Y
    private String bZ;//    VARCHAR2(100)	Y
    private String sCDDH;//	VARCHAR2(50)	N			商城订单号
    private Integer sPZT;//	NUMBER(1)	Y	0		审批状态   0未审批   1通过  2不通过
    private Integer dQPB;//	NUMBER(1)	Y	0		读取判别   0未读取   1已读取
    private Date sPRQ;//	DATE	        Y			         审批通过时间
    private Integer fKZT;//	NUMBER(1)	Y	0		0 未付款  1付款
    private String sPGH;//	VARCHAR2(10)	Y			审批工号
    private String gUID;//
    @Basic
    @Id
    @Column(name = "CFSB")
    public Integer getCFSB() {
        return CFSB;
        return cFSB;
    }
    public void setCFSB(Integer CFSB) {
        this.CFSB = CFSB;
    public void setCFSB(Integer cFSB) {
        this.cFSB = cFSB;
    }
    @Basic
    @Column(name = "CFHM")
    public String getCFHM() {
        return CFHM;
        return cFHM;
    }
    public void setCFHM(String CFHM) {
        this.CFHM = CFHM;
    public void setCFHM(String cFHM) {
        this.cFHM = cFHM;
    }
    @Basic
    @Column(name = "FPHM")
    public String getFPHM() {
        return FPHM;
        return fPHM;
    }
    public void setFPHM(String FPHM) {
        this.FPHM = FPHM;
    public void setFPHM(String fPHM) {
        this.fPHM = fPHM;
    }
    @Basic
    @Column(name = "MZXH")
    public Integer getMZXH() {
        return MZXH;
        return mZXH;
    }
    public void setMZXH(Integer MZXH) {
        this.MZXH = MZXH;
    public void setMZXH(Integer mZXH) {
        this.mZXH = mZXH;
    }
    @Basic
    @Column(name = "CFLX")
    public Integer getCFLX() {
        return CFLX;
        return cFLX;
    }
    public void setCFLX(Integer CFLX) {
        this.CFLX = CFLX;
    public void setCFLX(Integer cFLX) {
        this.cFLX = cFLX;
    }
    @Basic
    @Column(name = "BRID")
    public Integer getBRID() {
        return BRID;
        return bRID;
    }
    public void setBRID(Integer BRID) {
        this.BRID = BRID;
    public void setBRID(Integer bRID) {
        this.bRID = bRID;
    }
    @Basic
    @Column(name = "BRXM")
    public String getBRXM() {
        return BRXM;
        return bRXM;
    }
    public void setBRXM(String BRXM) {
        this.BRXM = BRXM;
    public void setBRXM(String bRXM) {
        this.bRXM = bRXM;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "KFRQ")
    public Date getKFRQ() {
        return KFRQ;
        return kFRQ;
    }
    public void setKFRQ(Date KFRQ) {
        this.KFRQ = KFRQ;
    public void setKFRQ(Date kFRQ) {
        this.kFRQ = kFRQ;
    }
    @Basic
    @Column(name = "CFTS")
    public Integer getCFTS() {
        return CFTS;
        return cFTS;
    }
    public void setCFTS(Integer CFTS) {
        this.CFTS = CFTS;
    public void setCFTS(Integer cFTS) {
        this.cFTS = cFTS;
    }
    @Basic
    @Column(name = "KSDM")
    public Integer getKSDM() {
        return KSDM;
        return kSDM;
    }
    public void setKSDM(Integer KSDM) {
        this.KSDM = KSDM;
    public void setKSDM(Integer kSDM) {
        this.kSDM = kSDM;
    }
    @Basic
    @Column(name = "YSDM")
    public String getYSDM() {
        return YSDM;
        return ySDM;
    }
    public void setYSDM(String YSDM) {
        this.YSDM = YSDM;
    public void setYSDM(String ySDM) {
        this.ySDM = ySDM;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "FYRQ")
    public Date getFYRQ() {
        return FYRQ;
        return fYRQ;
    }
    public void setFYRQ(Date FYRQ) {
        this.FYRQ = FYRQ;
    public void setFYRQ(Date fYRQ) {
        this.fYRQ = fYRQ;
    }
    @Basic
    @Column(name = "FYCK")
    public Integer getFYCK() {
        return FYCK;
        return fYCK;
    }
    public void setFYCK(Integer FYCK) {
        this.FYCK = FYCK;
    public void setFYCK(Integer fYCK) {
        this.fYCK = fYCK;
    }
    @Basic
    @Column(name = "HJGH")
    public String getHJGH() {
        return HJGH;
        return hJGH;
    }
    public void setHJGH(String HJGH) {
        this.HJGH = HJGH;
    public void setHJGH(String hJGH) {
        this.hJGH = hJGH;
    }
    @Basic
    @Column(name = "PYGH")
    public String getPYGH() {
        return PYGH;
        return pYGH;
    }
    public void setPYGH(String PYGH) {
        this.PYGH = PYGH;
    public void setPYGH(String pYGH) {
        this.pYGH = pYGH;
    }
    @Basic
    @Column(name = "FYGH")
    public String getFYGH() {
        return FYGH;
        return fYGH;
    }
    public void setFYGH(String FYGH) {
        this.FYGH = FYGH;
    public void setFYGH(String fYGH) {
        this.fYGH = fYGH;
    }
    @Basic
    @Column(name = "PYBZ")
    public Integer getPYBZ() {
        return PYBZ;
        return pYBZ;
    }
    public void setPYBZ(Integer PYBZ) {
        this.PYBZ = PYBZ;
    public void setPYBZ(Integer pYBZ) {
        this.pYBZ = pYBZ;
    }
    @Basic
    @Column(name = "FYBZ")
    public Integer getFYBZ() {
        return FYBZ;
        return fYBZ;
    }
    public void setFYBZ(Integer FYBZ) {
        this.FYBZ = FYBZ;
    public void setFYBZ(Integer fYBZ) {
        this.fYBZ = fYBZ;
    }
    @Basic
    @Column(name = "CFGL")
    public Integer getCFGL() {
        return CFGL;
        return cFGL;
    }
    public void setCFGL(Integer CFGL) {
        this.CFGL = CFGL;
    public void setCFGL(Integer cFGL) {
        this.cFGL = cFGL;
    }
    @Basic
    @Column(name = "ZFPB")
    public Integer getZFPB() {
        return ZFPB;
        return zFPB;
    }
    public void setZFPB(Integer ZFPB) {
        this.ZFPB = ZFPB;
    public void setZFPB(Integer zFPB) {
        this.zFPB = zFPB;
    }
    @Basic
    @Column(name = "DYBZ")
    public Integer getDYBZ() {
        return DYBZ;
        return dYBZ;
    }
    public void setDYBZ(Integer DYBZ) {
        this.DYBZ = DYBZ;
    public void setDYBZ(Integer dYBZ) {
        this.dYBZ = dYBZ;
    }
    @Basic
    @Column(name = "YFSB")
    public Integer getYFSB() {
        return YFSB;
        return yFSB;
    }
    public void setYFSB(Integer YFSB) {
        this.YFSB = YFSB;
    public void setYFSB(Integer yFSB) {
        this.yFSB = yFSB;
    }
    @Basic
    @Column(name = "TSCF")
    public Integer getTSCF() {
        return TSCF;
        return tSCF;
    }
    public void setTSCF(Integer TSCF) {
        this.TSCF = TSCF;
    public void setTSCF(Integer tSCF) {
        this.tSCF = tSCF;
    }
    @Basic
    @Column(name = "TSLX")
    public Integer getTSLX() {
        return TSLX;
        return tSLX;
    }
    public void setTSLX(Integer TSLX) {
        this.TSLX = TSLX;
    public void setTSLX(Integer tSLX) {
        this.tSLX = tSLX;
    }
    @Basic
    @Column(name = "TYBZ")
    public Integer getTYBZ() {
        return TYBZ;
        return tYBZ;
    }
    public void setTYBZ(Integer TYBZ) {
        this.TYBZ = TYBZ;
    public void setTYBZ(Integer tYBZ) {
        this.tYBZ = tYBZ;
    }
    @Basic
    @Column(name = "CFBZ")
    public Integer getCFBZ() {
        return CFBZ;
        return cFBZ;
    }
    public void setCFBZ(Integer CFBZ) {
        this.CFBZ = CFBZ;
    public void setCFBZ(Integer cFBZ) {
        this.cFBZ = cFBZ;
    }
    @Basic
    @Column(name = "JZXH")
    public Integer getJZXH() {
        return JZXH;
        return jZXH;
    }
    public void setJZXH(Integer JZXH) {
        this.JZXH = JZXH;
    public void setJZXH(Integer jZXH) {
        this.jZXH = jZXH;
    }
    @Basic
    @Column(name = "YXPB")
    public Integer getYXPB() {
        return YXPB;
        return yXPB;
    }
    public void setYXPB(Integer YXPB) {
        this.YXPB = YXPB;
    public void setYXPB(Integer yXPB) {
        this.yXPB = yXPB;
    }
    @Basic
    @Column(name = "JZKH")
    public String getJZKH() {
        return JZKH;
        return jZKH;
    }
    public void setJZKH(String JZKH) {
        this.JZKH = JZKH;
    public void setJZKH(String jZKH) {
        this.jZKH = jZKH;
    }
    @Basic
    @Column(name = "DJYBZ")
    public Integer getDJYBZ() {
        return DJYBZ;
        return dJYBZ;
    }
    public void setDJYBZ(Integer DJYBZ) {
        this.DJYBZ = DJYBZ;
    public void setDJYBZ(Integer dJYBZ) {
        this.dJYBZ = dJYBZ;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "ZFSJ")
    public Date getZFSJ() {
        return ZFSJ;
        return zFSJ;
    }
    public void setZFSJ(Date ZFSJ) {
        this.ZFSJ = ZFSJ;
    public void setZFSJ(Date zFSJ) {
        this.zFSJ = zFSJ;
    }
    @Basic
    @Column(name = "HDGH")
    public String getHDGH() {
        return HDGH;
        return hDGH;
    }
    public void setHDGH(String HDGH) {
        this.HDGH = HDGH;
    public void setHDGH(String hDGH) {
        this.hDGH = hDGH;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "HDRQ")
    public Date getHDRQ() {
        return HDRQ;
        return hDRQ;
    }
    public void setHDRQ(Date HDRQ) {
        this.HDRQ = HDRQ;
    public void setHDRQ(Date hDRQ) {
        this.hDRQ = hDRQ;
    }
    @Basic
    @Column(name = "JMPB")
    public Integer getJMPB() {
        return JMPB;
        return jMPB;
    }
    public void setJMPB(Integer JMPB) {
        this.JMPB = JMPB;
    public void setJMPB(Integer jMPB) {
        this.jMPB = jMPB;
    }
    @Basic
    @Column(name = "YJYY")
    public Integer getYJYY() {
        return YJYY;
        return yJYY;
    }
    public void setYJYY(Integer YJYY) {
        this.YJYY = YJYY;
    public void setYJYY(Integer yJYY) {
        this.yJYY = yJYY;
    }
    @Basic
    @Column(name = "TSBZDM")
    public String getTSBZDM() {
        return TSBZDM;
        return tSBZDM;
    }
    public void setTSBZDM(String TSBZDM) {
        this.TSBZDM = TSBZDM;
    public void setTSBZDM(String tSBZDM) {
        this.tSBZDM = tSBZDM;
    }
    @Basic
    @Column(name = "LSCFBZ")
    public Integer getLSCFBZ() {
        return LSCFBZ;
        return lSCFBZ;
    }
    public void setLSCFBZ(Integer LSCFBZ) {
        this.LSCFBZ = LSCFBZ;
    public void setLSCFBZ(Integer lSCFBZ) {
        this.lSCFBZ = lSCFBZ;
    }
    @Basic
    @Column(name = "TYGH")
    public String getTYGH() {
        return TYGH;
        return tYGH;
    }
    public void setTYGH(String TYGH) {
        this.TYGH = TYGH;
    public void setTYGH(String tYGH) {
        this.tYGH = tYGH;
    }
    @Basic
    @Column(name = "ZJFLAG")
    public Integer getZJFLAG() {
        return ZJFLAG;
        return zJFLAG;
    }
    public void setZJFLAG(Integer ZJFLAG) {
        this.ZJFLAG = ZJFLAG;
    public void setZJFLAG(Integer zJFLAG) {
        this.zJFLAG = zJFLAG;
    }
    @Basic
    @Column(name = "ZLXZ")
    public Integer getZLXZ() {
        return ZLXZ;
        return zLXZ;
    }
    public void setZLXZ(Integer ZLXZ) {
        this.ZLXZ = ZLXZ;
    public void setZLXZ(Integer zLXZ) {
        this.zLXZ = zLXZ;
    }
    @Basic
    @Column(name = "ZFGH")
    public String getZFGH() {
        return ZFGH;
        return zFGH;
    }
    public void setZFGH(String ZFGH) {
        this.ZFGH = ZFGH;
    public void setZFGH(String zFGH) {
        this.zFGH = zFGH;
    }
    @Basic
    @Column(name = "BZ")
    public String getBZ() {
        return BZ;
        return bZ;
    }
    public void setBZ(String BZ) {
        this.BZ = BZ;
    public void setBZ(String bZ) {
        this.bZ = bZ;
    }
    @Basic
    @Column(name = "SCDDH")
    public String getSCDDH() {
        return SCDDH;
        return sCDDH;
    }
    public void setSCDDH(String SCDDH) {
        this.SCDDH = SCDDH;
    public void setSCDDH(String sCDDH) {
        this.sCDDH = sCDDH;
    }
    @Basic
    @Column(name = "SPZT")
    public Integer getSPZT() {
        return SPZT;
        return sPZT;
    }
    public void setSPZT(Integer SPZT) {
        this.SPZT = SPZT;
    public void setSPZT(Integer sPZT) {
        this.sPZT = sPZT;
    }
    @Basic
    @Column(name = "DQPB")
    public Integer getDQPB() {
        return DQPB;
        return dQPB;
    }
    public void setDQPB(Integer DQPB) {
        this.DQPB = DQPB;
    public void setDQPB(Integer dQPB) {
        this.dQPB = dQPB;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "SPRQ")
    public Date getSPRQ() {
        return SPRQ;
        return sPRQ;
    }
    public void setSPRQ(Date SPRQ) {
        this.SPRQ = SPRQ;
    public void setSPRQ(Date sPRQ) {
        this.sPRQ = sPRQ;
    }
    @Basic
    @Column(name = "FKZT")
    public Integer getFKZT() {
        return FKZT;
        return fKZT;
    }
    public void setFKZT(Integer FKZT) {
        this.FKZT = FKZT;
    public void setFKZT(Integer fKZT) {
        this.fKZT = fKZT;
    }
    @Basic
    @Column(name = "SPGH")
    public String getSPGH() {
        return SPGH;
        return sPGH;
    }
    public void setSPGH(String SPGH) {
        this.SPGH = SPGH;
    public void setSPGH(String sPGH) {
        this.sPGH = sPGH;
    }
    @Basic
    @Column(name = "GUID")
    public String getGUID() {
        return GUID;
        return gUID;
    }
    public void setGUID(String GUID) {
        this.GUID = GUID;
    public void setGUID(String gUID) {
        this.gUID = gUID;
    }
}

+ 185 - 184
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java

@ -10,484 +10,485 @@ import java.util.Date;
 *
 * */
@Entity
@Table(name = "HLW_CF02", catalog = "model")
@Table(name = "HLW_CF02")
@SequenceGenerator(name="id_generated", sequenceName="HLW_CF02_SEQ")
public class HlwCf02DO {
    private Integer SBXH;//NUMBER(18)   N注释
    private Integer CFSB;//NUMBER(18)   N识别序号
    private Integer YPXH;//NUMBER(6)    N处方识别
    private Integer YPCD;//NUMBER(6)    N药品序号
    private Integer XMLX;//NUMBER(2)    N药品产地
    private Integer CFTS;//NUMBER(2)    N项目类型
    private Integer YPSL;//NUMBER(10,2) N处方贴数
    private Integer YPDJ;//NUMBER(12,4) N药品数量
    private Integer HJJE;//NUMBER(12,2) N药品单价
    private Integer YPZS;//INTEGER      N划价金额
    private String YCSL;//VARCHAR2(20)  N药品组数
    private Integer FYGB;//NUMBER(4)    N一次数量
    private Integer ZFBL;//NUMBER(5,3)  N费用归并
    private Integer GYTJ;//NUMBER(4)    Y自负比例
    private String YPYF;//VARCHAR2(20)  Y给药途径
    private Integer YPZH;//NUMBER(18)   Y药品用法
    private String YFGG;//VARCHAR2(20)  Y药品组号
    private String YFDW;//VARCHAR2(4)   Y药房规格
    private Integer YFBZ;//NUMBER(4)    N药房单位
    private String SJYL;//VARCHAR2(20)  Y药房包装
    private Integer PSPB;//NUMBER(1)    Y实际用量
    private Integer YYTS;//INTEGER      Y皮试判别
    private Integer YCSL2;//NUMBER(10,4)Y用药天数
    private Integer XSSL;//NUMBER(10,4) Y一次用量
    private Integer MRCS;//NUMBER(2)    N显示数量
    private String CFBZ;//VARCHAR2(40)  Y每日次数
    private Integer YCJL;//NUMBER(10,2) Y处方标志
    private Integer PSJG;//NUMBER(1)    Y一次剂量
    private Integer PLXH;//NUMBER(4)    Y皮试结果
    private Integer SYBZ;//NUMBER(1)    Y排列序号
    private Integer ZBBZ;//NUMBER(1)    Y输液标志;1 输液调入   0 或 NULL 未调入
    private Integer YDFYBZ;//NUMBER(1)  Y药店发药标志
    private Integer TYSQSL;//NUMBER(5)  Y退药申请数量
    private Date YDFYRQ;//DATE          Y药店发药人
    private String YDFYR;//VARCHAR2(20) Y药店发药日期
    private Integer CZGH;//NUMBER(8)    Y操作工号
    private Date CZRQ;//DATE            Y操作日期
    private Integer ZJFLAG;//NUMBER(1)  Y
    private Integer MBYF;//NUMBER(1)    Y
    private String BZ;//VARCHAR2(200)   Y备注
    private Integer JHJG;//NUMBER(12,4) Y进货价格
    private Integer SPZT;//NUMBER(1)    Y0审批状态        0表示未审批   1表示审批通过   2表示审批未通过
    private String THYY;//VARCHAR2(200) Y退回原因
    @Basic
    private Integer sBXH;//NUMBER(18)   N注释
    private Integer cFSB;//NUMBER(18)   N识别序号
    private Integer yPXH;//NUMBER(6)    N处方识别
    private Integer yPCD;//NUMBER(6)    N药品序号
    private Integer xMLX;//NUMBER(2)    N药品产地
    private Integer cFTS;//NUMBER(2)    N项目类型
    private Double yPSL;//NUMBER(10,2) N处方贴数
    private Double yPDJ;//NUMBER(12,4) N药品数量
    private Double hJJE;//NUMBER(12,2) N药品单价
    private Integer yPZS;//INTEGER      N划价金额
    private String yCSL;//VARCHAR2(20)  N药品组数
    private Integer fYGB;//NUMBER(4)    N一次数量
    private Double zFBL;//NUMBER(5,3)  N费用归并
    private Integer gYTJ;//NUMBER(4)    Y自负比例
    private String yPYF;//VARCHAR2(20)  Y给药途径
    private Integer yPZH;//NUMBER(18)   Y药品用法
    private String yFGG;//VARCHAR2(20)  Y药品组号
    private String yFDW;//VARCHAR2(4)   Y药房规格
    private Integer yFBZ;//NUMBER(4)    N药房单位
    private String sJYL;//VARCHAR2(20)  Y药房包装
    private Integer pSPB;//NUMBER(1)    Y实际用量
    private Integer yYTS;//INTEGER      Y皮试判别
    private Double yCSL2;//NUMBER(10,4)Y用药天数
    private Double xSSL;//NUMBER(10,4) Y一次用量
    private Integer mRCS;//NUMBER(2)    N显示数量
    private String cFBZ;//VARCHAR2(40)  Y每日次数
    private Double yCJL;//NUMBER(10,2) Y处方标志
    private Integer pSJG;//NUMBER(1)    Y一次剂量
    private Integer pLXH;//NUMBER(4)    Y皮试结果
    private Integer sYBZ;//NUMBER(1)    Y排列序号
    private Integer zBBZ;//NUMBER(1)    Y输液标志;1 输液调入   0 或 NULL 未调入
    private Integer yDFYBZ;//NUMBER(1)  Y药店发药标志
    private Integer tYSQSL;//NUMBER(5)  Y退药申请数量
    private Date yDFYRQ;//DATE          Y药店发药人
    private String yDFYR;//VARCHAR2(20) Y药店发药日期
    private Integer cZGH;//NUMBER(8)    Y操作工号
    private Date cZRQ;//DATE            Y操作日期
    private Integer zJFLAG;//NUMBER(1)  Y
    private Integer mBYF;//NUMBER(1)    Y
    private String bZ;//VARCHAR2(200)   Y备注
    private Double jHJG;//NUMBER(12,4) Y进货价格
    private Integer sPZT;//NUMBER(1)    Y0审批状态        0表示未审批   1表示审批通过   2表示审批未通过
    private String tHYY;//VARCHAR2(200) Y退回原因
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
    @Id
    @Column(name = "SBXH")
    public Integer getSBXH() {
        return SBXH;
        return sBXH;
    }
    public void setSBXH(Integer SBXH) {
        this.SBXH = SBXH;
    public void setSBXH(Integer sBXH) {
        this.sBXH = sBXH;
    }
    @Basic
    @Column(name = "CFSB")
    public Integer getCFSB() {
        return CFSB;
        return cFSB;
    }
    public void setCFSB(Integer CFSB) {
        this.CFSB = CFSB;
    public void setCFSB(Integer cFSB) {
        this.cFSB = cFSB;
    }
    @Basic
    @Column(name = "YPXH")
    public Integer getYPXH() {
        return YPXH;
        return yPXH;
    }
    public void setYPXH(Integer YPXH) {
        this.YPXH = YPXH;
    public void setYPXH(Integer yPXH) {
        this.yPXH = yPXH;
    }
    @Basic
    @Column(name = "YPCD")
    public Integer getYPCD() {
        return YPCD;
        return yPCD;
    }
    public void setYPCD(Integer YPCD) {
        this.YPCD = YPCD;
    public void setYPCD(Integer yPCD) {
        this.yPCD = yPCD;
    }
    @Basic
    @Column(name = "XMLX")
    public Integer getXMLX() {
        return XMLX;
        return xMLX;
    }
    public void setXMLX(Integer XMLX) {
        this.XMLX = XMLX;
    public void setXMLX(Integer xMLX) {
        this.xMLX = xMLX;
    }
    @Basic
    @Column(name = "CFTS")
    public Integer getCFTS() {
        return CFTS;
        return cFTS;
    }
    public void setCFTS(Integer CFTS) {
        this.CFTS = CFTS;
    public void setCFTS(Integer cFTS) {
        this.cFTS = cFTS;
    }
    @Basic
    @Column(name = "YPSL")
    public Integer getYPSL() {
        return YPSL;
    public Double getYPSL() {
        return yPSL;
    }
    public void setYPSL(Integer YPSL) {
        this.YPSL = YPSL;
    public void setYPSL(Double yPSL) {
        this.yPSL = yPSL;
    }
    @Basic
    @Column(name = "YPDJ")
    public Integer getYPDJ() {
        return YPDJ;
    public Double getYPDJ() {
        return yPDJ;
    }
    public void setYPDJ(Integer YPDJ) {
        this.YPDJ = YPDJ;
    public void setYPDJ(Double yPDJ) {
        this.yPDJ = yPDJ;
    }
    @Basic
    @Column(name = "HJJE")
    public Integer getHJJE() {
        return HJJE;
    public Double getHJJE() {
        return hJJE;
    }
    public void setHJJE(Integer HJJE) {
        this.HJJE = HJJE;
    public void setHJJE(Double hJJE) {
        this.hJJE = hJJE;
    }
    @Basic
    @Column(name = "YPZS")
    public Integer getYPZS() {
        return YPZS;
        return yPZS;
    }
    public void setYPZS(Integer YPZS) {
        this.YPZS = YPZS;
    public void setYPZS(Integer yPZS) {
        this.yPZS = yPZS;
    }
    @Basic
    @Column(name = "YCSL")
    public String getYCSL() {
        return YCSL;
        return yCSL;
    }
    public void setYCSL(String YCSL) {
        this.YCSL = YCSL;
    public void setYCSL(String yCSL) {
        this.yCSL = yCSL;
    }
    @Basic
    @Column(name = "FYGB")
    public Integer getFYGB() {
        return FYGB;
        return fYGB;
    }
    public void setFYGB(Integer FYGB) {
        this.FYGB = FYGB;
    public void setFYGB(Integer fYGB) {
        this.fYGB = fYGB;
    }
    @Basic
    @Column(name = "ZFBL")
    public Integer getZFBL() {
        return ZFBL;
    public Double getZFBL() {
        return zFBL;
    }
    public void setZFBL(Integer ZFBL) {
        this.ZFBL = ZFBL;
    public void setZFBL(Double zFBL) {
        this.zFBL = zFBL;
    }
    @Basic
    @Column(name = "GYTJ")
    public Integer getGYTJ() {
        return GYTJ;
        return gYTJ;
    }
    public void setGYTJ(Integer GYTJ) {
        this.GYTJ = GYTJ;
    public void setGYTJ(Integer gYTJ) {
        this.gYTJ = gYTJ;
    }
    @Basic
    @Column(name = "YPYF")
    public String getYPYF() {
        return YPYF;
        return yPYF;
    }
    public void setYPYF(String YPYF) {
        this.YPYF = YPYF;
    public void setYPYF(String yPYF) {
        this.yPYF = yPYF;
    }
    @Basic
    @Column(name = "YPZH")
    public Integer getYPZH() {
        return YPZH;
        return yPZH;
    }
    public void setYPZH(Integer YPZH) {
        this.YPZH = YPZH;
    public void setYPZH(Integer yPZH) {
        this.yPZH = yPZH;
    }
    @Basic
    @Column(name = "YFGG")
    public String getYFGG() {
        return YFGG;
        return yFGG;
    }
    public void setYFGG(String YFGG) {
        this.YFGG = YFGG;
    public void setYFGG(String yFGG) {
        this.yFGG = yFGG;
    }
    @Basic
    @Column(name = "YFDW")
    public String getYFDW() {
        return YFDW;
        return yFDW;
    }
    public void setYFDW(String YFDW) {
        this.YFDW = YFDW;
    public void setYFDW(String yFDW) {
        this.yFDW = yFDW;
    }
    @Basic
    @Column(name = "YFBZ")
    public Integer getYFBZ() {
        return YFBZ;
        return yFBZ;
    }
    public void setYFBZ(Integer YFBZ) {
        this.YFBZ = YFBZ;
    public void setYFBZ(Integer yFBZ) {
        this.yFBZ = yFBZ;
    }
    @Basic
    @Column(name = "SJYL")
    public String getSJYL() {
        return SJYL;
        return sJYL;
    }
    public void setSJYL(String SJYL) {
        this.SJYL = SJYL;
    public void setSJYL(String sJYL) {
        this.sJYL = sJYL;
    }
    @Basic
    @Column(name = "PSPB")
    public Integer getPSPB() {
        return PSPB;
        return pSPB;
    }
    public void setPSPB(Integer PSPB) {
        this.PSPB = PSPB;
    public void setPSPB(Integer pSPB) {
        this.pSPB = pSPB;
    }
    @Basic
    @Column(name = "YYTS")
    public Integer getYYTS() {
        return YYTS;
        return yYTS;
    }
    public void setYYTS(Integer YYTS) {
        this.YYTS = YYTS;
    public void setYYTS(Integer yYTS) {
        this.yYTS = yYTS;
    }
    @Basic
    @Column(name = "YCSL2")
    public Integer getYCSL2() {
        return YCSL2;
    public Double getYCSL2() {
        return yCSL2;
    }
    public void setYCSL2(Integer YCSL2) {
        this.YCSL2 = YCSL2;
    public void setYCSL2(Double yCSL2) {
        this.yCSL2 = yCSL2;
    }
    @Basic
    @Column(name = "XSSL")
    public Integer getXSSL() {
        return XSSL;
    public Double getXSSL() {
        return xSSL;
    }
    public void setXSSL(Integer XSSL) {
        this.XSSL = XSSL;
    public void setXSSL(Double xSSL) {
        this.xSSL = xSSL;
    }
    @Basic
    @Column(name = "MRCS")
    public Integer getMRCS() {
        return MRCS;
        return mRCS;
    }
    public void setMRCS(Integer MRCS) {
        this.MRCS = MRCS;
    public void setMRCS(Integer mRCS) {
        this.mRCS = mRCS;
    }
    @Basic
    @Column(name = "CFBZ")
    public String getCFBZ() {
        return CFBZ;
        return cFBZ;
    }
    public void setCFBZ(String CFBZ) {
        this.CFBZ = CFBZ;
    public void setCFBZ(String cFBZ) {
        this.cFBZ = cFBZ;
    }
    @Basic
    @Column(name = "YCJL")
    public Integer getYCJL() {
        return YCJL;
    public Double getYCJL() {
        return yCJL;
    }
    public void setYCJL(Integer YCJL) {
        this.YCJL = YCJL;
    public void setYCJL(Double yCJL) {
        this.yCJL = yCJL;
    }
    @Basic
    @Column(name = "PSJG")
    public Integer getPSJG() {
        return PSJG;
        return pSJG;
    }
    public void setPSJG(Integer PSJG) {
        this.PSJG = PSJG;
    public void setPSJG(Integer pSJG) {
        this.pSJG = pSJG;
    }
    @Basic
    @Column(name = "PLXH")
    public Integer getPLXH() {
        return PLXH;
        return pLXH;
    }
    public void setPLXH(Integer PLXH) {
        this.PLXH = PLXH;
    public void setPLXH(Integer pLXH) {
        this.pLXH = pLXH;
    }
    @Basic
    @Column(name = "SYBZ")
    public Integer getSYBZ() {
        return SYBZ;
        return sYBZ;
    }
    public void setSYBZ(Integer SYBZ) {
        this.SYBZ = SYBZ;
    public void setSYBZ(Integer sYBZ) {
        this.sYBZ = sYBZ;
    }
    @Basic
    @Column(name = "ZBBZ")
    public Integer getZBBZ() {
        return ZBBZ;
        return zBBZ;
    }
    public void setZBBZ(Integer ZBBZ) {
        this.ZBBZ = ZBBZ;
    public void setZBBZ(Integer zBBZ) {
        this.zBBZ = zBBZ;
    }
    @Basic
    @Column(name = "YDFYBZ")
    public Integer getYDFYBZ() {
        return YDFYBZ;
        return yDFYBZ;
    }
    public void setYDFYBZ(Integer YDFYBZ) {
        this.YDFYBZ = YDFYBZ;
    public void setYDFYBZ(Integer yDFYBZ) {
        this.yDFYBZ = yDFYBZ;
    }
    @Basic
    @Column(name = "TYSQSL")
    public Integer getTYSQSL() {
        return TYSQSL;
        return tYSQSL;
    }
    public void setTYSQSL(Integer TYSQSL) {
        this.TYSQSL = TYSQSL;
    public void setTYSQSL(Integer tYSQSL) {
        this.tYSQSL = tYSQSL;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Basic
    @Column(name = "YDFYRQ")
    public Date getYDFYRQ() {
        return YDFYRQ;
        return yDFYRQ;
    }
    public void setYDFYRQ(Date YDFYRQ) {
        this.YDFYRQ = YDFYRQ;
    public void setYDFYRQ(Date yDFYRQ) {
        this.yDFYRQ = yDFYRQ;
    }
    @Basic
    @Column(name = "YDFYR")
    public String getYDFYR() {
        return YDFYR;
        return yDFYR;
    }
    public void setYDFYR(String YDFYR) {
        this.YDFYR = YDFYR;
    public void setYDFYR(String yDFYR) {
        this.yDFYR = yDFYR;
    }
    @Basic
    @Column(name = "CZGH")
    public Integer getCZGH() {
        return CZGH;
        return cZGH;
    }
    public void setCZGH(Integer CZGH) {
        this.CZGH = CZGH;
    public void setCZGH(Integer cZGH) {
        this.cZGH = cZGH;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Basic
    @Column(name = "CZRQ")
    public Date getCZRQ() {
        return CZRQ;
        return cZRQ;
    }
    public void setCZRQ(Date CZRQ) {
        this.CZRQ = CZRQ;
    public void setCZRQ(Date cZRQ) {
        this.cZRQ = cZRQ;
    }
    @Basic
    @Column(name = "ZJFLAG")
    public Integer getZJFLAG() {
        return ZJFLAG;
        return zJFLAG;
    }
    public void setZJFLAG(Integer ZJFLAG) {
        this.ZJFLAG = ZJFLAG;
    public void setZJFLAG(Integer zJFLAG) {
        this.zJFLAG = zJFLAG;
    }
    @Basic
    @Column(name = "MBYF")
    public Integer getMBYF() {
        return MBYF;
        return mBYF;
    }
    public void setMBYF(Integer MBYF) {
        this.MBYF = MBYF;
    public void setMBYF(Integer mBYF) {
        this.mBYF = mBYF;
    }
    @Basic
    @Column(name = "BZ")
    public String getBZ() {
        return BZ;
        return bZ;
    }
    public void setBZ(String BZ) {
        this.BZ = BZ;
    public void setBZ(String bZ) {
        this.bZ = bZ;
    }
    @Basic
    @Column(name = "JHJG")
    public Integer getJHJG() {
        return JHJG;
    public Double getJHJG() {
        return jHJG;
    }
    public void setJHJG(Integer JHJG) {
        this.JHJG = JHJG;
    public void setJHJG(Double jHJG) {
        this.jHJG = jHJG;
    }
    @Basic
    @Column(name = "SPZT")
    public Integer getSPZT() {
        return SPZT;
        return sPZT;
    }
    public void setSPZT(Integer SPZT) {
        this.SPZT = SPZT;
    public void setSPZT(Integer sPZT) {
        this.sPZT = sPZT;
    }
    @Basic
    @Column(name = "THYY")
    public String getTHYY() {
        return THYY;
        return tHYY;
    }
    public void setTHYY(String THYY) {
        this.THYY = THYY;
    public void setTHYY(String tHYY) {
        this.tHYY = tHYY;
    }

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -226,6 +226,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     */
    private String evaluateStatus;
    /**
     * 付款状态0未付款1付款
     */
    private Integer payStatus;
	@Column(name = "adm_no")
    public String getAdmNo() {
@ -574,4 +579,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "pay_status")
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -55,7 +56,8 @@ public class WlyyPatientRegisterDO extends UuidIdentityEntity {
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

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

@ -228,6 +228,11 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private Double regFee;
    /**
     * 订单号
     */
    private String orderNo;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
@ -554,4 +559,13 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setRegFee(Double regFee) {
        this.regFee = regFee;
    }
    @Column(name = "order_no")
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

+ 28 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -137,6 +137,16 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
     */
    private String comm;
    /**
     * 药品产地
     */
    private String drugPlace;
    /**
     * 药房包装
     */
    private Integer packQuantity;
    @Column(name = "prescription_id")
    public String getPrescriptionId() {
@ -342,4 +352,22 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    public void setComm(String comm) {
        this.comm = comm;
    }
    @Column(name = "drug_place")
    public String getDrugPlace() {
        return drugPlace;
    }
    public void setDrugPlace(String drugPlace) {
        this.drugPlace = drugPlace;
    }
    @Column(name = "pack_quantity")
    public Integer getPackQuantity() {
        return packQuantity;
    }
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
}

+ 23 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotDeviceDictDO.java

@ -20,10 +20,10 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    private String saasId;
    @Column(name = "device_type")
    private String deviceType;//设备种类
    private String deviceType;//设备种类,iot_system_dict表的id
    @Column(name = "name")
    private String name;//设备种类名称
    private String name;//设备种类名称,iot_system_dict表的value
    @Column(name = "data_type")
    private String dataType;//测量数据种类
@ -31,6 +31,11 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    @Column(name = "data_type_name")
    private String dataTypeName;//测量数据种类名称
    @Column(name = "unit")
    private String unit;//单位
    @Column(name = "field")
    private String field;//对应字段
    @Column(name = "del")
    private Integer del;//删除标志
@ -84,4 +89,20 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public String getField() {
        return field;
    }
    public void setField(String field) {
        this.field = field;
    }
}

+ 22 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
@ -29,6 +30,10 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    private Long sort;//排序
    @Column(name = "del")
    private Integer del;//删除标志
    @Column(name = "parent_code")
    private String parentCode;
    @Transient
    private String parentName;//父类字典名称
    public String getSaasId() {
        return saasId;
@ -85,4 +90,21 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @Transient
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
}

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

@ -7,6 +7,7 @@ import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@ -16,6 +17,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_business_order_pay")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_BASE_BUSINESS_ORDER_PAY")
public class BusinessOrderDO extends IntegerIdentityEntity {
    private String patient;//居民code
@ -33,6 +35,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private Integer status;//0待支付1支付成功2支付失败3取消
    private String pcCallbackUrl;//Pc端查看当前订单的会话信息
    private String appCallbackUrl;//App端查看当前订单的会话信息
    private Integer uploadStatus;//上传状态1上传0未上传
    private Date createTime;
    private String createUser;
    private String createUserName;
@ -234,4 +237,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setAppCallbackUrl(String appCallbackUrl) {
        this.appCallbackUrl = appCallbackUrl;
    }
    @Column(name = "upload_status")
    public Integer getUploadStatus() {
        return uploadStatus;
    }
    public void setUploadStatus(Integer uploadStatus) {
        this.uploadStatus = uploadStatus;
    }
}

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderRefundDO.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@ -14,6 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_business_order_refund")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_BASE_BUSINESS_ORDER_REFUND")
public class BusinessOrderRefundDO extends IntegerIdentityEntity {
    private String patient;//居民code

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

@ -369,6 +369,341 @@ public class BaseHospitalRequestMapping {
    }
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {
        public static final String PREFIX  = "/ykyyPrescription";
        //=====================start=======================================
        /**
         * 获取门诊记录
         */
        public static final String findOutpatientList = "/findOutpatientList";
        /**
         * 查询单条门诊记录接口
         */
        public static final String findOutpatientInfo ="/findOutpatientInfo";
        /**
         * 查询单条复诊信息全部接口
         */
        public static final String findReOutpatientInfo = "/findReOutpatientInfo";
        /**
         * 获取复诊记录类别
         */
        public static final String findReOutpatientList ="/findReOutpatientList";
        /**
         * 查询患者就诊卡
         */
        public static final String findPatientCard = "/findPatientCard";
        /**
         * 判断是否可用发起门诊
         */
        public static final String checkOutpatient ="/checkOutpatient";
        /**
         * 居民发起复诊
         */
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 查询所有机构
         */
        public static final String findAllHospital ="/findAllHospital";
        /**
         * 查询机构底下部门
         */
        public static final String findDeptByHospital ="/findDeptByHospital";
        /**
         * 查询有所有已开放的科室
         */
        public static final String findDeptByKeyWord ="/findDeptByKeyWord";
        /**
         * 查询部门下医生
         */
        public static final String findDoctorByHospitalAndDept = "/findDoctorByHospitalAndDept";
        /**
         * 根据疾病名称,热门部门查询医生
         */
        public static final String findDoctorByHospitalAndDiseaseAndDept = "/findDoctorByHospitalAndDiseaseAndDept";
        /**
         * 居民关注医院
         */
        public static final String followOrgByPatient = "/followOrgByPatient";
        /**
         * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
         */
        public static final String findHotDeptAndDiseaseDict = "/findHotDeptAndDiseaseDict";
        /**
         * 挂号
         */
        public static final String registerOutPatient ="/registerOutPatient";
        /**
         * 获取ICD10诊断编码
         */
        public static final String getICD10 ="/getICD10";
        /**
         * 获取药品字典
         */
        public static final String getDrugDictionary ="/getDrugDictionary";
        /**
         * 获取用药方式
         */
        public static final String getDrugUse ="/getDrugUse";
        /**
         * 获取用药频次
         */
        public static final String getDrugFrequency="/getDrugFrequency";
        /**
         * 下诊断
         */
        public static final String makeDiagnosis="/makeDiagnosis";
        /**
         * 获取订单列表
         */
        public static final String findExpressageList="/findExpressageList";
        /**
         * 设置订单
         */
        public static final String setMailno="/setMailno";
        /**
         * 订单导出
         */
        public static final String pushListWrite="/pushListWrite";
        /**
         * 获取号别字典
         */
        public static final String findByDeptTypeCode="/findByDeptTypeCode";
        /**
         * 获取卡信息
         */
        public static final String getCardInfo="/getCardInfo";
        /**
         * 查询医生带排班
         */
        public static final String findDoctorWithWork="/findDoctorWithWork";
        /**
         * 获取具体号源
         */
        public static final String findWorkTimeInfo="/findWorkTimeInfo";
        /**
         * 获取获取医生信息
         */
        public static final String findDoctorInfo="/findDoctorInfo";
        public static final String findDoctorBaseInfo="/findDoctorBaseInfo";
        /**
         * 取消门诊
         */
        public static final String cancelOutPatient="/cancelOutPatient";
        /**
         * 居民取消原因字典
         */
        public static final String findCancelReasonList="/findCancelReasonList";
        /**
         * 獲取快速咨詢時間
         */
        public static final String findFastRegisterDate="/findFastRegisterDate";
        /**
         * 获取快速咨询时间分段
         */
        public static final String findByTimeSlot="/findByTimeSlot";
        /**
         * 获取医生列表,带当月排班状态
         */
        public static final String findDoctorWithMouthWork="/findDoctorWithMouthWork";
        /**
         * 查询某个医生某个月份排班记录
         */
        public static final String findDoctorWorkTimeByMonth="/findDoctorWorkTimeByMonth";
        /**
         * 查询排班规则
         */
        public static final String findWorkRule="/findWorkRule";
        /**
         * 保存排班规则
         */
        public static final String updateWorkRule="/updateWorkRule";
        /**
         * 排班批量保存接口
         */
        public static final String saveDoctorWorkTimeJson="/saveDoctorWorkTimeJson";
        /**
         * 获取居民基础信息
         */
        public static final String findPatientInfo = "/findPatientInfo";
        /**
         * 保存医生在线排班
         */
        public static final String saveDoctorOnlineWork = "/saveDoctorOnlineWork";
        /**
         * 删除医生在线排班
         */
        public static final String delDoctorOnlineWork = "/delDoctorOnlineWork";
        /**
         *查询医生在线排班列表
         */
        public static final String findDoctorOnlineWorkList = "/findDoctorOnlineWorkList";
        /**
         * 发起协同门诊
         */
        public static final String cooperativeOutpatient = "/cooperativeOutpatient";
        /**
         * 设置门诊医生
         */
        public static final String saveOutpatientDoctor = "/saveOutpatientDoctor";
        /**
         * 验证授权
         */
        public static final String checkOauthQRCode = "/checkOauthQRCode";
        /**
         * 全科医生协同门诊列表
         */
        public static final String findByGeneralDoctor = "/findByGeneralDoctor";
        /**
         * 全科医生首页统计信息
         */
        public static final String findGeneralDoctorInfo = "/findGeneralDoctorInfo";
        /**
         * 发送i健康系统消息
         */
        public static final String sendWlyyOutpatientMes = "/sendWlyyOutpatientMes";
        /**
         * 设置I健康消息已读
         */
        public static final String readWlyyOutpatientMes = "/readWlyyOutpatientMes";
        /**
         * 厦门I健康签约信息接口
         */
        public static final String findWlyyPatient = "/findWlyyPatient";
        /**
         *  厦门I健康获取居民身份证
         */
        public static final String findPatientListBySscOrIdCard = "/findPatientListBySscOrIdCard";
        /**
         * 获取Base64医生头像
         */
        public static final String makeBase64Qrcode = "/makeBase64Qrcode";
        //=================end=======================================
        /**
         * 原处方记录
         */
        public static final String findOriginPrescriptionList = "/getOriginPrescriptionList";
        /**
         * 获取原来处方详情
         */
        public static final String findOriginPrescription = "/getOriginPrescriptionInfo";
        /**
         * 续方记录
         */
        public static final String findPrescriptionList = "/findPrescriptionList";
        /**
         * 获取所有居民相关信息,续方信息,物流信息,药品信息
         */
        public static final String findPrescriptionInfo ="/findPrescriptionInfo";
        /**
         * 判断是否可续方
         */
        public static final String checkPrescription = "/checkPrescription";
        /**
         * 居民取消续方
         */
        public static final String cancelPrescription ="/cancelPrescription";
        //居民获取当日就诊列表
        public static final String getTodayOutpatinetList ="/getTodayOutpatinetList";
        //获取医生
        public static final String getDoctorMapping ="/getDoctorMapping";
        //获取检查检验接口
        public static final String getInspectionDictionary ="/getInspectionDictionary";
        public static final String findPrescriptionLogByPreId = "/findPrescriptionLogByPreId";
        public static final String findByPartsCode = "/findByPartsCode";
        public static final String findDictByName = "/findDictByName";
        public static final String getJcmb="/getJcmb";
        public static final String getJymb="/getJymb";
        public static final String getTcxz="/getTcxz";
        public static final String getTcChild="/getTcChild";
        public static final String getInsChild="/getInsChild";
        public static final String getDoctorPreSign ="/getDoctorPreSign";
        public static final String getDoctorIntroduction ="/getDoctorIntroduction";
        public static final String findByDict ="/findByDict";
        //根据居民CODE换取居民请求秘钥
        public static final String getPatientAccetokenByIdcard="/getPatientAccetokenByIdcard";
        //医生待办事项列表
        public static final String doctorUpcomingList = "/doctorUpcomingList";
        public static final String setRecord = "/setRecord";
        public static final String findPatientRecord = "/findPatientRecord";
        public static final String findDoctorByName = "/findDoctorByName";
        public static final String findDeptWithDoctorWorkTime = "/findDeptWithDoctorWorkTime";
        public static final String findWorkTimeRule = "/findWorkTimeRule";
        public static final String saveWorkTimeRule = "/saveWorkTimeRule";
        public static final String checkDoctorWork = "/checkDoctorWork";
        public static final String importDoctorWork = "/importDoctorWork";
    }
    /**
     * 门诊处方物流
@ -724,6 +1059,7 @@ public class BaseHospitalRequestMapping {
        public static final String getJobBySaasId ="/getJobBySaasId";
        public static final String findWorkTimeInfo="/findWorkTimeInfo";
        public static final String findLevelOneDoctorUpcoming="/findLevelOneDoctorUpcoming";
        public static final String getUpcomingByDoctor="/getUpcomingByDoctor";
    }
    /**
@ -740,5 +1076,7 @@ public class BaseHospitalRequestMapping {
    public static class WxPay extends Basic{
        public static final String wechatPay =  "/wechatPay";
        public static final String Notify =  "/notify";
        //发送微信模版消息
        public static final String sendWxTemple = "/sendWxTemple";
    }
}

+ 4 - 3
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -41,6 +41,7 @@ public class IotRequestMapping {
    public static class System{
        public static final String findDictByCode = "findDictByCode";
        public static final String createDict = "createDict";
    }
    /**
@ -144,10 +145,10 @@ public class IotRequestMapping {
     * 设备字典模块常量
     */
    public static class DeviceDict{
        public static final String api_create = "deviceDict";
        public static final String api_delete = "deviceDict";
        public static final String api_create = "createDeviceDict";
        public static final String api_delete = "deleteDeviceDict";
        public static final String api_getById = "getDeviceDictById";
        public static final String api_update = "deviceDict";
        public static final String api_update = "updateDeviceDict";
        public static final String api_queryPage = "queryDeviceDictPage";
        public static final String api_getList = "getDeviceDictList";

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java

@ -210,6 +210,9 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "医嘱", example = "模块1")
    private String advice;
    @ApiModelProperty(value = "付款状态", example = "付款状态")
    private Integer payStatus;
    public String getAdmNo() {
@ -466,4 +469,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setAdvice(String advice) {
        this.advice = advice;
    }
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

+ 22 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java

@ -143,6 +143,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "1可用 0删除", example = "模块1")
    private Integer del;
    @ApiModelProperty(value = "药品产地", example = "药品产地")
    private String drugPlace;
    @ApiModelProperty(value = "药房包装", example = "药房包装")
    private Integer packQuantity;
    private String comm;
@ -327,4 +333,20 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setComm(String comm) {
        this.comm = comm;
    }
    public String getDrugPlace() {
        return drugPlace;
    }
    public void setDrugPlace(String drugPlace) {
        this.drugPlace = drugPlace;
    }
    public Integer getPackQuantity() {
        return packQuantity;
    }
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
}

+ 12 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java

@ -292,6 +292,10 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "his-挂号费用", example = "模块1")
    private Integer hisRegisterFee;
    @ApiModelProperty(value = "订单号",example = "订单号")
    private String orderNo;
    /**
     * 处方结算状态,0为未结算,1为结算成功,默认为0
     */
@ -701,4 +705,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setInspectionVOs(List<WlyyInspectionVO> inspectionVOs) {
        this.inspectionVOs = inspectionVOs;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientLabelVO.java

@ -33,6 +33,8 @@ public class PatientLabelVO {
    private String healthAssistantName;
    @ApiModelProperty("是否被家签管理(1管理,0未管理)")
    private String isManage;
    @ApiModelProperty("专科医生签约CODE")
    private String specialCode;
    public String getCode() {
        return code;
@ -137,4 +139,12 @@ public class PatientLabelVO {
    public void setIsManage(String isManage) {
        this.isManage = isManage;
    }
    
    public String getSpecialCode() {
        return specialCode;
    }
    
    public void setSpecialCode(String specialCode) {
        this.specialCode = specialCode;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java

@ -58,6 +58,8 @@ public class PatientSignInfoVO {
    private String healthAssistant;
    @ApiModelProperty("计管师")
    private String healthAssistantName;
    @ApiModelProperty("专病签约CODE")
    private String specialCode;
    public String getRelationCode() {
        return relationCode;
@ -235,4 +237,12 @@ public class PatientSignInfoVO {
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    
    public String getSpecialCode() {
        return specialCode;
    }
    
    public void setSpecialCode(String specialCode) {
        this.specialCode = specialCode;
    }
}

+ 33 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/BeanUtils.java

@ -0,0 +1,33 @@
package com.yihu.jw.util.common;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.HashSet;
import java.util.Set;
/**
 * create by hmf on 2020/04/27
 */
public class BeanUtils {
    /**
     * @Title: getNullPropertyNames
     * @Description: 获取值为空的属性名称
     * @createdBy:byrc
     */
    public static String[] getNullPropertyNames(Object source) {
        BeanWrapper src = new BeanWrapperImpl(source);
        PropertyDescriptor[] pds = src.getPropertyDescriptors();
        Set<String> emptyNames = new HashSet<String>();
        for (PropertyDescriptor pd : pds) {
            Object srcValue = src.getPropertyValue(pd.getName());
            if (srcValue == null)
                emptyNames.add(pd.getName());
        }
        String[] result = new String[emptyNames.size()];
        return emptyNames.toArray(result);
    }
}

+ 1 - 1
common/common-util/src/main/java/com/yihu/jw/util/wechat/WeixinMessagePushUtils.java

@ -169,7 +169,7 @@ public class WeixinMessagePushUtils {
        //设置keyword1
        if(StringUtils.isNotBlank(wxtemp.getKeyword1())){
            WechatTemplateDataDO keyword1 = new WechatTemplateDataDO();
            keyword1.setValue(wxtemp.getRemark());
            keyword1.setValue(wxtemp.getKeyword1());
            keyword1.setColor("#000000");
            data.put("keyword1",keyword1);
        }

+ 4 - 0
server/svr-authentication/pom.xml

@ -111,6 +111,10 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>

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

@ -1,12 +1,14 @@
package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
@ -72,6 +74,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Value("${iHealth.user-info-uri}")
    private String iHealthUserInfoUrl;//失败重试次数
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private ClientDetailsService clientDetailsService;
@ -573,6 +578,21 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
    }
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
        List<BasePatientWechatDo> patientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,userId);
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){
            this.getJdbcTemplate().update("update base_patient_wechat p set p.openid = ? where p.patient_id= ? and p.wechat_id= ? ", openid, userId,wechatId);
        }else {
            BasePatientWechatDo basePatientWechatDo=new BasePatientWechatDo();
            basePatientWechatDo.setCreateTime(new Date());
            basePatientWechatDo.setOpenid(openid);
            basePatientWechatDo.setPatientId(userId);
            basePatientWechatDo.setWechatId(wechatId);
            basePatientWechatDao.save(basePatientWechatDo);
        }
    }
    public String getSynPath(String wxId){
        String sql = "SELECT w.syn_path AS sysPath FROM wx_wechat w WHERE w.id ='"+wxId+"'";

+ 15 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/iot/UserDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.security.dao.iot;
import com.yihu.jw.entity.base.user.UserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Dao - 后台管理员
 * Created by progr1mmer on 2018/8/20.
 */
public interface UserDao extends PagingAndSortingRepository<UserDO, String>, JpaSpecificationExecutor<UserDO> {
}

+ 117 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyIotLoginEndpoint.java

@ -0,0 +1,117 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.security.model.Captcha;
import com.yihu.jw.security.model.Oauth2Envelop;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import com.yihu.jw.security.service.UserService;
import com.yihu.jw.sms.service.IotSMSService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.exceptions.InvalidRequestException;
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
import org.springframework.security.oauth2.provider.OAuth2RequestValidator;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.util.StringUtils;
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;
/**
 * @Auther hmf
 * @Date 2020.4.24
 */
@Api(description = "物联网认证服务")
@RestController
public class WlyyIotLoginEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    private OAuth2RequestFactory oAuth2RequestFactory;
    private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
    @Autowired
    private WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
    @Autowired
    private IotSMSService iotSMSService;
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/oauth/sendIotCaptcha", method = RequestMethod.GET)
    @ApiOperation("发送短信验证码")
    public ResponseEntity<Oauth2Envelop<Captcha>> sendZSCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String mobile = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(mobile)) {
            throw new InvalidRequestException("username");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, mobile)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        String result = iotSMSService.IotSendSMS(mobile, "您好,你的手机注册短信验证码是:" + captcha + ",5分钟内有效。");
        if (result.equals("success")) {
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, mobile, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, _captcha);
            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/captchaAndRegister", method = RequestMethod.POST)
    @ApiOperation("验证短信验证码并注册")
    public ResponseEntity<Oauth2Envelop> captchaCheck(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String mobile = parameters.get("username");
        String captcha = parameters.get("captcha");
        String jsonData = parameters.get("jsonData");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(mobile)) {
            throw new InvalidRequestException("username");
        }
        if (StringUtils.isEmpty(captcha)) {
            throw new InvalidRequestException("captcha");
        }
        Oauth2Envelop<Boolean> oauth2Envelop;
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            oauth2Envelop = new Oauth2Envelop<>("注册成功", 200, true);
            //注册账号
            JSONObject jsonObject =  userService.createUser(jsonData);
            if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("msg"), ResultStatus.INVALID_GRANT, false);
            }
        } else {
            oauth2Envelop = new Oauth2Envelop<>("验证码错误", ResultStatus.INVALID_GRANT, false);
        }
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
    }
}

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

@ -31,6 +31,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +51,7 @@ import org.springframework.security.oauth2.provider.request.DefaultOAuth2Request
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.util.*;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
@ -219,11 +221,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
            baseLoginLogDO.setOpenid(openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
        }
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0

+ 170 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyYkyyEndpoint.java

@ -0,0 +1,170 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.service.YkyyService;
import io.swagger.annotations.Api;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.InvalidRequestException;
import org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.Map;
/**
 * Created by yeshijie on 2020/4/24.
 *
 * @author yeshijie.
 */
@Api(description = "眼科医院")
@RestController
public class WlyyYkyyEndpoint extends AbstractEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    private OAuth2RequestFactory oAuth2RequestFactory;
    private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
    @Autowired
    private YkyyService ykyyService;
    @Autowired
    private WlyyUserDetailsService userDetailsService;
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private ClientDetailsService clientDetailsService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private BaseLoginLogService baseLoginLogService;
    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private WlyyTokenGranter tokenGranter;
    @PostConstruct
    private void init() {
        super.setTokenGranter(tokenGranter);
    }
    /**
     * 眼科医生登录
     * @param verifyCode
     * @param client_id
     * @param login_type 用户类型 1或默认为user,2:医生登录
     * @return
     */
    @RequestMapping(value = "/oauth/ykyyDoctorLogin", method = RequestMethod.POST)
    public ObjEnvelop ykyyDoctorLogin(String verifyCode, String client_id,String login_type) {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        if (StringUtils.isEmpty(login_type)) {
            throw new InvalidRequestException("login_type is null");
        }
        try {
            logger.info("verifyCode :"+verifyCode);
            String data = ykyyService.getDoctorInfoByVerifycode(verifyCode);
            JSONObject jsonObject = JSONObject.parseObject(data);
            if(!jsonObject.getString("code").equalsIgnoreCase("10000")){
                logger.info(jsonObject.getString("message"));
                return ObjEnvelop.getError("授权登录失败!");
            }
            JSONObject value = jsonObject.getJSONObject("value");
            String doctorId = value.getString("doctorId");
            String tel = value.getString("tel");
            String idCard = value.getString("idCard");
            String loginId = value.getString("loginId");
//            String idCard = "352103197207090030";
            BaseDoctorDO doctorDO = doctorDao.findByIdcard(idCard);
            if(doctorDO == null){
                return ObjEnvelop.getError("授权登录失败!");
            }
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            Map<String, String> parameters = new HashedMap();
            parameters.put("username", idCard);
            parameters.put("grant_type", "ihealthDcotor");
            TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
            if (authenticatedClient != null) {
                oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
            }
            OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            }
            WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
            wlyyUserSimple.setAccessToken(token.getValue());
            wlyyUserSimple.setTokenType(token.getTokenType());
            wlyyUserSimple.setExpiresIn(token.getExpiresIn());
            wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
            wlyyUserSimple.setUser(parameters.get("username"));
            String loginType = parameters.get("login_type");
            BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            baseLoginLogDO.setUserId(wlyyUserSimple.getId());
            baseLoginLogDO.setCreateTime(new Date());
            String userAgent = JSONObject.toJSONString(wlyyUserSimple);
            baseLoginLogDO.setUserAgent(userAgent);
            baseLoginLogDO.setLoginType(loginType);
            baseLoginLogService.save(baseLoginLogDO);
            return ObjEnvelop.getSuccess("success",wlyyUserSimple);
        }catch (Exception e){
            logger.error(e);
        }
        return ObjEnvelop.getError("登录失败!");
    }
    @Override
    protected TokenGranter getTokenGranter() {
        return this.tokenGranter;
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.state(clientDetailsService != null, "ClientDetailsService must be provided");
        Assert.state(authenticationManager != null, "AuthenticationManager must be provided");
        oAuth2RequestFactory = new DefaultOAuth2RequestFactory(clientDetailsService);
    }
}

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWlyyConfigService.java

@ -11,7 +11,7 @@ import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.security.dao.doctor.DoctorMappingDao;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;

+ 94 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java

@ -0,0 +1,94 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.security.dao.iot.UserDao;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
 * 物联网用户注册
 *
 * @author hmf
 */
@Service
public class UserService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private UserDao userDao;
    //用手机号注册账号
    public UserDO registerWithMobile(UserDO userDO) {
        userDO.setUsername(userDO.getMobile());
        userDO.setName(userDO.getMobile());
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
        userDO.setLocked(false);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password = userDO.getMobile().substring(userDO.getMobile().length()-6, userDO.getMobile().length());
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        userDO.setCreateTime(new Date());
        userDO.setUpdateTime(new Date());
        return userDao.save(userDO);
    }
    public JSONObject createUser(String jsonData) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject user = JSONObject.parseObject(jsonData);
        //归属租户为默认租户,表示用户为超级管理员,不需要机构
        if (null == user || !user.getString("saasId").equalsIgnoreCase("2c9a80ed719a6dcb0171a5dd1d700014")) {
            result.put("msg", "parameter user or org of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //组装用户信息
        UserDO userDO = null;
        try {
            userDO = objectMapper.readValue(user.toJSONString(), UserDO.class);
        } catch (IOException e) {
            result.put("msg", "convert user jsonObject to UserDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        registerWithMobile(userDO);
        result.put("response", ConstantUtils.SUCCESS);
        return result;
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
}

+ 33 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -0,0 +1,33 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 眼科医院
 * Created by yeshijie on 2020/4/24.
 *
 * @author yeshijie.
 */
@Service
public class YkyyService {
    @Autowired
    private HttpClientUtil httpClientUtil;
    private static String yktUrl = "http://www.yanketong.com:90/";
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getDoctorInfoByVerifycode(String verifyCode){
        String url = "api/Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(yktUrl+url+"?verifyCode="+verifyCode,"GBK");
    }
}

+ 362 - 362
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/HttpClientUtil.java

@ -1,362 +1,362 @@
package com.yihu.jw.security.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Component
public class HttpClientUtil {
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @return
     */
    public  String post(String url, List<NameValuePair> params, String chatSet) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 发送get请求
     *
     * @param url     请求地址
     * @param chatSet 编码格式
     * @return
     */
    public  String get(String url, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            HttpGet httpget = new HttpGet(url);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * http调用方法,(健康之路开放平台)
     *
     * @param url
     * @param params
     * @return
     * @throws Exception
     */
    public  String httpPost(String url, Map<String, String> params) throws Exception {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();//设置请求和传输超时时间
        try {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setConfig(requestConfig);
            if (params != null && params.size() > 0) {
                List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
                    valuePairs.add(nameValuePair);
                }
                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
                httpPost.setEntity(formEntity);
            }
            CloseableHttpResponse resp = httpclient.execute(httpPost);
            try {
                HttpEntity entity = resp.getEntity();
                String respContent = EntityUtils.toString(entity, "UTF-8").trim();
                return respContent;
            } finally {
                resp.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        } finally {
            httpclient.close();
        }
    }
    /**
     * 获取加密后参数集合(健康之路开放平台)
     *
     * @param params
     * @return
     */
    public  Map<String, String> getSecretParams(Map<String, String> params, String appId, String secret) {
        String timestamp = Long.toString(System.currentTimeMillis());
        params.put("timestamp", timestamp);
        StringBuilder stringBuilder = new StringBuilder();
        // 对参数名进行字典排序  
        String[] keyArray = params.keySet().toArray(new String[0]);
        Arrays.sort(keyArray);
        // 拼接有序的参数名-值串  
        stringBuilder.append(appId);
        for (String key : keyArray) {
            stringBuilder.append(key).append(params.get(key));
        }
        String codes = stringBuilder.append(secret).toString();
        String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
        // 添加签名,并发送请求  
        params.put("appId", appId);
        params.put("sign", sign);
        return params;
    }
    public  String postBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    public  void putBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        restTemplate.put(url, formEntity, String.class);
    }
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @return
     */
    public String iotPostBody(String url, String params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @param headerMap 请求头
     * @return
     */
    public  String headerPost(String url, List<NameValuePair> params, String chatSet, Map<String,Object> headerMap) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            for(String str:headerMap.keySet()){
                httppost.addHeader(str,headerMap.get(str).toString());
            }
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    public  String get(String url, String chatSet,Map<String,Object> headerMap) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            url= url.replaceAll(" ", "%20");
            HttpGet httpget = new HttpGet(url);
            for(String str:headerMap.keySet()){
                httpget.addHeader(str,headerMap.get(str).toString());
            }
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 向指定 URL 发送POST方法的请求
     *
     * @param url
     *            发送请求的 URL带上参数
     * @param param
     *            POST参数。
     * @return 所代表远程资源的响应结果
     */
    public  String sendPost(String url, String param) {
        StringBuffer buffer = new StringBuffer();
        PrintWriter out = null;
        BufferedReader in = null;
        HttpURLConnection conn = null;
        try {
            URL realUrl = new URL(url);
            // 打开和URL之间的连接
            conn = (HttpURLConnection) realUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setUseCaches(false);
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "*/*");
            conn.setRequestProperty("connection", "Keep-Alive");
            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
            OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
            osw.write(param.toString());
            osw.flush();
            // 读取返回内容
            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
            String temp;
            while ((temp = br.readLine()) != null) {
                buffer.append(temp);
                buffer.append("\n");
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return buffer.toString();
    }
}
//package com.yihu.jw.security.utils;
//
//import com.alibaba.fastjson.JSONObject;
//import org.apache.http.HttpEntity;
//import org.apache.http.NameValuePair;
//import org.apache.http.ParseException;
//import org.apache.http.client.ClientProtocolException;
//import org.apache.http.client.config.RequestConfig;
//import org.apache.http.client.entity.UrlEncodedFormEntity;
//import org.apache.http.client.methods.CloseableHttpResponse;
//import org.apache.http.client.methods.HttpGet;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.impl.client.CloseableHttpClient;
//import org.apache.http.impl.client.HttpClients;
//import org.apache.http.message.BasicNameValuePair;
//import org.apache.http.util.EntityUtils;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Component;
//import org.springframework.web.client.RestTemplate;
//
//import java.io.*;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//import java.util.Map;
//
//@Component
//public class HttpClientUtil {
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @param chatSet 编码格式
//     * @return
//     */
//    public  String post(String url, List<NameValuePair> params, String chatSet) {
//        // 创建默认的httpClient实例.
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        // 创建httppost
//        HttpPost httppost = new HttpPost(url);
//        UrlEncodedFormEntity uefEntity;
//        try {
//            uefEntity = new UrlEncodedFormEntity(params, chatSet);
//            httppost.setEntity(uefEntity);
//            CloseableHttpResponse response = httpclient.execute(httppost);
//            try {
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (UnsupportedEncodingException e1) {
//            e1.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//
//    /**
//     * 发送get请求
//     *
//     * @param url     请求地址
//     * @param chatSet 编码格式
//     * @return
//     */
//    public  String get(String url, String chatSet) {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        try {
//            // 创建httpget.
//            HttpGet httpget = new HttpGet(url);
//            // 执行get请求.
//            CloseableHttpResponse response = httpclient.execute(httpget);
//            try {
//                // 获取响应实体
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (ParseException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//    /**
//     * http调用方法,(健康之路开放平台)
//     *
//     * @param url
//     * @param params
//     * @return
//     * @throws Exception
//     */
//    public  String httpPost(String url, Map<String, String> params) throws Exception {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();//设置请求和传输超时时间
//
//        try {
//            HttpPost httpPost = new HttpPost(url);
//            httpPost.setConfig(requestConfig);
//            if (params != null && params.size() > 0) {
//                List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
//                for (Map.Entry<String, String> entry : params.entrySet()) {
//                    NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
//                    valuePairs.add(nameValuePair);
//                }
//                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
//                httpPost.setEntity(formEntity);
//            }
//            CloseableHttpResponse resp = httpclient.execute(httpPost);
//            try {
//                HttpEntity entity = resp.getEntity();
//                String respContent = EntityUtils.toString(entity, "UTF-8").trim();
//                return respContent;
//            } finally {
//                resp.close();
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return e.getMessage();
//        } finally {
//            httpclient.close();
//        }
//    }
//
//    /**
//     * 获取加密后参数集合(健康之路开放平台)
//     *
//     * @param params
//     * @return
//     */
//    public  Map<String, String> getSecretParams(Map<String, String> params, String appId, String secret) {
//        String timestamp = Long.toString(System.currentTimeMillis());
//        params.put("timestamp", timestamp);
//        StringBuilder stringBuilder = new StringBuilder();
//
//        // 对参数名进行字典排序  
//        String[] keyArray = params.keySet().toArray(new String[0]);
//        Arrays.sort(keyArray);
//        // 拼接有序的参数名-值串  
//        stringBuilder.append(appId);
//        for (String key : keyArray) {
//            stringBuilder.append(key).append(params.get(key));
//        }
//        String codes = stringBuilder.append(secret).toString();
//        String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
//        // 添加签名,并发送请求  
//        params.put("appId", appId);
//        params.put("sign", sign);
//
//        return params;
//    }
//
//
//    public  String postBody(String url, JSONObject params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
//        String ret = restTemplate.postForObject(url, formEntity, String.class);
//        return ret;
//    }
//
//    public  void putBody(String url, JSONObject params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
//        restTemplate.put(url, formEntity, String.class);
//    }
//
//
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @return
//     */
//    public String iotPostBody(String url, String params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
//        String ret = restTemplate.postForObject(url, formEntity, String.class);
//        return ret;
//    }
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @param chatSet 编码格式
//     * @param headerMap 请求头
//     * @return
//     */
//    public  String headerPost(String url, List<NameValuePair> params, String chatSet, Map<String,Object> headerMap) {
//        // 创建默认的httpClient实例.
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        // 创建httppost
//        HttpPost httppost = new HttpPost(url);
//        UrlEncodedFormEntity uefEntity;
//        try {
//            uefEntity = new UrlEncodedFormEntity(params, chatSet);
//            httppost.setEntity(uefEntity);
//            for(String str:headerMap.keySet()){
//                httppost.addHeader(str,headerMap.get(str).toString());
//            }
//            CloseableHttpResponse response = httpclient.execute(httppost);
//            try {
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (UnsupportedEncodingException e1) {
//            e1.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//    public  String get(String url, String chatSet,Map<String,Object> headerMap) {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        try {
//            // 创建httpget.
//            url= url.replaceAll(" ", "%20");
//            HttpGet httpget = new HttpGet(url);
//            for(String str:headerMap.keySet()){
//                httpget.addHeader(str,headerMap.get(str).toString());
//            }
//            // 执行get请求.
//            CloseableHttpResponse response = httpclient.execute(httpget);
//            try {
//                // 获取响应实体
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (ParseException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//
//    /**
//     * 向指定 URL 发送POST方法的请求
//     *
//     * @param url
//     *            发送请求的 URL带上参数
//     * @param param
//     *            POST参数。
//     * @return 所代表远程资源的响应结果
//     */
//    public  String sendPost(String url, String param) {
//        StringBuffer buffer = new StringBuffer();
//        PrintWriter out = null;
//        BufferedReader in = null;
//        HttpURLConnection conn = null;
//        try {
//            URL realUrl = new URL(url);
//            // 打开和URL之间的连接
//            conn = (HttpURLConnection) realUrl.openConnection();
//            conn.setRequestMethod("POST");
//            conn.setDoOutput(true);
//            conn.setDoInput(true);
//            conn.setUseCaches(false);
//            conn.setRequestProperty("Content-Type", "application/json");
//            conn.setRequestProperty("accept", "*/*");
//            conn.setRequestProperty("connection", "Keep-Alive");
//            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//            OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
//            osw.write(param.toString());
//            osw.flush();
//
//            // 读取返回内容
//            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
//            String temp;
//            while ((temp = br.readLine()) != null) {
//                buffer.append(temp);
//                buffer.append("\n");
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            try {
//                if (out != null) {
//                    out.close();
//                }
//                if (in != null) {
//                    in.close();
//                }
//            } catch (IOException ex) {
//                ex.printStackTrace();
//            }
//        }
//        return buffer.toString();
//    }
//}

+ 37 - 0
server/svr-authentication/src/main/resources/application.yml

@ -92,6 +92,41 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwOracleTest
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@172.26.0.141:1521:helowin
    username: normal
    password: normal
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
#  datasource:
#    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
#    username: root
#    password: jkzlehr
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
  ##发现服务
## i健康用户信息接口,开放出来给互联网医院登录同步用户信息用
iHealth:
  user-info-uri: http://ehr.yihu.com/wlyy/iHealth/userInfo
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: iottest
@ -111,6 +146,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0

+ 7 - 0
server/svr-authentication/src/main/resources/bootstrap.yml

@ -22,6 +22,13 @@ spring:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwOracleTest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: iottest
  cloud:

+ 6 - 1
svr/svr-base/pom.xml

@ -191,7 +191,12 @@
            <scope>compile</scope>
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>

+ 41 - 0
svr/svr-base/src/main/resources/application.yml

@ -243,6 +243,47 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwOracleTest
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@172.26.0.141:1521:helowin
    username: normal
    password: normal
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream

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

@ -2,12 +2,17 @@ package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import com.yihu.jw.entity.hospital.prescription.HlwCf02DO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -18,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
@ -32,6 +39,14 @@ public class YkyyController extends EnvelopRestEndpoint {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private ObjectMapper objectMapper;
    
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private ImService imService;
    
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
@ -65,4 +80,24 @@ public class YkyyController extends EnvelopRestEndpoint {
        return success(envelop);
    }
    
    @GetMapping(value = "/getUpcomingByDoctor")
    @ApiOperation(value = "获取医生待办详情")
    public Envelop getUpcomingByDoctor(@ApiParam(name = "doctorIdcard", value = "doctorIdcard", required = true)
                                           @RequestParam(value = "doctorIdcard",required = true)String doctorIdcard){
        JSONObject result = new JSONObject();
        List<BaseDoctorDO> doctors = baseDoctorDao.findByIdcard(doctorIdcard);
        BaseDoctorDO doctor = new BaseDoctorDO();
        if(!doctors.isEmpty()){
            doctor = doctors.get(0);
        }else{
            return success("该身份证无法找到医生",-1);
        }
        //专家咨询
        result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        return success("请求成功",result);
    }
    
    
}

+ 42 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java

@ -0,0 +1,42 @@
package com.yihu.jw.job.ykyy;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.wechat.service.WxTemplateService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 定时查询HIS的01表中的审方状态,如果已审方,且未结算,则推送一条模板消息给居民,让居民进行支付结算。
 * Created by yeshijie on 2020/4/26.
 *
 * @author yeshijie.
 */
public class UnSettledHISPrescriptionJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UnSettledHISPrescriptionJob.class);
    @Autowired
    private WxTemplateService wxTemplateService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========UnSettledHISPrescriptionJob========");
        try {
            wxTemplateService.unSettledHISPrescription();
            logger.info("END========UnSettledHISPrescriptionJob 执行结束========");
        }catch (Exception e){
            e.printStackTrace();
            logger.error("END===ERROE===UnSettledHISPrescriptionJob,message:"+e.getMessage());
        }
    }
}

+ 30 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -7,11 +7,13 @@ import com.yihu.jw.internet.service.InternetCommonService;
import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
import com.yihu.jw.job.*;
import com.yihu.jw.job.ykyy.UnSettledHISPrescriptionJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.LoggerFactory;
@ -53,6 +55,8 @@ public class JobController extends BaseController {
    @Autowired
    private InternetCommonService internetCommonService;
    @Autowired
    private WxTemplateService wxTemplateService;
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
@ -60,6 +64,21 @@ public class JobController extends BaseController {
        this.quartzHelper = quartzHelper;
    }
    /**
     * 测试方法
     * @return
     */
    @RequestMapping(value = "unSettledHISPrescription", method = RequestMethod.GET)
    public String unSettledHISPrescription() {
        try {
            wxTemplateService.unSettledHISPrescription();
            return success("成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "removeJob", method = RequestMethod.GET)
    public String removeJob(String taskId) {
@ -145,6 +164,17 @@ public class JobController extends BaseController {
                        logger.info("data_common_upload_job  job exist");
                    }
                    break;
                case "unsettled_prescription_notice_job" :
                    //互联网医院 待结算消息推送
                    if (!quartzHelper.isExistJob("unsettled_prescription_notice_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("unsettled_prescription_notice_job");
                        quartzHelper.addJob(UnSettledHISPrescriptionJob.class, trigger, "unsettled_prescription_notice_job", new HashMap<String, Object>());
                        logger.info("unsettled_prescription_notice_job  job success");
                    } else {
                        logger.info("unsettled_prescription_notice_job  job exist");
                    }
                    break;
                default :
            }

+ 2 - 2
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -155,7 +155,7 @@ fastDFS:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
@ -192,7 +192,7 @@ fastDFS:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---

+ 2 - 1
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -11,7 +11,8 @@ data_upload_job=0 0 2 * * ?
#-------------------------中山医院end-----------------------------#
#-------------------------眼科医院-----------------------------#
data_ykupload_job=0 0 0 * * ?
#每间隔1分钟触发
unsettled_prescription_notice_job=0 */1 * * * ?
#-------------------------眼科医院end-----------------------------#
#-------------------------监管平台通用医院-----------------------------#
data_common_upload_job=0 0 0 * * ?

+ 8 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/MultipleCode/MultipleCoderController.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.service.MultipleCode.MultipleCodeService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -17,6 +18,7 @@ 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.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -50,18 +52,19 @@ public class MultipleCoderController extends EnvelopRestEndpoint {
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Value("${wechat.id}")
    private String wechatId;
    /**
     *  多码融合-获取健康卡
     * @param patientId 居民id
     * @param wechatId 微信id
     * @return
     */
    @GetMapping(value = BaseRequestMapping.ThirdInterface.selectHealthIdCard)
    @ApiOperation(value = "多码融合-获取健康卡")
    public MixEnvelop getE_healthCard(@ApiParam(name = "patientId", value = "居民id")
                               @RequestParam(value = "patientId",required = true) String patientId,
                                      @ApiParam(name = "wechatId", value = "微信id")
                               @RequestParam(value = "wechatId",required = true) String wechatId){
                               @RequestParam(value = "patientId",required = true) String patientId){
        try {
@ -103,8 +106,8 @@ public class MultipleCoderController extends EnvelopRestEndpoint {
//                    无openID
                        return  MixEnvelop.getError("获取注册链接失败",-1);
                    }
            } else {
//                注册成功 返回空
                return MixEnvelop.getSuccess("注册成功",null);
            }

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

@ -34,11 +34,13 @@ import org.apache.commons.lang3.StringUtils;
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.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ -83,6 +85,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public BasePatientDao basePatientDao;
	@Autowired
	private WxTemplateService wxTemplateService;
	
	@Value("${wechat.id}")
	private String wxId;
	
	
@ -173,18 +178,21 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			JSONObject result = new JSONObject();
			synchronized (outpatientCode.intern()){
				
				//1.调用挂号接口
				logger.info("调用挂号接口====START");
				net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
				String rsCode = (String)res.get("@RESULT");
				if("0".equals(rsCode)||"-2".equals(rsCode)){
					//挂号成功,已经挂号
				}else{
					String mes = (String)res.get("@MSG");
					failed(mes);
				if(!"xm_ykyy_wx".equals(wxId)){//中山医院-心脏中心需要挂号
					//1.调用挂号接口
					logger.info("调用挂号接口====START");
					net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
					
					String rsCode = (String)res.get("@RESULT");
					if("0".equals(rsCode)||"-2".equals(rsCode)){
						//挂号成功,已经挂号
					}else{
						String mes = (String)res.get("@MSG");
						failed(mes);
					}
					logger.info("调用挂号接口====END");
				}
				logger.info("调用挂号接口====END");
				
				
				//2.
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type);
@ -364,52 +372,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
				
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -417,7 +389,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	
@ -614,71 +586,24 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		List<Map<String,Object>>  data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
			for (Map<String,Object> consult : data) {
				
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctor);
				if(hospitalDOs!=null&&hospitalDOs.size()>0){
					json.put("hospital",hospitalDOs.get(0));
//					BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
//					rs.put("winNo",org.getWinNo());
//					json.put("deptName",hospitalDOs.get(0).getDeptName());
//					json.put("dept",hospitalDOs.get(0).getDeptCode());
					consult.put("hospital",hospitalDOs.get(0));
				}else{
					json.put("hospital",null);
//					json.put("winNo",null);
//					json.put("deptName",null);
//					json.put("dept",null);
					consult.put("hospital",null);
				}
				
				//医生职称
				json.put("jobTitleName", consult.getJobTitleName());
				//医生名称
				json.put("doctorName", consult.getDoctorName());
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -686,7 +611,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	

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

@ -8,10 +8,12 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.im.ConsultVO;
@ -86,6 +88,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	FileUploadService fileUploadService;
	@Autowired
	private BusinessOrderService businessOrderService;
	
	public FileUtil fileUtil;
	
@ -100,6 +105,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	@Value("${qywx.id}")
	private String qywxId;
	@Value("${wechat.id}")
	private String wxId;
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
@ -114,15 +122,16 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@RequestParam(value = "type",required = true) String type,
								@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
								@RequestParam(value = "status",required = false) Integer status,
								@ApiParam(name = "payStatus", value = "支付状态0支付1已支付")
								@RequestParam(value = "payStatus",required = false) Integer payStatus,
								@ApiParam(name = "page", value = "第几页")
								@RequestParam(value = "page",required = false) int page,
								@ApiParam(name = "pagesize", value = "分页大小")
								@RequestParam(value = "pagesize",required = false) int pagesize
								)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status);
		List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus);
		
		if (data != null) {
		/*if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
@ -152,13 +161,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				
				array.add(json);
			}
		}
		}*/
		
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	
@ -412,9 +421,34 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			hospitalSystemMessageService.saveMessage(systemMessageDO);
			BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			
			try {
				//眼科支付订单
				if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
					BusinessOrderDO businessOrderDO = new BusinessOrderDO();
					businessOrderDO.setDoctor(doctor);
					businessOrderDO.setPatient(patient);
					businessOrderDO.setPatientName(re.getString("patientName"));
					businessOrderDO.setDescription("专家咨询费");
					businessOrderDO.setOrderCategory("1");
					if (type==1){
						businessOrderDO.setOrderType(1);
						businessOrderDO.setRelationCode(re.getString("consult"));
						businessOrderDO.setRelationName("新增专家咨询");
					}else if (type==17){
						businessOrderDO.setOrderType(3);
						businessOrderDO.setRelationCode(re.getString("consult"));
						businessOrderDO.setRelationName("新增专家咨询");
					}
					businessOrderService.saveOrder(businessOrderDO);
				}
			}catch (Exception e){
			    logger.info("支付订单失败:"+e.getMessage());
			}
			//发送企业号推送
			try{
				

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 96 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java


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

@ -8,12 +8,17 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WxUrlConfigService;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -21,14 +26,17 @@ import org.apache.axis.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
 * @author zmk
@ -41,6 +49,8 @@ import java.util.Map;
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(PatientNoLoginEndPoint.class);
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
@ -54,6 +64,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
@ -213,4 +230,75 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
        return success("请求成功",result);
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.getUpcomingByDoctor)
    @ApiOperation(value = "获取医生待办详情", notes = "获取医生待办详情")
    public Envelop getUpcomingByDoctor(@ApiParam(name = "doctorIdcard", value = "doctorIdcard", required = true)
                                       @RequestParam(value = "doctorIdcard",required = true)String doctorIdcard){
        JSONObject result = new JSONObject();
        List<BaseDoctorDO> doctors = baseDoctorService.findDoctorsByIdcard(doctorIdcard);
        BaseDoctorDO doctor = new BaseDoctorDO();
        if(!doctors.isEmpty()){
            doctor = doctors.get(0);
        }else{
            return success("该身份证无法找到医生",-1);
        }
        //专家咨询
        if("412821198807284025".equals(doctorIdcard)){//测试用写死的数据
            result.put("zxCount",2);//咨询数量
            result.put("fzCount",4);//图文复诊数量
        }else{
            result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));//咨询数量
            result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        }
        return success("请求成功",result);
    }
    /**
     * 获取微信openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
        if(!StringUtils.isEmpty(openid)){
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
    }
    /**
     * 微信支付异步回调
     * @param request
     * @param response
     * @return
     * @throws IOException
     */
    @ResponseBody
    @ApiOperation("微信支付结果通知")
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String result = "";
        String inputLine;
        while ((inputLine = request.getReader().readLine()) != null) {
            result += inputLine;
        }
        request.getReader().close();
        Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
        return map;
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
@ -953,72 +954,32 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
    
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<ConsultVO> data = imService.doctorUpcomingList(doctorCode, type);
        List<Map<String,Object>>  data = imService.doctorUpcomingList(doctorCode, type);
    
        if (data != null) {
            for (ConsultVO consult : data) {
                if (consult == null) {
                    continue;
                }
                com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
                json.put("id", consult.getId());
                // 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
                json.put("type", consult.getType());
//
//                //如果是协同门诊,多返回全科医生的详细信息
//                if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
//                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
//                    json.put("generalDoctorName", baseDoctorDO.getName());
//                }
            
                // 设置显示标题
                json.put("title", consult.getTitle());
                // 设置主诉
                json.put("symptoms", consult.getSymptoms());
                // 咨询状态
                json.put("status", consult.getStatus());
                // 设置咨询日期
                json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
                //是否评价
                json.put("evaluate", consult.getEvaluate());
            
                //患者ID
                json.put("patientId", consult.getPatientId());
                //患者性别
                json.put("patientsex", consult.getPatientsex());
                //患者姓名
                json.put("patientName", consult.getPatientName());
                //患者年龄
                json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
                //就诊记录ID
                json.put("outpatientId", consult.getOutpatientid());
                //就诊记录状态
                json.put("outpatientstatus", consult.getOutpatientstatus());
                // 设置咨询日期
                json.put("registerDate", DateUtil.dateToStrLong(consult.getRegisterDate()));
                //图文或者视频类型
                json.put("consultType", consult.getConsultType());
                //诊断
                json.put("icd10Name", consult.getIcd10Name());
            for (Map<String,Object> consult : data) {
                
                Integer consultType =  Integer.parseInt((String)consult.get("type"));
                
                if("1,15".equals(type)){//专家咨询
                    if(1 == consult.getType()){//专家咨询
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getDoctorCode()+"_1");
                    }else if(15 == consult.getType()){//家医求助
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getGeneralDoctor()+"_"+ consult.getDoctorCode()+"_15");
                if("1,15".equals(consultType)){//专家咨询
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("doctorCode").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("generalDoctor").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else{}
                }else if("9".equals(type)){//图文复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_9");
                    json.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_16");
                    json.put("type",type);
                }else if("9".equals(consultType)){//图文复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_9");
                    consult.put("type",consultType);
                }else if("16".equals(consultType)){//视频复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientid").toString()+"_16");
                    consult.put("type",consultType);
                }else if("12".equals(type)){//协同门诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_12");
                    json.put("type",type);
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_12");
                    consult.put("type",consultType);
                }else{}
            
                array.add(json);
                array.add(consult);
            }
        }
        return success(array);

+ 149 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -0,0 +1,149 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/16
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.YkyyPrescription.PREFIX)
@Api(value = "眼科医院在线复诊", description = "眼科医院在线复诊接口", tags = {"眼科医院在线复诊接口"})
public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private YkyyPrescriptionService prescriptionService;
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private InspectionService inspectionService;
    @Autowired
    private DoctorPreSignService doctorPreSignService;
    
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    private WorkTimeService workTimeService;
    
    @Autowired
    private ImService imService;
    
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @PostMapping(value = BaseHospitalRequestMapping.YkyyPrescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                         @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                         @ApiParam(name = "expressageJson", value = "居民物流json")
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                         @ApiParam(name = "registerJson", value = "预约时间")
                                         @RequestParam(value = "registerJson", required = false)String registerJson,
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
       /* //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送IM消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        }*/
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugDictionary)
    @ApiOperation(value = "获取药品字典", notes = "获取药品字典")
    public ListEnvelop getDrugDictionary(@ApiParam(name = "drugNo", value = "药品编码")
                                         @RequestParam(value = "drugNo", required = false)String drugNo,
                                         @ApiParam(name = "pyKey", value = "拼音关键字")
                                         @RequestParam(value = "pyKey", required = false)String pyKey,
                                         @ApiParam(name = "winNo", value = "分部编码")
                                         @RequestParam(value = "winNo", required = false)String winNo,
                                         @ApiParam(name = "groupNo", value = "药房编码")
                                         @RequestParam(value = "groupNo", required = false)String groupNo)throws Exception {
        return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugUse)
    @ApiOperation(value = "获取用法", notes = "获取用法")
    public ListEnvelop getDrugUse(@ApiParam(name = "pyKey", value = "拼音关键字")
                                  @RequestParam(value = "pyKey", required = false)String pyKey,
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        return success(prescriptionService.getDrugUse(drugNo,pyKey));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency());
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInspectionDictionary)
    @ApiOperation(value = "获取检查检验", notes = "获取检查检验")
    public ListEnvelop getInspectionDictionary(@ApiParam(name = "pyKey", value = "拼音码")
                                               @RequestParam(value = "pyKey", required = false)String pyKey,
                                               @ApiParam(name = "winNo", value = "6总部7金榜8夏禾")
                                               @RequestParam(value = "winNo", required = false)String winNo,
                                               @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
    }
}

+ 50 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -5,11 +5,13 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -38,6 +40,10 @@ public class YkyyController extends EnvelopRestEndpoint {
    private String wxId;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private WxTemplateService wxTemplateService;
    @GetMapping(value = "/selectCardList")
@ -264,7 +270,48 @@ public class YkyyController extends EnvelopRestEndpoint {
    }
    /**
     *
     * his同步数据
     * @param code
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "ceshi", method = RequestMethod.POST)
    @ApiOperation("his同步数据")
    public ObjEnvelop findByRealOrder(
            @ApiParam(name = "code", value = "code", required = true)
            @RequestParam(required = true)String code) throws Exception {
        try {
            ykyyEntranceService.findByRealOrder(code);
            return ObjEnvelop.getSuccess("ok","");
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    @ResponseBody
    @ApiOperation("发送微信模版消息")
    @RequestMapping(value = BaseHospitalRequestMapping.WxPay.sendWxTemple, method = {RequestMethod.GET, RequestMethod.POST})
    public Envelop sendWxTemple(@ApiParam(name = "userName", value = "居民名称")
                                              @RequestParam(value = "userName", required = false,defaultValue = "") String userName,
                                          @ApiParam(name = "senderName", value = "发送人名称")
                                              @RequestParam(value = "senderName", required = false,defaultValue = "") String senderName,
                                          @ApiParam(name = "idCard", value = "身份证")
                                              @RequestParam(value = "idCard", required = false,defaultValue = "") String idCard,
                                          @ApiParam(name = "phone", value = "居民手机")
                                              @RequestParam(value = "phone", required = false,defaultValue = "") String phone,
                                          @ApiParam(name = "title", value = "标题")
                                              @RequestParam(value = "title", required = false,defaultValue = "") String title,
                                          @ApiParam(name = "content", value = "简介")
                                              @RequestParam(value = "content", required = false,defaultValue = "") String content,
                                          @ApiParam(name = "contentString", value = "回复内容")
                                              @RequestParam(value = "contentString", required = false,defaultValue = "") String contentString,
                                          @ApiParam(name = "url", value = "跳转URL")
                                              @RequestParam(value = "url", required = false,defaultValue = "") String url
    )throws Exception  {
        wxTemplateService.sendWxTemple(userName,senderName,idCard,phone,title,content,contentString,url);
        return success("操作成功");
    }
}

+ 39 - 15
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/MultipleCode/MultipleCodeService.java

@ -8,16 +8,19 @@ import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -42,18 +45,18 @@ public class MultipleCodeService {
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private YkyyService ykyyService;
    public MixEnvelop mcfRegister(BasePatientDO patientDO, String wechatId) throws Exception {
        BasePatientWechatDo patientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientDO.getId()).get(0);
        WxWechatDO wechatDO = wechatDao.findById(wxId);
        WxWechatDO wechatDO = wechatDao.findById(wechatId);
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("mcf_config");
        TransResponse re= new TransResponse();
        try {
@ -97,7 +100,7 @@ public class MultipleCodeService {
    }
//     根据openId、 accountId查询三码融合码信息
    public MixEnvelop mcfOpenquery(String patientId,String wechatId) throws Exception {
        WxWechatDO wechatDO = wechatDao.findByAppId(wxId);
        WxWechatDO wechatDO = wechatDao.findByAppId(wechatId);
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        if (patientDO!=null){
            BasePatientWechatDo patientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientDO.getId()).get(0);
@ -118,7 +121,7 @@ public class MultipleCodeService {
                EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl()+"ehcService/gateway.do", oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
                TransResponse re = ehcHandler.execute(request);
                JSONObject jsonObject = new JSONObject();
                if ((JSONObject.parseObject(re.getRet_code()).toJSONString()).equalsIgnoreCase("0000")){
                if (re.getRet_code().equalsIgnoreCase("0000")){
                    patientDO.setRegister("1");
                    String idCard = JSONObject.parseObject(re.getBiz_content()).getString("id_no");
                    if (idCard!=null)
@ -223,39 +226,42 @@ public class MultipleCodeService {
        TransResponse re = ehcHandler.execute(request);
        JSONObject jsonObject = new JSONObject();
        if (re.getRet_code().equalsIgnoreCase("0000")){
            JSONObject object = JSONObject.parseObject(re.getBiz_content());
            patientDO.setRegister("1");
            String idCard = JSONObject.parseObject(re.getBiz_content()).getString("id_no");
            String idCard =object.getString("id_no");
            if (idCard!=null)
            {
                patientDO.setIdcard(idCard);
            }
            String userName = JSONObject.parseObject(re.getBiz_content()).getString("user_name");
            String userName = object.getString("user_name");
            if (userName!=null)
            {
                patientDO.setName(userName);
            }
            String userSex = JSONObject.parseObject(re.getBiz_content()).getString("user_sex");
            String userSex = object.getString("user_sex");
            if (userSex!=null){
                patientDO.setSex(Integer.valueOf(userName));
                patientDO.setSex(Integer.valueOf(userSex));
            }
            String mobilePhone = JSONObject.parseObject(re.getBiz_content()).getString("mobile_phone");
            String mobilePhone = object.getString("mobile_phone");
            if (mobilePhone!=null){
                patientDO.setMobile(mobilePhone);
            }
            String birthday = JSONObject.parseObject(re.getBiz_content()).getString("birthday");
            String birthday = object.getString("birthday");
            if (birthday!=null){
                patientDO.setBirthday(DateUtil.strToDate(birthday));
            }
            String telephone = JSONObject.parseObject(re.getBiz_content()).getString("telephone");
            String telephone = object.getString("telephone");
            if (telephone!=null){
                patientDO.setPhone(telephone);
            }
            String address = JSONObject.parseObject(re.getBiz_content()).getString("address");
            String address = object.getString("address");
            if (address!=null){
                patientDO.setAddress(address);
            }
            basePatientDao.save(patientDO);
            jsonObject.put("register","1");
            jsonObject.put("register",patientDO.getRegister());
            String cardType = object.getString("card_type");
            String cardNo =object.getString("card_no");
            String ehealthCardId = JSONObject.parseObject(re.getBiz_content()).getString("ehealth_card_id");
            WlyyHttpLogDO logDO = new WlyyHttpLogDO();
            logDO.setCode("ehc.ehealthcard.getCodeUr");
@ -271,6 +277,24 @@ public class MultipleCodeService {
                jsonObject.put("codeUrl",codeUrl);
                return codeUrl;
            }
            if (cardType.equalsIgnoreCase("01")){
                if (StringUtils.isNoneBlank(patientDO.getUserId())){
                    String patientId = patientDO.getId();
                    String userId = patientDO.getUserId();
                    ykyyService.addYkCard(patientId,cardNo,userId,"0");
                }else {
                    String mobile = patientDO.getMobile();
                    String response = ykyyService.getUserId(mobile);
                    JSONObject jsonObject1 = JSONObject.parseObject(response);
                    String userId = "";
                    String patientId = patientDO.getId();
                    if (jsonObject1.getString("code").equalsIgnoreCase("200")){
                        JSONObject data = jsonObject1.getJSONObject("data");
                        userId = data.getString("USER_ID");
                    }
                    ykyyService.addYkCard(patientId,cardNo,userId,"0");
                }
            }
        }

+ 2 - 2
svr/svr-internet-hospital/src/main/resources/application.yml

@ -414,8 +414,8 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
    host: 192.168.33.198 # Redis server host.
    port: 6380 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:

+ 18 - 13
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -1,22 +1,16 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -29,22 +23,33 @@ public class IotSystemDictController extends EnvelopRestEndpoint {
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    public MixEnvelop<IotSystemDictVO, IotSystemDictVO> getList(
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        try {
            List<IotSystemDictDO> doList = iotSystemDictDao.findByDictName(dictName);
            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,voList);
            List<IotSystemDictDO> doList = iotSystemDictService.getListByDictName(dictName);
//            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = IotRequestMapping.System.createDict)
    @ApiOperation(value = "创建字典", notes = "创建字典")
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> create(@ApiParam(name = "jsonData", value = "字典json", defaultValue = "{\"value\":\"血糖仪\", \"dictName\":\"DEVICE_TYPE\"}")
                                                       @RequestParam String jsonData) {
        try {
//            List<IotSystemDictDO> dictDOList = new ObjectMapper().readValue(jsonData, new TypeReference<List<IotSystemDictDO>>(){});
            IotSystemDictDO dictDO = toEntity(jsonData, IotSystemDictDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotSystemDictService.create(dictDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 15 - 4
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java

@ -9,10 +9,7 @@ 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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -43,4 +40,18 @@ public class IotDeviceDictController extends EnvelopRestEndpoint {
        List<IotDeviceDictDO> iotDeviceDicts = convertToModels(list, new ArrayList<>(list.size()), IotDeviceDictDO.class, fields);
        return MixEnvelop.getSuccessList(IotRequestMapping.DeviceDict.message_success_find_functions,iotDeviceDicts);
    }
    @PostMapping(value = IotRequestMapping.DeviceDict.api_create)
    @ApiOperation(value = "创建编辑设备字典")
    public MixEnvelop create(
            @ApiParam(name = "jsonData", value = "设备体征字典json数据")
            @RequestParam(value = "jsonData", required = false) String jsonData){
        try {
            IotDeviceDictDO dictDO = toEntity(jsonData, IotDeviceDictDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotDeviceDictService.create(dictDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotDeviceDictDao.java

@ -11,6 +11,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotDeviceDictDao extends PagingAndSortingRepository<IotDeviceDictDO,String>,
        JpaSpecificationExecutor<IotDeviceDictDO> {
    @Query("from IotDeviceDictDO w where w.id =?1")
    @Query("from IotDeviceDictDO w where w.id =?1 and w.del = 1")
    IotDeviceDictDO findById(String id);
}

+ 6 - 2
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java

@ -13,7 +13,11 @@ import java.util.List;
public interface IotSystemDictDao extends PagingAndSortingRepository<IotSystemDictDO,String>,
        JpaSpecificationExecutor<IotSystemDictDO> {
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY sort")
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.parentCode,sort")
    List<IotSystemDictDO> findByDictName(String dictName);
    
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.code desc ")
    List<IotSystemDictDO> getAllByDictNameAndOrderByCodeDesc(String dictName);
    IotSystemDictDO findByDictNameAndCodeAndDel(String dictName, String code, Integer del);
}

+ 28 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotDeviceDictService.java

@ -3,9 +3,15 @@ package com.yihu.iot.service.dict;
import com.yihu.iot.dao.dict.IotDeviceDictDao;
import com.yihu.jw.entity.iot.dict.IotDeviceDictDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
/**
 * @author yeshijie on 2017/12/8.
 */
@ -19,4 +25,26 @@ public class IotDeviceDictService extends BaseJpaService<IotDeviceDictDO,IotDevi
        return iotDeviceDictDao.findById(id);
    }
    /**
     * 新增或编辑体征字典
     * @param dictDO
     * @return
     */
    public IotDeviceDictDO create(IotDeviceDictDO dictDO) {
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getId())){
            IotDeviceDictDO oldDictDO = iotDeviceDictDao.findById(dictDO.getId());
            BeanUtils.copyProperties(dictDO, oldDictDO, getNullPropertyNames(dictDO));
            oldDictDO.setUpdateTime(new Date());
            iotDeviceDictDao.save(oldDictDO);
            return oldDictDO;
        }else {
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
            iotDeviceDictDao.save(dictDO);
            return dictDO;
        }
    }
}

+ 42 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -5,9 +5,11 @@ import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -39,6 +41,45 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
    }
    public IotSystemDictDO create(IotSystemDictDO dictDO) {
        String value = dictDO.getValue();
        String parentCode = dictDO.getParentCode();
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getCode())){
            dictDO = iotSystemDictDao.findByDictNameAndCodeAndDel(dictDO.getDictName(), dictDO.getCode(), 1);
            dictDO.setValue(value);
            dictDO.setParentCode(parentCode);
            dictDO.setUpdateTime(new Date());
        }else {
            //获取最近一条添加记录的code
            List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
            if(dictDOList.size() > 0){
                dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
            }else {
                dictDO.setCode("1");
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;
    }
    /**
     * 根据字典类名获取相关字典数据
     * @param dictName
     * @return
     */
    public List<IotSystemDictDO> getListByDictName(String dictName){
        List<IotSystemDictDO> systemDictDOList = iotSystemDictDao.findByDictName(dictName);
        for(IotSystemDictDO dictDO : systemDictDOList){
            if(StringUtils.isNotBlank(dictDO.getParentCode())){
                //获取父类字典名称
                IotSystemDictDO parentDict = iotSystemDictDao.findOne(dictDO.getParentCode());
                dictDO.setParentName(parentDict.getValue());
            }
        }
        return systemDictDOList;
    }
}

+ 1 - 1
svr/svr-iot/src/main/resources/application.yml

@ -81,7 +81,7 @@ fastDFS:
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.26.0.204:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  elasticsearch:

+ 1 - 1
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -408,7 +408,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
                "wlyy_health_bank_task_patient_detail" +
                " WHERE " +
                " patient_idcard = '"+activityDO.getPatientIdcard()+"' "+ condition+")" +
                " ) AND del_flag =1 " +condition1+
                " ) AND del_flag =1 " +condition1+" order by create_time DESC "+
                " LIMIT "+(page-1)*size +","+size;
        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO1:activityDOS){

+ 7 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -126,9 +126,11 @@ public class SpecialistController extends EnvelopRestEndpoint {
                                                        @ApiParam(name = "teamCode", value = "医生当前所在团队") @RequestParam(required = true) String teamCode,
                                                        @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                                        @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                                        @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
                                                        @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size,
                                                        @ApiParam(name = "shareDoctor", value = "共管医生") @RequestParam(required = false)String shareDoctor
                                                                        ){
        try {
            return specialistService.getPatientByLabel(doctor,labelType,teamCode,labelCode,page,size);
            return specialistService.getPatientByLabel(doctor,labelType,teamCode,labelCode,page,size,shareDoctor);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -142,9 +144,10 @@ public class SpecialistController extends EnvelopRestEndpoint {
    public MixEnvelop<Long, Long> getLabelpatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                                 @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true)String labelType,
                                                       @ApiParam(name = "teamCode", value = "医生团队") @RequestParam(required = true)Long teamCode,
                                                 @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode) {
                                                 @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                                       @ApiParam(name = "shareDoctor", value = "共管医生CODE") @RequestParam(required = false)String shareDoctor) {
        try {
            return specialistService.getLabelpatientCount(doctor,labelType,labelCode,teamCode);
            return specialistService.getLabelpatientCount(doctor,labelType,labelCode,teamCode,shareDoctor);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 24 - 8
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -187,7 +187,7 @@ public class SpecialistService{
    }
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size){
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
        String sql="SELECT " +
                " p. NAME, " +
                " p. CODE, " +
@ -223,8 +223,11 @@ public class SpecialistService{
                "  AND i.`status` = '1' " +
                " ) lb " +
                " JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
                " WHERE s.team_code ='" +teamCode+"' "+
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient ";
        if(StringUtils.isNotBlank(shareDoctor)){
            sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON s.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
        }
        sql = sql +" WHERE s.team_code ='" +teamCode+"' "+
                " AND s.status >=0  AND s.sign_status >0"+
                " LIMIT "+(page-1)*size+","+size;
        System.out.print("日志:"+sql);
@ -244,8 +247,11 @@ public class SpecialistService{
                    "a.id AS specialCode " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE ";
            if(StringUtils.isNotBlank(shareDoctor)){
                sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON a.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
            }
            sql = sql +"LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 " +
//                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
                    " AND a.team_code ='" +teamCode+"' "+
@ -273,7 +279,7 @@ public class SpecialistService{
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
    }
    public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label,Long teamCode){
    public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label,Long teamCode,String shareDoctor){
        String sql = "SELECT " +
                " COUNT(1) as total " +
                " FROM " +
@ -283,8 +289,17 @@ public class SpecialistService{
                "  AND i.label_type = '"+labelType+"' " +
                "  AND i.`status` = '1' " +
                " AND i.patient in ( " +
                " select patient from  wlyy_specialist_patient_relation  WHERE team_code ='" +teamCode+"' "+
                " AND STATUS >= 0 AND sign_status > 0 )";
                " SELECT " +
                " a.patient AS patient " +
                " FROM " +
                " wlyy_specialist_patient_relation a ";
        if(StringUtils.isNotBlank(shareDoctor)){
            sql = sql + " JOIN wlyy.wlyy_doctor_special_share b ON b.special_code = a.id AND b.doctor = '"+shareDoctor+"' ";
        }
        sql = sql+" WHERE " +
                " a.team_code = '"+teamCode+"' " +
                " AND a.STATUS >= 0 " +
                " AND a.sign_status > 0)";
        System.out.print("日志:"+sql);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
@ -672,6 +687,7 @@ public class SpecialistService{
                " d.dept_name AS deptName, " +
                " d.hospital, " +
                " d.hospital_name AS hospital_name, " +
                " r.id AS specialCode, " +
                " d.`level` " +
                " FROM " +
                " wlyy_specialist.wlyy_specialist_patient_relation r " +