Forráskód Böngészése

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

wsl 2 éve
szülő
commit
0be4086bfb
28 módosított fájl, 1705 hozzáadás és 210 törlés
  1. 0 1
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  2. 731 0
      business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java
  3. 190 53
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 38 35
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  5. 2 2
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  6. 5 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java
  7. 27 40
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  8. 2 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  9. 20 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/BaseEmergencyWarnLogDO.java
  10. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java
  11. 9 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/BaseEmergencyWarnLogDao.java
  12. 48 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  13. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  14. 5 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorDeviceController.java
  15. 4 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java
  16. 6 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java
  17. 6 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java
  18. 43 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/assistance/EmeAsEndpoint.java
  19. 0 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java
  20. 290 22
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  21. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceManageService.java
  22. 36 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  23. 7 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  24. 72 25
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  25. 127 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java
  26. 18 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  27. 5 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  28. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/WlyyXeekPatientDeviceDao.java

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -1513,7 +1513,6 @@ public class HealthCareService {
                ylzMedicalRelationDO.setFundPrice(jsonObject.getString("fund_price"));
                ylzMedicalRelationDO.setJkzhPay(jsonObject.getString("own_jkzh_pay"));
                ylzMedicalRelationDO.setOwnPay(jsonObject.getString("own_pay"));
                ylzMedicalRelationDO.setCardNo(jsonObject.getString("card_no"));
                ylzMedicalRelationDO.setHospitalizationQty(jsonObject.getString("hospitalization_times"));
                ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
                ylzMedicalRelationDO.setInvoiceJj(jsonObject.getString("invoice_jj"));

+ 731 - 0
business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java

@ -572,6 +572,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
        return object;
    }
    /**
     * 首页统计
     *
@ -1627,5 +1629,734 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
        return list;
    }
    /**
     * 首页头部统计
     *
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public JSONObject selectIndexHeader(String dept, int level) {
        JSONObject object = new JSONObject();
        String day = "0";
        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
        Integer total = 0;//总人次
        if (level==2){
            doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql);
        String doctorTotal = "";
        if (map != null) {
            doctorTotal = map.get("total").toString();
        }
        if (StringUtils.isNoneBlank(doctorTotal)) {
            //总人次
            if (!day.equalsIgnoreCase("0")) {
                total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
            } else {
                total = Integer.parseInt(doctorTotal);
            }
        }
        String sql = "SELECT\n" +
                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d ";
        String highSql = sql +" where d.is_high=1 ";
        String redSql = sql +" where d.health_code=2 ";
        String yellowSql = sql +" where d.health_code=3 ";
        if (level==2){
            highSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
            redSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
            yellowSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        Map<String, Object> highMap = jdbcTemplate.queryForMap(highSql);
        String highTotals = "";
        Integer highTotal = 0;//中高风险统计
        if (highMap != null) {
            highTotals = highMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(highTotals)) {
            //中高风险统计
            highTotal = Integer.parseInt(highTotals);
        }
        Map<String, Object> redMap = jdbcTemplate.queryForMap(redSql);
        String redTotals = "";
        Integer redTotal = 0;//红码统计
        if (redMap != null) {
            redTotals = redMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(redTotals)) {
            //红码统计
            redTotal = Integer.parseInt(redTotals);
        }
        Map<String, Object> yellowMap = jdbcTemplate.queryForMap(yellowSql);
        String yellowTotals = "";
        Integer yellowTotal = 0;//黄码统计
        if (yellowMap != null) {
            yellowTotals = yellowMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(yellowTotals)) {
            //黄码统计
            yellowTotal = Integer.parseInt(yellowTotals);
        }
        object.put("total", total);//总人次
        object.put("highTotal", highTotal);//中高风险统计
        object.put("redTotal", redTotal);//红码统计
        object.put("yellowTotal", yellowTotal);//黄码统计
        return object;
    }
    /**
     * 首页出差科室统计
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public List<Map<String,Object>> selectIndexScheduleDept(String dept, int level) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        String sql = "SELECT\n" +
                "\thd.name as deptName,\n" +
                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                " LEFT JOIN dict_hospital_dept hd ON dh.dept_code = hd.code "+
                "where d.schedule_status IN(2,3)  "+condition +
                "GROUP BY dh.dept_code \n" +
                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC  ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 首页出差分布统计
     *
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public List<Map<String,Object>> selectIndexScheduleCityName(String dept, int level) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        String sql = "SELECT\n" +
                "\td.city_name  as cityName,\n" +
                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                " LEFT JOIN dict_hospital_dept hd ON dh.dept_code = hd.code "+
                "where  d.schedule_status IN(2,3)\n" +condition+
                "GROUP BY d.city_name \n" +
                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 首页本地分布统计
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public List<Map<String,Object>> selectIndexScheduleTown(String dept, int level) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        String sql = "SELECT\n" +
                "\td.town_name  as townName,\n" +
                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                " LEFT JOIN dict_hospital_dept hd ON dh.dept_code = hd.code "+
                "where  hd.name IS NOT NULL and d.schedule_status = 1 and d.town_name  !=''\n" + condition +
                "GROUP BY d.town_name \n" +
                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 首页异常实时情况
     * @param dept
     * @param level  1院级管理员,2科室管理员
     *
     * @return
     */
    public List<Map<String,Object>> selectIndexYichangList(String dept, int level,String startDate,String endDate,String doctorName) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        if (StringUtils.isNoneBlank(startDate)){
            condition +=" and d.create_time >= '"+startDate+" 00:00:00'";
            condition +=" and d.create_time <= '"+endDate+" 23:59:59'";
        }
        if (StringUtils.isNoneBlank(doctorName)){
            condition +=" and d.doctor_name like '%"+doctorName+"%'";
        }
        String sql = "SELECT\n" +
                "\tdh.dept_name AS deptName,\n" +
                "\td.doctor_name AS doctorName,\n" +
                "\tbd.photo AS photo,\n" +
                "\td.id AS id,\n" +
                "\td.doctor_id AS doctorId,\n" +
                "\td.schedule_status AS scheduleStatus,\n" +
                "\td.province_name AS provinceName,\n" +
                "\td.city_name AS cityName,\n" +
                "\td.town_name AS townName,\n" +
                "\td.tour_code AS tourCode,\n" +
                "\td.health_code AS healthCode,\n" +
                "\td.temperature AS temperature,\n" +
                "\td.is_symptoms AS isSymptoms,\n" +
                "\td.is_epidemic AS isEpidemic,\n" +
                "\td.abnormal_symptoms AS abnormalSymptoms,\n" +
                "\td.abnormal_symptoms_other AS abnormalSymptomsOther,\n" +
                "\td.epidemic_person AS epidemicPerson,\n" +
                "\tdate_format(\n" +
                "\t\td.create_time,\n" +
                "\t\t'%Y-%m-%d %H:%i:%S'\n" +
                "\t) AS createTime\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 " +
                "LEFT JOIN base_doctor bd ON bd.id=dh.doctor_code "+
                "WHERE\n" +
                "\t(\n" +
                "\t\td.health_code IN (2, 3)\n" +
                "\t\tOR CAST(d.temperature AS DECIMAL) >= 37.3\n" +
                "\t\tOR d.is_symptoms = 1\n" +
                "\t\tOR d.is_epidemic = 1\n" +
                "\t)\n" +
                "AND dh.dept_code IS NOT NULL\n" + condition+
                "ORDER BY\n" +
                "\td.create_time DESC ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 首页核酸检测情况
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public JSONObject selectIndexNucleicTotal(String dept, int level) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        //已做核酸
        String yizuohesuanSql = "SELECT\n" +
                "\tCOUNT(DISTINCT d.doctor_id) as total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" + condition+
                "where d.is_nucleate !=1 and dh.dept_code is not null ";
        Map<String,Object> yizuoMap = jdbcTemplate.queryForMap(yizuohesuanSql);
        String yizuoTotals = "";
        Integer yizuoTotal = 0;//已做核酸统计
        if (yizuoMap != null) {
            yizuoTotals = yizuoMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(yizuoTotals)) {
            //已做核酸统计
            yizuoTotal = Integer.parseInt(yizuoTotals);
        }
        //未做核酸
        String weizuohesuanSql = "SELECT\n" +
                "\tCOUNT(DISTINCT d.doctor_id) as total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d\n" +
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +condition+
                "where d.is_nucleate =1 and dh.dept_code is not null \n";
        Map<String,Object> weizuoMap = jdbcTemplate.queryForMap(weizuohesuanSql);
        String weizuoTotals = "";
        Integer weizuoTotal = 0;//未做核酸统计
        if (weizuoMap != null) {
            weizuoTotals = weizuoMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(weizuoTotals)) {
            //未做核酸统计
            weizuoTotal = Integer.parseInt(weizuoTotals);
        }
        JSONObject object = new JSONObject();
        object.put("weizuoTotal",weizuoTotal);//未做核酸统计
        object.put("yizuoTotal",yizuoTotal);//已做核酸统计
        return object;
    }
    /**
     * 首页当日新增统计
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public JSONObject selectIndexNewAdd(String dept, int level) {
        String condition = "";
        if (level==2){
            condition +=" and dh.dept_code = '"+dept+"'";
        }
        String startDate = DateUtil.getStringDateShort()+" 00:00:00";
        String endDate = DateUtil.getStringDateShort()+" 23:59:59";
        JSONObject object = new JSONObject();
        String sql = "SELECT\n" +
                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "FROM\n" +
                "\t(\n" +
                "\t\tSELECT\n" +
                "\t\t\td3.*\n" +
                "\t\tFROM\n" +
                "\t\t\t(\n" +
                "\t\t\t\tSELECT\n" +
                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" +
                "\t\t\t\tFROM\n" +
                "\t\t\t\t\tbase_doctor_health_upload d1\n" +
                "\t\t\t\tGROUP BY\n" +
                "\t\t\t\t\td1.doctor_id\n" +
                "\t\t\t) d2\n" +
                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id \n" +
                "\t\tAND d2.createTime = d3.create_time\n" +
                "\t) d "+
                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n where 1=1 and dh.dept_code is not null  "+condition+" ";
        String highSql = sql +" AND d.is_high=1 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'";
        String redSql = sql +" AND d.health_code=2 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'";
        String yellowSql = sql +" AND d.health_code=3 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'";
        String greenSql = sql +" AND d.health_code=1 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'";
        Map<String, Object> highMap = jdbcTemplate.queryForMap(highSql);
        String highTotals = "";
        Integer highTotal = 0;//中高风险统计
        if (highMap != null) {
            highTotals = highMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(highTotals)) {
            //中高风险统计
            highTotal = Integer.parseInt(highTotals);
        }
        Map<String, Object> redMap = jdbcTemplate.queryForMap(redSql);
        String redTotals = "";
        Integer redTotal = 0;//红码统计
        if (redMap != null) {
            redTotals = redMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(redTotals)) {
            //红码统计
            redTotal = Integer.parseInt(redTotals);
        }
        Map<String, Object> yellowMap = jdbcTemplate.queryForMap(yellowSql);
        String yellowTotals = "";
        Integer yellowTotal = 0;//黄码统计
        if (yellowMap != null) {
            yellowTotals = yellowMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(yellowTotals)) {
            //黄码统计
            yellowTotal = Integer.parseInt(yellowTotals);
        }
        Map<String, Object> greenMap = jdbcTemplate.queryForMap(greenSql);
        String greenTotals = "";
        Integer greenTotal = 0;//中高风险统计
        if (greenMap != null) {
            greenTotals = greenMap.get("total").toString();
        }
        if (StringUtils.isNoneBlank(greenTotals)) {
            //中高风险统计
            greenTotal = Integer.parseInt(greenTotals);
        }
        object.put("highTotal", highTotal);//中高风险统计
        object.put("redTotal", redTotal);//红码统计
        object.put("yellowTotal", yellowTotal);//黄码统计
        object.put("greenTotal", greenTotal);//绿码统计
        return object;
    }
    /**
     * 首页上报分析
     *
     * @param flag 1周2月
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public JSONObject selectIndexTotalCircle(Integer flag,String dept, int level) {
        JSONObject object = new JSONObject();
        String startDate="";
        String endDate="";
        if (flag==1){
            startDate = DateUtil.getMondayOfThisWeek();
            endDate = DateUtil.getSundayOfThisWeek();
        }else if (flag==2){
            startDate = DateUtil.getFristDayOfMonth();
            endDate = DateUtil.getLastDayOfMonth();
        }
        String day = DateUtil.getTwoDay(endDate, startDate);
        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
        Integer total = 0;//总人次
        String sqlCondition = "";
        if (level==2){
            sqlCondition =" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        String sql = "SELECT SUM(d1.total) as total from (select COUNT(DISTINCT d.doctor_id) as \"total\",date_format(d.create_time ,'%Y-%m-%d' ) from base_doctor_health_upload d where 1=1 "+sqlCondition+" and  d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' GROUP BY date_format(d.create_time ,'%Y-%m-%d' ))d1 ";
        if (level==2){
            doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql);
        String doctorTotal = "";
        if (map != null) {
            doctorTotal = map.get("total").toString();
        }
        if (StringUtils.isNoneBlank(doctorTotal)) {
            //总人次
            if (!day.equalsIgnoreCase("0")) {
                total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
            } else {
                total = Integer.parseInt(doctorTotal);
            }
        }
        Integer yishangbaoTotal = 0;
        Integer weishangbaoTotal = 0;
        Integer zhengchangTotal = 0;
        Integer yichangTotal = 0;
        //已上传
        Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
        if (yishangchaungMap != null) {
            if (yishangchaungMap.get("total") != null) {
                yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
            }
        }
        //未上报
        weishangbaoTotal = total - yishangbaoTotal;
        //上传总次数
        Integer shangchuanTotal = 0;
        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
        if (StringUtils.isNoneBlank(startDate)) {
            shangchuanTotalSql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        if (level==2){
            shangchuanTotalSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        Map<String, Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
        if (shangchuanMap != null) {
            if (shangchuanMap.get("total") != null) {
                shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
            }
        }
        //正常、异常
        String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2) ";
        if (StringUtils.isNoneBlank(startDate)) {
            sqlZhengchang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        if (level==2){
            sqlZhengchang +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        //正常
        Map<String, Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
        if (zhengchangMap != null) {
            if (zhengchangMap.get("total") != null) {
                zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
            }
        }
        String sqlYichang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)  ";
        if (StringUtils.isNoneBlank(startDate)) {
            sqlYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        if (level==2){
            sqlYichang +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
        }
        //正常
        Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
        if (yichangMap != null) {
            if (yichangMap.get("total") != null) {
                yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
            }
        }
        object.put("total", total);//总人次
        object.put("yishangbaoTotal", yishangbaoTotal);//已上报
        object.put("weishangbaoTotal", weishangbaoTotal);//未上报
        object.put("zhengchangTotal", zhengchangTotal);//上报正常
        object.put("yichangTotal", yichangTotal);//上报异常
        object.put("shangchuanTotal", shangchuanTotal);//上传总次数
        return object;
    }
    /**
     * 首页未报科室统计
     * @param dept
     * @param level  1院级管理员,2科室管理员
     * @return
     */
    public List<Map<String, Object>> selectIndexDeptList(String dept, int level) {
        String startDate = DateUtil.getStringDateShort();
        String condition = "";
        if (StringUtils.isNoneBlank(startDate)) {
            condition = "  and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + startDate + " 23:59:59'  ";
        }
        String deptSql = "SELECT\n" +
                "\tcode,\n" +
                "\tname,\n" +
                "\tdh1.total,\n" +
                "\tdh2.total as yishangbaoTotal,\n" +
                "\tdh3.total as shangchuanTotal,\n" +
                "\tdh4.total as zhengchangTotal,\n" +
                "\tdh5.total as yichangTotal,\n" +
                "\tdh6.total as yichangPersonTotal\n" +
                "FROM\n" +
                "\tdict_hospital_dept hd\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS \"total\"\n" +
                "\tFROM\n" +
                "\t\tbase_doctor d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id\n" +
                "\tWHERE\n" +
                "\t\td.del = 1\n" +
                "\tAND dh.del = 1\n" +
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ") dh1 ON hd. CODE = dh1.dept_code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh2 ON dh2.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh3 ON dh3.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+
                "\tand (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2)\n" +
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh4 ON dh4.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+
                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" +
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh5 ON dh5.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+
                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" +
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh6 ON dh6.dept_code=hd.code\n" +
                "WHERE\n" +
                "\thd.consult_dept_flag = 1 ";
        if (level==2) {
            deptSql += " and hd.code = '" + dept + "' ";
        }
        deptSql +=" ORDER BY (IF(ISNULL(dh1.total),0,dh1.total)-IF(ISNULL(dh2.total),0,dh2.total)) DESC ";
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
        for (Map<String,Object> deptMap:mapList){
            String day = DateUtil.getTwoDay(startDate, startDate);
            Integer total = 0;
            Integer yishangbaoTotal = 0;
            Integer weishangbaoTotal = 0;
            Integer zhengchangTotal = 0;
            Integer yichangTotal = 0;
            Integer shangchuanTotal = 0;
            Integer yichangPersonTotal = 0;
            if (deptMap.get("total")!=null){
                String doctorTotal = deptMap.get("total").toString();
                //总人次
                if (!day.equalsIgnoreCase("0")) {
                    total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
                } else {
                    total = Integer.parseInt(doctorTotal);
                }
            }
            if (deptMap.get("yishangbaoTotal")!=null){
                yishangbaoTotal = Integer.parseInt(deptMap.get("yishangbaoTotal").toString());
            }
            //未上报
            weishangbaoTotal = total - yishangbaoTotal;
            if (deptMap.get("zhengchangTotal")!=null){
                zhengchangTotal = Integer.parseInt(deptMap.get("zhengchangTotal").toString());
            }
            if (deptMap.get("yichangTotal")!=null){
                yichangTotal = Integer.parseInt(deptMap.get("yichangTotal").toString());
            }
            if (deptMap.get("yichangPersonTotal")!=null){
                yichangPersonTotal = Integer.parseInt(deptMap.get("yichangPersonTotal").toString());
            }
            if (deptMap.get("shangchuanTotal")!=null){
                shangchuanTotal = Integer.parseInt(deptMap.get("shangchuanTotal").toString());
            }
            JSONObject object = new JSONObject();
            object.put("total", total);//总人次
            object.put("yishangbaoTotal", yishangbaoTotal);//已上报
            object.put("weishangbaoTotal", weishangbaoTotal);//未上报
            object.put("zhengchangTotal", zhengchangTotal);//上报正常
            object.put("yichangTotal", yichangTotal);//上报异常
            object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常
            object.put("shangchuanTotal", shangchuanTotal);//上传总次数
            deptMap.put("tongyishuju", object);
        }
        return mapList;
    }
}

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

@ -140,6 +140,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.print.DocFlavor;
import javax.validation.constraints.Null;
import java.beans.Transient;
import java.io.IOException;
@ -333,6 +334,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
@ -1410,6 +1413,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return systemMessageDO;
    }
    public JSONArray findPatientCardList(String patientId) throws Exception {
        patientMedicareCardDao.deleteByPatientId(patientId);
        net.sf.json.JSONArray array =findPatientCard(patientId);
        for (int i=0;i<array.size();i++){
            net.sf.json.JSONObject object = array.getJSONObject(i);
            String cardType = object.getString("CARD_TYPE");
            String cardNo = object.getString("CARD_NO");
            String cardTypeName = object.getString("CARD_TYPE_NAME");
            PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
            patientMedicareCardDO.setCode(cardNo);
            patientMedicareCardDO.setParentType("A");
            if (cardType.equalsIgnoreCase("2")){
                patientMedicareCardDO.setType("A_01");
            }else {
                patientMedicareCardDO.setType("A_03");
            }
            patientMedicareCardDO.setPatientCode(patientId);
            patientMedicareCardDO.setOrgCode("350211A1002");
            patientMedicareCardDO.setCityCode("350200");
            patientMedicareCardDO.setDel("1");
            patientMedicareCardDO.setRemark(cardTypeName);
            patientMedicareCardDao.save(patientMedicareCardDO);
        }
        return array;
    }
    /**
     * 获取卡记录
     *
@ -3472,7 +3502,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id" +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = p.outpatient_id" +
                " WHERE" +
                " 1=1 ";
        if (StringUtils.isNotBlank(status)) {
@ -3564,7 +3594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id " +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = p.outpatient_id " +
                " WHERE" +
                " 1=1";
        if (StringUtils.isNotBlank(status)) {
@ -4966,11 +4996,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
        try {
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                businessOrderService.orderRefund(wxId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                //眼科接诊时更新眼科通状态
                if (!flag){
                    if (businessOrderDO!=null){
                        ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                if (businessOrderDO.getStatus()==1){
                    businessOrderService.orderRefund(wxId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                    //眼科接诊时更新眼科通状态
                    if (!flag){
                        if (businessOrderDO!=null){
                            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                        }
                    }
                }
            } else if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
@ -4978,7 +5010,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                    try {
                        entranceService.hisRefund(outPatientId);
                        if (businessOrderDO.getStatus()==1){
                            entranceService.hisRefund(outPatientId);
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
@ -5114,26 +5148,48 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if("patientCancel".equalsIgnoreCase(titelType)) {
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isCloseRefund");
            if (hospitalSysDictDO!=null){
                if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                    if ("9".equals(type)) {
                        contentMsg = "您发起的图文复诊已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已被您取消,您可重新发起";
                    }
                    if ("16".equals(type)) {
                        contentMsg =  "您发起的视频复诊已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已被您取消,您可重新发起";
                    }
                    if ("1".equals(type)) {
                        contentMsg =  "您发起的图文咨询已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已被您取消,您可重新发起";
                    }
                    if ("17".equals(type)) {
                        contentMsg = "您发起的视频咨询已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
                    }
                    if ("12".equals(type)) {
                        return;
            if (outpatientDO.getPayStatus()==1){
                if (hospitalSysDictDO!=null){
                    if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                        if ("9".equals(type)) {
                            contentMsg = "您发起的图文复诊已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已被您取消,您可重新发起";
                        }
                        if ("16".equals(type)) {
                            contentMsg =  "您发起的视频复诊已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已被您取消,您可重新发起";
                        }
                        if ("1".equals(type)) {
                            contentMsg =  "您发起的图文咨询已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已被您取消,您可重新发起";
                        }
                        if ("17".equals(type)) {
                            contentMsg = "您发起的视频咨询已被您取消。已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
                        }
                        if ("12".equals(type)) {
                            return;
                        }
                    }else {
                        if ("9".equals(type)) {
                            contentMsg = "您发起的图文复诊已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已被您取消,您可重新发起";
                        }
                        if ("16".equals(type)) {
                            contentMsg =  "您发起的视频复诊已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已被您取消,您可重新发起";
                        }
                        if ("1".equals(type)) {
                            contentMsg =  "您发起的图文咨询已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已被您取消,您可重新发起";
                        }
                        if ("17".equals(type)) {
                            contentMsg = "您发起的视频咨询已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
                        }
                        if ("12".equals(type)) {
                            return;
                        }
                    }
                }else {
                    if ("9".equals(type)) {
@ -5158,19 +5214,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }else {
                if ("9".equals(type)) {
                    contentMsg = "您发起的图文复诊已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg = "您发起的图文复诊已被您取消。如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已被您取消,您可重新发起";
                }
                if ("16".equals(type)) {
                    contentMsg =  "您发起的视频复诊已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg =  "您发起的视频复诊已被您取消。如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已被您取消,您可重新发起";
                }
                if ("1".equals(type)) {
                    contentMsg =  "您发起的图文咨询已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg =  "您发起的图文咨询已被您取消。如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已被您取消,您可重新发起";
                }
                if ("17".equals(type)) {
                    contentMsg = "您发起的视频咨询已被您取消。请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg = "您发起的视频咨询已被您取消。如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
                }
                if ("12".equals(type)) {
@ -5183,15 +5239,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else if("systemCancelRemind".equalsIgnoreCase(titelType)){
            //超过24小时未接诊,系统取消
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isCloseRefund");
            if (hospitalSysDictDO!=null){
                if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                    if ("9".equals(type)) {
                        contentMsg = "您发起的图文复诊已取消,已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超过24小时未接诊已自动取消图文咨询。";
                    }
                    if ("16".equals(type)) {
                        contentMsg = "您发起的视频复诊已取消,已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                        first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超过24小时未接诊已自动取消视频咨询。";
            if (outpatientDO.getPayStatus()==1){
                if (hospitalSysDictDO!=null){
                    if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                        if ("9".equals(type)) {
                            contentMsg = "您发起的图文复诊已取消,已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超过24小时未接诊已自动取消图文咨询。";
                        }
                        if ("16".equals(type)) {
                            contentMsg = "您发起的视频复诊已取消,已支付的18元将原路退回,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超过24小时未接诊已自动取消视频咨询。";
                        }
                    }else {
                        if ("9".equals(type)) {
                            contentMsg = "您发起的图文复诊已取消,请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超过24小时未接诊已自动取消图文咨询。";
                        }
                        if ("16".equals(type)) {
                            contentMsg = "您发起的视频复诊已取消,请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                            first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超过24小时未接诊已自动取消视频咨询。";
                        }
                    }
                }else {
                    if ("9".equals(type)) {
@ -5205,15 +5272,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }else {
                if ("9".equals(type)) {
                    contentMsg = "您发起的图文复诊已取消,请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg = "您发起的图文复诊已取消,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超过24小时未接诊已自动取消图文咨询。";
                }
                if ("16".equals(type)) {
                    contentMsg = "您发起的视频复诊已取消,请前往收费窗口进行退款,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    contentMsg = "您发起的视频复诊已取消,如有问诊需求,可重新发起或到医院门急诊就诊。";
                    first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超过24小时未接诊已自动取消视频咨询。";
                }
            }
            logger.info("系统取消接诊入参:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
@ -9906,7 +9974,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            cardNo = outpatientDO.getCardNo();
                        }
                        logger.info("cardNo:" + cardNo);
                        JSONObject object =entranceService.BS15054(patientMappingDO.getMappingCode(),prescriptionDO.getRealOrder(),demoFlag);
                        String mappingCode= "";
                        PatientMappingDO patientMappingDO1 = patientMappingDao.findByPatient(outpatientDO.getPatient());
                        if (patientMappingDO1!=null){
                            mappingCode = patientMappingDO1.getMappingCode();
                        }
                        JSONObject object =entranceService.BS15054(mappingCode,prescriptionDO.getRealOrder(),demoFlag);
                        net.sf.json.JSONObject res = object.getJSONObject("resquest");
                        logger.info("获取待结算数据 res: " + res.toString());
                        String rsCode = res.getString("@RESULT");
@ -12607,10 +12680,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                String mobile1 = patientDO.getMobile();
                                String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id=" + baseNatAppointmentDO.getId();
                                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew");
                                String addres = "我院五号楼北侧(急诊部后侧)";
                                String timeDes = "6-8小时";
                                if (hospitalSysDictDO1!=null){
                                    com.alibaba.fastjson.JSONArray array1 = com.alibaba.fastjson.JSONArray.parseArray(hospitalSysDictDO1.getDictValue());
                                    for (int i=0;i<array1.size();i++){
                                        com.alibaba.fastjson.JSONObject object1 = array1.getJSONObject(i);
                                        String chargeCode1 = object1.getString("chargeCode");
                                        if (chargeCode.equalsIgnoreCase(chargeCode1)){
                                            addres = "我院发热门诊";
                                            timeDes = "2小时";
                                        }
                                    }
                                }
                                String first = "尊敬的用户" + baseNatAppointmentDO.getName() + ",您已完成线上自助核酸检测预约申请";
                                String contentMsg = "申请人:" + baseNatAppointmentDO.getName() + "\r\n 预约时间:" + date + " \r\n发票流水号:" + baseNatAppointmentDO.getRealOrder();
                                String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                        "2、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至"+addres+"核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                        "2、核酸检测标本采集"+timeDes+"后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                String responseMsg = "";
                                responseMsg = entranceService.ehospitalNotice(
                                        name1,
@ -13035,10 +13122,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String responseMsg="";
                String url="";
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew");
                String addres = "我院五号楼北侧(急诊部后侧)";
                String timeDes = "6-8小时";
                if (hospitalSysDictDO1!=null){
                    com.alibaba.fastjson.JSONArray array1 = com.alibaba.fastjson.JSONArray.parseArray(hospitalSysDictDO1.getDictValue());
                    for (int i=0;i<array1.size();i++){
                        com.alibaba.fastjson.JSONObject object1 = array1.getJSONObject(i);
                        String chargeCode1 = object1.getString("chargeCode");
                        if (baseNatAppointmentDO.getChargeCode().equalsIgnoreCase(chargeCode1)){
                            addres = "我院发热门诊";
                            timeDes = "2小时";
                        }
                    }
                }
                String contentMsg="申请人:"+baseNatAppointmentDO.getName()+"\r\n预约时间:"+date;
                String remark = "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\r\n" +
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                        "3、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至"+addres+"核酸检测点领取标本试管窗口绑定检测。\r\n" +
                        "3、核酸检测标本采集"+timeDes+"后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
                    responseMsg = entranceService.ehospitalNotice(
                            baseNatAppointmentDO.getName(),
@ -13060,9 +13161,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                jsonObject.put("keyword1",DateUtil.getStringDate());
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                jsonObject.put("keyword2","申请人:"+baseNatAppointmentDO.getName()+"\n预约时间:"+date);
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew");
                String addres = "我院五号楼北侧(急诊部后侧)";
                String timeDes = "6-8小时";
                if (hospitalSysDictDO1!=null){
                    com.alibaba.fastjson.JSONArray array1 = com.alibaba.fastjson.JSONArray.parseArray(hospitalSysDictDO1.getDictValue());
                    for (int i=0;i<array1.size();i++){
                        com.alibaba.fastjson.JSONObject object1 = array1.getJSONObject(i);
                        String chargeCode1 = object1.getString("chargeCode");
                        if (baseNatAppointmentDO.getChargeCode().equalsIgnoreCase(chargeCode1)){
                            addres = "我院发热门诊";
                            timeDes = "2小时";
                        }
                    }
                }
                String remark =  "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\n" +
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
                        "3、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                        "2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至"+addres+"核酸检测点领取标本试管窗口绑定检测。\n" +
                        "3、核酸检测标本采集"+timeDes+"后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                jsonObject.put("remark",remark);
                jsonObject.put("url","111111");
                String url = "https://xmzsyyfwc.xmpbinfo.cn/weixin/1/notification/push/nucleictest";
@ -13187,6 +13302,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.town_name as \"townName\"," +
                "t.street_name as \"streetName\"," +
                "t.address as \"address\"," +
                "t.charge_code as \"chargeCode\"," +
                "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
                "t.charge_amount as \"chargeAmount\"," ;
        if ("xm_tasy_wx".equalsIgnoreCase(wechatId)){
@ -13461,7 +13577,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public String sendAlipayMessage(String patientId,String code,String fee,String redirdctUrl,String reserverTime,String realorder) throws Exception {
    public String sendAlipayMessage(String patientId,String code,String fee,String redirdctUrl,String reserverTime,String realorder,Integer id) throws Exception {
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
      /*  ⽀付提醒通知:
        code: 通知代码,⽀付提醒为“2” open_id:⽀付宝⽤户ID user_name: 姓名 order_id: 订单号
@ -13496,8 +13612,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("keyword2","申请人:"+patientDO.getName()+"\n" +
                    "预约时间:"+reserverTime+"\n" +
                    "发票流水号:"+realorder+"");
            String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
                    "2、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
            WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew");
            String addres = "我院五号楼北侧(急诊部后侧)";
            String timeDes = "6-8小时";
            if (hospitalSysDictDO1!=null){
                com.alibaba.fastjson.JSONArray array1 = com.alibaba.fastjson.JSONArray.parseArray(hospitalSysDictDO1.getDictValue());
                for (int i=0;i<array1.size();i++){
                    com.alibaba.fastjson.JSONObject object1 = array1.getJSONObject(i);
                    String chargeCode1 = object1.getString("chargeCode");
                    if (baseNatAppointmentDO.getChargeCode().equalsIgnoreCase(chargeCode1)){
                        addres = "我院发热门诊";
                        timeDes = "2小时";
                    }
                }
            }
            String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至"+addres+"核酸检测点领取标本试管窗口绑定检测。\n" +
                    "2、核酸检测标本采集"+timeDes+"后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
            jsonObject.put("remark",remark);
            jsonObject.put("url",redirdctUrl);
        }
@ -15224,4 +15355,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return null;
    }
  /*  public List<Map<String,Object>> selectSettlementInfo(String medicareState,String condition,String startDate,String endDate){
        String sql = ""
    }*/
}

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

@ -1617,42 +1617,45 @@ public class EntranceService {
        String origTraceNo = businessOrderDO.getTraceNo();
        logger.info("第一次调用his退费接口开始");
        //调用his退费接口
        BS15051(operatorId, operatorName, cardType, cardNo, accountType, idNo, withdrawMode, depositType, ServiceType, amount, outRefundNo, outChargeNo, origTraceNo, traceSerial, paydate, notes, tradeState, failReason, failTime, extra, demoFlag);
        logger.info("第一次调用his退费接口结束");
        //调用易联众预缴金退款接口
        String refund = ylzPayService.refund(operatorId, operatorName, cardType, accountType, cardNo, idNo, amount, outChargeNo, userName, "1", traceSerial, outRefundNo,cardNo);
        BusinessOrderRefundDO businessOrderRefundDO = new BusinessOrderRefundDO();
        businessOrderRefundDO.setOrderNo(businessOrderDO.getOrderNo());
        businessOrderRefundDO.setOutRefundNo(outRefundNo);
        businessOrderRefundDO.setStatus(1);
        businessOrderRefundDO.setCreateTime(new Date());
        businessOrderRefundDO.setUpdateTime(new Date());
        businessOrderRefundDO.setPatient(businessOrderDO.getPatient());
        businessOrderRefundDO.setPatientName(businessOrderDO.getPatientName());
        businessOrderRefundDO = orderRefundDao.save(businessOrderRefundDO);
        JSONObject jsonObject = JSONObject.parseObject(refund);
        //获取调用易联众退费接口交易状态
        String respCode = jsonObject.getString("respCode");
        if (respCode.equals("000000")){
            businessOrderRefundDO.setRefundTime(new Date());
            businessOrderRefundDO.setStatus(2);
            orderRefundDao.save(businessOrderRefundDO);
            businessOrderDO.setStatus(9);
            businessOrderDao.save(businessOrderDO);
            tradeState = "succ";
        }else {
            tradeState = "fail";
        }
        logger.info("第二次调用his退费接口开始");
        net.sf.json.JSONObject object1 = qutpatientBalance(outpatientDO.getCardNo(), false);
        Double cardFee = object1.getDouble("ZHYE");
        logger.info("cardFee==="+cardFee);
        JSONArray res = BS15051(operatorId, operatorName, cardType, cardNo, accountType, idNo, withdrawMode, depositType, ServiceType, amount, outRefundNo, outChargeNo, origTraceNo, traceSerial, paydate, notes, tradeState, failReason, failTime, extra, demoFlag);
        JSONArray resp = new JSONArray();
        resp = BS15051(operatorId, operatorName, cardType, cardNo, accountType, idNo, withdrawMode, depositType, ServiceType, amount, outRefundNo, outChargeNo, origTraceNo, traceSerial, paydate, notes, tradeState, failReason, failTime, extra, demoFlag);
        logger.info("第二次调用his退费接口结束");
        if (res!=null&&res.size()!=0){
            net.sf.json.JSONObject object = res.getJSONObject(0);
            logger.info("object"+object.toString());
            if (object.getString("retCodeOut").equalsIgnoreCase("00")){
                logger.info("第一次调用his退费接口结束");
                //调用易联众预缴金退款接口
                String refund = ylzPayService.refund(operatorId, operatorName, cardType, accountType, cardNo, idNo, amount, outChargeNo, userName, "1", traceSerial, outRefundNo,cardNo);
                BusinessOrderRefundDO businessOrderRefundDO = new BusinessOrderRefundDO();
                businessOrderRefundDO.setOrderNo(businessOrderDO.getOrderNo());
                businessOrderRefundDO.setOutRefundNo(outRefundNo);
                businessOrderRefundDO.setStatus(1);
                businessOrderRefundDO.setCreateTime(new Date());
                businessOrderRefundDO.setUpdateTime(new Date());
                businessOrderRefundDO.setPatient(businessOrderDO.getPatient());
                businessOrderRefundDO.setPatientName(businessOrderDO.getPatientName());
                businessOrderRefundDO = orderRefundDao.save(businessOrderRefundDO);
                JSONObject jsonObject = JSONObject.parseObject(refund);
                //获取调用易联众退费接口交易状态
                String respCode = jsonObject.getString("respCode");
                if (respCode.equals("000000")){
                    businessOrderRefundDO.setRefundTime(new Date());
                    businessOrderRefundDO.setStatus(2);
                    orderRefundDao.save(businessOrderRefundDO);
                    businessOrderDO.setStatus(9);
                    businessOrderDao.save(businessOrderDO);
                    tradeState = "succ";
                }else {
                    tradeState = "fail";
                }
                logger.info("第二次调用his退费接口开始");
                resp = BS15051(operatorId, operatorName, cardType, cardNo, accountType, idNo, withdrawMode, depositType, ServiceType, amount, outRefundNo, outChargeNo, origTraceNo, traceSerial, paydate, notes, tradeState, failReason, failTime, extra, demoFlag);
                logger.info("第二次调用his退费接口结束");
            }
        }
        return resp;
    }

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

@ -533,7 +533,7 @@ public class YlzPayService {
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网预交金退款", "POST", null,null, jsonObject, error, logService.shoppatType);
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网预交金退款", "POST", null,param.toString(), jsonObject, error, logService.shoppatType);
        return jsonObject;
    }
@ -543,7 +543,7 @@ public class YlzPayService {
     *
     * @param operatorId
     * @param operatorName
     * @param termNo
     * @param termNotermNo
     * @param tradeType
     * @param outTradeNo
     * @param traceNo

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

@ -2,6 +2,7 @@ package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -15,6 +16,10 @@ public interface BasePatientMedicareCardDao extends PagingAndSortingRepository<P
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);
    @Modifying
    @Query("delete PatientMedicareCardDO a where a.patientCode=?1")
    int deleteByPatientId(String patientCode);
    @Query("select id from PatientMedicareCardDO where patientCode = ?1")
    Set<Object> findIdListByPatientCode(String patientCode);

+ 27 - 40
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -291,6 +291,7 @@ public class WlyyBusinessService {
            params.put("idcard",idcard);
            String patientCardNo = null;
            patientMedicareCardDao.deleteByPatientId(patientId);
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                net.sf.json.JSONArray array =prescriptionService.findPatientCard(patientId);
                for (int i=0;i<array.size();i++){
@ -298,28 +299,21 @@ public class WlyyBusinessService {
                    String cardType = object.getString("CARD_TYPE");
                    String cardNo = object.getString("CARD_NO");
                    String cardTypeName = object.getString("CARD_TYPE_NAME");
                    PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByCodeAndPatientCode(cardNo,patientId);
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setCode(cardNo);
                        patientMedicareCardDO.setParentType("A");
                        if (cardType.equalsIgnoreCase("2")){
                            patientMedicareCardDO.setType("A_01");
                            patientCardNo = cardNo;
                        }else {
                            patientMedicareCardDO.setType("A_03");
                        }
                        patientMedicareCardDO.setPatientCode(patientId);
                        patientMedicareCardDO.setOrgCode("350211A1002");
                        patientMedicareCardDO.setCityCode("350200");
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setRemark(cardTypeName);
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                    patientMedicareCardDO.setCode(cardNo);
                    patientMedicareCardDO.setParentType("A");
                    if (cardType.equalsIgnoreCase("2")){
                        patientMedicareCardDO.setType("A_01");
                        patientCardNo = cardNo;
                    }else {
                        if (patientMedicareCardDO.getType().equalsIgnoreCase("A_01")){
                            patientCardNo = patientMedicareCardDO.getCode();
                        }
                        patientMedicareCardDO.setType("A_03");
                    }
                    patientMedicareCardDO.setPatientCode(patientId);
                    patientMedicareCardDO.setOrgCode("350211A1002");
                    patientMedicareCardDO.setCityCode("350200");
                    patientMedicareCardDO.setDel("1");
                    patientMedicareCardDO.setRemark(cardTypeName);
                    patientMedicareCardDao.save(patientMedicareCardDO);
                }
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                JSONArray array = xzzxEntranceService.selectPateintCard(patientId);
@ -328,28 +322,21 @@ public class WlyyBusinessService {
                    String cardType = jsonObject.getString("CARD_TYPE");
                    String cardNo = jsonObject.getString("CARD_NO");
                    String cardTypeName = jsonObject.getString("CARD_TYPE_HIS");
                    PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByCodeAndPatientCode(cardNo,patientId);
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setCode(cardNo);
                        patientMedicareCardDO.setParentType("A");
                        if (cardType.equalsIgnoreCase("01")){
                            patientMedicareCardDO.setType("A_01");
                            patientCardNo = cardNo;
                        }else {
                            patientMedicareCardDO.setType("A_03");
                        }
                        patientMedicareCardDO.setPatientCode(patientId);
                        patientMedicareCardDO.setOrgCode("350211A1002");
                        patientMedicareCardDO.setCityCode("350200");
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setRemark(cardTypeName);
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                    patientMedicareCardDO.setCode(cardNo);
                    patientMedicareCardDO.setParentType("A");
                    if (cardType.equalsIgnoreCase("01")){
                        patientMedicareCardDO.setType("A_01");
                        patientCardNo = cardNo;
                    }else {
                        if (patientMedicareCardDO.getType().equalsIgnoreCase("A_01")){
                            patientCardNo = patientMedicareCardDO.getCode();
                        }
                        patientMedicareCardDO.setType("A_03");
                    }
                    patientMedicareCardDO.setPatientCode(patientId);
                    patientMedicareCardDO.setOrgCode("350211A1002");
                    patientMedicareCardDO.setCityCode("350200");
                    patientMedicareCardDO.setDel("1");
                    patientMedicareCardDO.setRemark(cardTypeName);
                    patientMedicareCardDao.save(patientMedicareCardDO);
                }
            }else {
                PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientId,"1");

+ 2 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4077,9 +4077,11 @@ public class ImService {
                "op.source as \"source\"  ," +
                "op.card_no as \"cardNo\"  ," +
                "op.medical_state as \"medicalState\"  ," +
                "bop.status as \"payStatus\" ," +
                "op.patient_cancel_value as \"patientCancelValue\" ," +
                "op.patient_cancel_remark as \"patient_cancel_remark\"  " +
                "FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +
                " LEFT join base_business_order_pay bop on bop.relation_code = op.id" +
                " LEFT join wlyy_consult_team b on a.id = b.consult" +
                " LEFT JOIN base_patient d on op.patient = d.id " +
                " WHERE 1=1 ";

+ 20 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/BaseEmergencyWarnLogDO.java

@ -21,9 +21,11 @@ public class BaseEmergencyWarnLogDO extends IdEntity {
    public String userCode;
    public String userName;
    public Integer userType; //用户类型 1居民 2社工
    public String userTypeName; //用户类型 1居民 2社工
    public String content;
    public Date createTime;
    public Integer type; //保存类型(1已知悉,2前往,3 110,4 120,5小结,6 复核,7 预警核实)
    public Integer type; //保存类型(1已知悉,2前往,3 110,4 120,5 小结,6 已取消,7 复核,8 发起im会话 9发起音视频通话 10调阅设备详情页)
    public String ext1;//备用字段 type=9时 存音视频唯一标识
    public String timeInfo;
@ -92,4 +94,21 @@ public class BaseEmergencyWarnLogDO extends IdEntity {
    public void setType(Integer type) {
        this.type = type;
    }
    public String getExt1() {
        return ext1;
    }
    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }
    @Transient
    public String getUserTypeName() {
        return userTypeName;
    }
    public void setUserTypeName(String userTypeName) {
        this.userTypeName = userTypeName;
    }
}

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

@ -47,6 +47,8 @@ public class EmergencyOrderVO {
    //小结
    private EmergencyWarnConclusionDO emergencyWarnConclusionDO;//工单小结
    //复核
    private BaseEmergencyWarnLogDO reviewWarnLogDO;//工单小结
    //通知对象
    private List<Map<String,Object>> noticePersons;//通知对象
@ -325,4 +327,12 @@ public class EmergencyOrderVO {
    public void setKnow(Integer know) {
        this.know = know;
    }
    public BaseEmergencyWarnLogDO getReviewWarnLogDO() {
        return reviewWarnLogDO;
    }
    public void setReviewWarnLogDO(BaseEmergencyWarnLogDO reviewWarnLogDO) {
        this.reviewWarnLogDO = reviewWarnLogDO;
    }
}

+ 9 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/BaseEmergencyWarnLogDao.java

@ -16,6 +16,15 @@ public interface BaseEmergencyWarnLogDao extends PagingAndSortingRepository<Base
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type is null ")
    List<BaseEmergencyWarnLogDO> findByOrderIdOrderByCreateTimeDesc(String oderId);//工单操作日志,有type的为工单流程关键步骤
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type is not null ")
    List<BaseEmergencyWarnLogDO> findByOrderId(String oderId);
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type = 1")
    List<BaseEmergencyWarnLogDO> findByOrderIdByType(String orderId);
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type = ?2")
    List<BaseEmergencyWarnLogDO> findByOrderIdAndType(String orderId,Integer type);
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.ext1 = ?2")
    List<BaseEmergencyWarnLogDO> findByOrderIdAndExt1(String orderId,String ext1);
}

+ 48 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.restmodel.ResponseContant;
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;
@ -63,10 +64,10 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    ){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
//            param.put("doctorId",doctor);
//            if(permissionService.noPermission(1,param)){
//                return ObjEnvelop.getError("该操作没有权限");
//            }
            JSONObject result = assistanceService.doctorGetOrderDetail(orderId,doctor);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
@ -344,6 +345,49 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("preWarningReview")
    @ApiOperation(value = "预警复核")
    @ObserverRequired
    public ObjEnvelop preWarningReview(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "复核内容", name = "content")
            @RequestParam(value = "content", required = true) String content) {
        try {
            String doctor = permissionService.getUID();
            JSONObject result = assistanceService.preWarningReview(orderId, doctor,content);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("addWarnLog")
    @ApiOperation(value = "记录预警核实日志")
    @ObserverRequired
    public Envelop addWarnLog(
            @ApiParam(value = "会话id", name = "sessionId")
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "类型 8发起im会话,9发起音视频通话", name = "type")
            @RequestParam(value = "type", required = true) Integer type,
            @ApiParam(value = "内容", required = false, name = "content")
            @RequestParam(value = "content", required = false) String content,
            @ApiParam(value = "音视频唯一标识", required = false, name = "ext1")
            @RequestParam(value = "ext1", required = false) String ext1) {
        try {
            assistanceService.addWarnLog(sessionId, doctor,type,content,ext1);
            return Envelop.getSuccess("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping("errorWarning")
    @ApiOperation(value = "误报警")
    @ObserverRequired

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -191,7 +191,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			}
			String url = "/chatroom/index?type="+type+"&peerId="+senderId+"&action=callVideo&peerName="+peerName+"&sessionId="+sessionId+"&content="+content;
			logger.info("url="+url);
			messageUtil.sendDoctorGetuiMessage(targetId,"4",url,"im消息",body);
			messageUtil.sendDoctorGetuiMessage(targetId,"4",url,"新消息",body);
			if(StringUtils.isNotBlank(zzdMessage)){
				messageUtil.sendDoctorDingdingMessage(null,targetId,"text","4",zzdMessage,null,null);
			}

+ 5 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorDeviceController.java

@ -178,17 +178,18 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation(value = "设备详细信息")
	public String getDeviceInfo(@ApiParam(name = "patient",value = "居民code")
								@RequestParam(value = "patient")String patient,
								@ApiParam(name = "orderId", required = false,value = "对应工单的id")
								@RequestParam(value = "orderId", required = false) String orderId,
								@ApiParam(name = "deviceSn",value = "设备SN码")
								@RequestParam(value = "deviceSn")String deviceSn){
		try {
			JSONObject param = new JSONObject();
			param.put("doctorId",permissionService.getUID());
			String doctorId = permissionService.getUID();
			param.put("doctorId",doctorId);
			if(permissionService.noPermission(2,param)){
				return write(-1,"该操作没有权限");
			}
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn);
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn,doctorId,orderId);
			if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
				return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
			}else {

+ 4 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -438,11 +438,14 @@ public class PatientDeviceController extends BaseController {
                                         @RequestParam(value = "patient")String patient,
                                         @ApiParam(name="deviceSN")
                                         @RequestParam(value = "deviceSN")String deviceSn,
                                         @ApiParam(name = "orderId", required = false,value = "对应工单的id")
                                         @RequestParam(value = "orderId", required = false) String orderId,
                                         @ApiParam(name="day",value = "yyyy-mm-dd")
                                         @RequestParam(value = "day",required = false)String day){
        try {
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn,day);
            String uid = permissionService.getUID();
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn,day,uid,orderId);
            if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
                return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            }else {

+ 6 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.endpoint.statistics;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.device.DeviceManageService;
import com.yihu.jw.care.service.device.NetworkCardService;
import com.yihu.jw.care.service.device.PatientDeviceService;
@ -43,7 +44,8 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    private NetworkCardService networkCardService;
    @Autowired
    private DeviceManageService deviceManageService;
    @Autowired
    private PermissionService permissionService;
    @ApiOperation("环境信息")
@ -152,11 +154,12 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "patient") String patient,
                                          @ApiParam(name = "deviceSN")
                                          @RequestParam(value = "deviceSN") String deviceSn,
                                          @ApiParam(name = "orderId", required = false,value = "对应工单的id")
                                          @RequestParam(value = "orderId", required = false) String orderId,
                                          @ApiParam(name = "day", value = "yyyy-mm-dd")
                                          @RequestParam(value = "day", required = false) String day) {
        try {
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day);
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day,permissionService.getUID(),orderId);
            if (result.getInt(ResponseContant.resultFlag) == ResponseContant.success) {
                return success(JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            } else {

+ 6 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -613,6 +613,8 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
                                                 @RequestParam(value = "name", required = false) String name,
                                                 @ApiParam(name = "deviceSn", value = "设备Sn码", required = false)
                                                 @RequestParam(value = "deviceSn", required = false) String deviceSn,
                                                 @ApiParam(name = "teamId", value = "社区id、团队id", required = false)
                                                 @RequestParam(value = "teamId", required = false) String teamId,
                                                 @ApiParam(name = "categoryCode", value = "设备类型Code", required = false)
                                                 @RequestParam(value = "categoryCode", required = false) String categoryCode,
                                                 @ApiParam(name = "contactStatus",value = "在线状态 1在线,0不在线",required = false)
@ -621,7 +623,7 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
                                                 @RequestParam(value = "type",required = false)String type){
        try {
            return statisticsService.healthySecurityDeviceList(name,deviceSn,categoryCode,contactStatus,type,page,size);
            return statisticsService.healthySecurityDeviceList(name,deviceSn,teamId,categoryCode,contactStatus,type,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return failedPageEnvelopException2(e);
@ -634,10 +636,12 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取设备数量")
    public ObjEnvelop deviceinfoStatisticsNum(@ApiParam(name = "type",value = "设备类型0健康 1安防",required = true)
                                              @RequestParam(value = "type",required = true)String type,
                                              @ApiParam(name = "teamId", value = "社区id、团队id", required = false)
                                              @RequestParam(value = "teamId", required = false) String teamId,
                                              @ApiParam(name = "deviceCategory",value = "设备code",required = false)
                                              @RequestParam(value = "deviceCategory",required = false)String deviceCategory){
        try {
            JSONObject jsonObject = statisticsService.deviceinfoStatisticsNum(type,deviceCategory);
            JSONObject jsonObject = statisticsService.deviceinfoStatisticsNum(type,deviceCategory,teamId);
            return success(jsonObject);
        } catch (Exception e) {
            e.printStackTrace();

+ 43 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/assistance/EmeAsEndpoint.java

@ -5,6 +5,7 @@ import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
@ -26,8 +27,6 @@ public class EmeAsEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "newOrder")
    @ApiOperation(value = "居民发起新的紧急救助")
    @ServicesAuth(item = "emergencyAssistance")
    @ObserverRequired
    public ObjEnvelop newOrder(@ApiParam(name="patientId",value = "居民id")
                               @RequestParam(value = "patientId") String patientId,
                               @ApiParam(name="jsonData",value = "创建工单json")
@ -45,5 +44,47 @@ public class EmeAsEndpoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("preWarningReview")
    @ApiOperation(value = "预警复核")
    public ObjEnvelop preWarningReview(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "复核内容", name = "content")
            @RequestParam(value = "content", required = true) String content) {
        try {
            JSONObject result = assistanceService.preWarningReview(orderId, doctor,content);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("addWarnLog")
    @ApiOperation(value = "记录预警核实日志")
    public Envelop addWarnLog(
            @ApiParam(value = "会话id", name = "sessionId")
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "类型 8发起im会话,9发起音视频通话", name = "type")
            @RequestParam(value = "type", required = true) Integer type,
            @ApiParam(value = "内容", required = false, name = "content")
            @RequestParam(value = "content", required = false) String content,
            @ApiParam(value = "音视频唯一标识", required = false, name = "ext1")
            @RequestParam(value = "ext1", required = false) String ext1) {
        try {
            assistanceService.addWarnLog(sessionId, doctor,type,content,ext1);
            return Envelop.getSuccess("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
}

+ 0 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -463,8 +463,6 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
                                 @ApiParam(name = "orderType",value = "20紧急呼叫22安防工单")
                                 @RequestParam(value = "orderType") String orderType) {
        try {
            JSONObject emergencyAssistanceProcess = assistanceService.getEmergencyAssistanceProcess(orderid, orderType);
            if (null == emergencyAssistanceProcess) {
                return ObjEnvelop.getError("工单不存在",400 );

+ 290 - 22
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -65,6 +65,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -299,7 +300,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                message.put("orgType",orgDO.getType());
            }
            String url = "/sos/info?id="+assistanceDO.getId()+"&OrderType=20&patient="+assistanceDO.getPatient()+"&patientName="+assistanceDO.getPatientName();
            for (BaseDoctorDO doctorDO:doctorDOS){
                try {
                    if (StringUtils.isNotBlank(doctorDO.getMobile())){
@ -308,7 +309,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                }catch (Exception e){}
                String body = "您好,"+assistanceDO.getPatientName()+"居民发起紧急呼叫,请关注并及时处理。";
                String dingDingBody = "您好,"+assistanceDO.getPatientName()+"居民发起紧急呼叫,请及时处理。";
                messageUtil.sendDoctorGetuiMessage(doctorDO.getId(),"2","/sos/index?tabActive=1","紧急呼叫",body);
                messageUtil.sendDoctorGetuiMessage(doctorDO.getId(),"2",url,"紧急呼叫",body);
                messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","2",dingDingBody,null,null);
                imUtill.sendMDTSocketMessageToDoctor(doctorDO.getId(),message.toString());
            }
@ -447,6 +449,13 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                emergencyOrderVO.setEmergencyWarnConclusionDO(conclusionDO);
            }
        }
        //复核
        List<BaseEmergencyWarnLogDO> review = logDao.findByOrderIdAndType(assistanceDO.getId(),7);
        if(review.size()>0){
            emergencyOrderVO.setReviewWarnLogDO(review.get(0));
        }
        //附加信息 紧急救助无
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
@ -1121,6 +1130,101 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return result;
    }
    /**
     * 记录预警核实日志
     */
    public void addWarnLog(String sessionId,String doctor,Integer type,String content,String ext1){
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if(doctorDO==null){
            return;
        }
        String sql = "SELECT e.id from base_emergency_assistance_order e " +
                "WHERE e.session_id = ? and e.`status` = 1 " +
                "UNION " +
                "SELECT s.id from im_internet_hospital.topics t,wlyy_consult c,base_security_monitoring_order s " +
                "WHERE t.session_id = ? and t.id = c.id " +
                "and c.relation_code = s.id and s.`status` = 1 ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{sessionId,sessionId});
        for (Map<String,Object> map:list){
            String orderId = map.get("id")+"";
            if(type==8){
                List<BaseEmergencyWarnLogDO> logDOS = logDao.findByOrderIdAndType(orderId,type);
                if(logDOS.size()==0){
                    //新增 type =8 9
                    BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                    logDO.setUserCode(doctor);
                    logDO.setUserName(doctorDO.getName());
                    logDO.setOrderId(orderId);
                    logDO.setUserType(2);
                    logDO.setCreateTime(new Date());
                    logDO.setContent("发起im会话");
                    logDO.setType(type);
                    logDao.save(logDO);
                }
            }else {
                List<BaseEmergencyWarnLogDO> logDOS = logDao.findByOrderIdAndExt1(orderId,ext1);
                if(logDOS.size()==0){
                    BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                    logDO.setUserCode(doctor);
                    logDO.setUserName(doctorDO.getName());
                    logDO.setOrderId(orderId);
                    logDO.setUserType(2);
                    logDO.setCreateTime(new Date());
                    logDO.setContent(content);
                    logDO.setType(type);
                    logDO.setExt1(ext1);
                    logDao.save(logDO);
                }else if(type==9){
                    //更新9
                    BaseEmergencyWarnLogDO logDO = logDOS.get(0);
                    logDO.setContent(content);
                    logDao.save(logDO);
                }
            }
        }
    }
    /**
     * 预警复核
     * @return
     */
    public JSONObject preWarningReview(String orderId,String doctor,String content){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO one = emergencyAssistanceDao.findOne(orderId);
        if (one==null){
            String failMsg = "工单不存在" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        String orgCode = permissionService.getDoctorOrg(doctor);
        if(!orgCode.equals(one.getOrgCode())){
            String failMsg = "该操作没权限" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (null!=doctorDO){
            BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
            logDO.setUserCode(doctor);
            logDO.setUserName(doctorDO.getName());
            logDO.setOrderId(orderId);
            logDO.setUserType(2);
            logDO.setCreateTime(new Date());
            logDO.setContent(content);
            logDO.setType(7);
            logDao.save(logDO);
        }
        result.put("resultFlag", 1);
        result.put("resultMsg", "success");
        return result;
    }
    public JSONObject responseOrder(String orderId,String doctor){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO one = emergencyAssistanceDao.findOne(orderId);
@ -1504,43 +1608,207 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    }
    public JSONObject getEmergencyAssistanceProcess(String orderId,String orderType){
        JSONObject jsonObject = new JSONObject();
        String eaSql = " ";
        List<Map<String, Object>> maps = new ArrayList<>();
        if ("20".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                    "from base_emergency_assistance_order WHERE id = '"+orderId+"'";
            eaSql   = "SELECT o.`status`,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') AS createTime,o.patient,o.team_code,'紧急呼叫' AS serveDesc,dd.photo " +
                    ",o.serve_lat serveLat,o.serve_lon serveLon,o.order_source orderSource,o.patient " +
                    "from base_emergency_assistance_order o " +
                    "LEFT JOIN wlyy_devices wd on wd.device_code=o.device_sn " +
                    "LEFT JOIN dm_device dd on dd.category_code = wd.category_code " +
                    " WHERE o.id = ?";
        }
        if ("22".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                "from base_security_monitoring_order WHERE id = '"+orderId+"'";
        }
        maps = jdbcTemplate.queryForList(eaSql);
            eaSql   = "SELECT o.`status`,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') AS createTime,o.patient,o.team_code,o.serve_desc serveDesc,dd.photo " +
                    ",o.serve_lat serveLat,o.serve_lon serveLon,o.order_source orderSource,o.patient " +
                    "from base_security_monitoring_order o  " +
                    "LEFT JOIN wlyy_devices wd on wd.device_code=o.device_sn " +
                    "LEFT JOIN dm_device dd on dd.category_code = wd.category_code " +
                "  WHERE o.id = ?";
        }
        maps = jdbcTemplate.queryForList(eaSql,new Object[]{orderId});
        if (maps.size()==0) {
            return null;
        }
        for (Map<String, Object> map : maps) {
            jsonObject.put("status",map.get("status"));
            jsonObject.put("createTime",map.get("createTime"));
        //发起预警
        JSONObject start = new JSONObject();
        Map<String, Object> startMap = maps.get(0);
        String createTime = startMap.get("createTime")+"";
        start.put("createTime",createTime);
        start.put("status",startMap.get("status"));
        start.put("photo",startMap.get("photo"));
        start.put("serveLat",startMap.get("serveLat"));
        start.put("serveLon",startMap.get("serveLon"));
        start.put("serveDesc",startMap.get("serveDesc"));
        jsonObject.put("start",start);
        String patient = startMap.get("patient")+"";
        String teamCode = startMap.get("team_code")+"";
        //预警推送
        JSONObject pushLog = new JSONObject();
        pushLog.put("family",patientFamilyPushLog(patient,orderId,createTime));
        pushLog.put("docotr",doctorPushLog(orderId,teamCode,createTime));
        jsonObject.put("pushLog",pushLog);
        //其他日志
        List<BaseEmergencyWarnLogDO> warnLogDOList = logDao.findByOrderId(orderId);
        Map<Integer,List<BaseEmergencyWarnLogDO>> resultMap = warnLogDOList.stream().collect(Collectors.groupingBy(e -> e.getType()));
        //预警核实
        List<BaseEmergencyWarnLogDO> check = new ArrayList<>();
        if(resultMap.containsKey(8)){
            check.addAll(resultMap.get(8));
        }
        if(resultMap.containsKey(9)){
            check.addAll(resultMap.get(9));
        }
        if(resultMap.containsKey(10)){
            check.addAll(resultMap.get(10));
        }
        if(check.size()>0){
            check.forEach(logDO->{
                if(logDO.getUserType()==1){
                    logDO.setUserTypeName("居民");
                }else{
                    logDO.setUserTypeName("社工");
                }
            });
            check = check.stream().sorted(Comparator.comparing(BaseEmergencyWarnLogDO::getCreateTime)).collect(Collectors.toList());
            jsonObject.put("check",check);
        }
        String sql = "select user_name AS userName,create_time AS createTime,content,type from base_emergency_warn_log where (user_type = 2 and order_id = '"+orderId+"' and type IS NOT NULL) " +
                " OR (user_type = 1 AND order_id = '"+orderId+"' and type IS NOT NULL) order by create_time,type ASC ";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql);
        jsonObject.put("type5_status",0);
        jsonObject.put("result",result);
        for (Map<String, Object> map : result) {
            if (map.get("type").equals(5)) {
                jsonObject.put("type5_status",1);
        //预警处置
        List<BaseEmergencyWarnLogDO> dealWith = new ArrayList<>();
        if(resultMap.containsKey(2)){
            dealWith.addAll(resultMap.get(2));
        }
        if(resultMap.containsKey(3)){
            dealWith.addAll(resultMap.get(3));
        }
        if(resultMap.containsKey(4)){
            dealWith.addAll(resultMap.get(4));
        }
        if(dealWith.size()>0){
            dealWith.forEach(logDO->{
                if(logDO.getUserType()==1){
                    logDO.setUserTypeName("居民");
                }else{
                    logDO.setUserTypeName("社工");
                }
            });
            dealWith = dealWith.stream().sorted(Comparator.comparing(BaseEmergencyWarnLogDO::getCreateTime)).collect(Collectors.toList());
            jsonObject.put("dealWith",dealWith);
        }
        //处置结论
        List<BaseEmergencyWarnLogDO> conclusion = resultMap.get(5);
        if(conclusion!=null){
            BaseEmergencyWarnLogDO logDO = conclusion.get(0);
            if(logDO.getUserType()==1){
                logDO.setUserTypeName("居民");
            }else{
                logDO.setUserTypeName("社工");
            }
            jsonObject.put("conclusion",logDO);
        }
        //预警复核
        List<BaseEmergencyWarnLogDO> review = resultMap.get(7);
        if(review!=null){
            BaseEmergencyWarnLogDO logDO = review.get(0);
            if(logDO.getUserType()==1){
                logDO.setUserTypeName("居民");
            }else{
                logDO.setUserTypeName("社工");
            }
            jsonObject.put("review",logDO);
        }
        //取消
        List<BaseEmergencyWarnLogDO> cancel = resultMap.get(6);
        if(cancel!=null){
            BaseEmergencyWarnLogDO logDO = cancel.get(0);
            if(logDO.getUserType()==1){
                logDO.setUserTypeName("居民");
            }else{
                logDO.setUserTypeName("社工");
            }
            jsonObject.put("cancel",logDO);
        }
        jsonObject = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(jsonObject,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        return jsonObject;
    }
    /**
     * 家属推送日志
     * @param patient
     * @param orderId
     * @return
     */
    public List<Map<String, Object>> patientFamilyPushLog(String patient,String orderId,String createTime){
        List<Map<String, Object>> noticePersons = new ArrayList<>();
        JSONArray familyArr = familyMemberService.getPatientMembers(patient, null, null, null, "3");
        for (int i = 0; i < familyArr.size(); i++) {
            String patientId = familyArr.getJSONObject(i).getString("id");
            BasePatientDO patientDO1 = patientDao.findById(patientId);
            Map<String, Object> noticeObj = new HashMap<>();
            noticeObj.put("type", "0");
            noticeObj.put("typeName", "家属");
            noticeObj.put("id", patientDO1.getId());
            noticeObj.put("name", patientDO1.getName());
            noticeObj.put("photo", patientDO1.getPhoto());
            noticeObj.put("mobile", patientDO1.getMobile());
            noticeObj.put("status", 0);
            noticeObj.put("statusName", "未读");
            noticeObj.put("createTime",createTime);
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(orderId, patientId);
            if (messageDO != null) {
                noticeObj.put("createTime",DateUtil.dateToStrLong(messageDO.getCreateTime()));
                if (StringUtils.isNotBlank(messageDO.getIsRead())) {
                    noticeObj.put("status", Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead()) == 1) {
                        noticeObj.put("statusName", "已读");
                    }
                }
            }
            noticePersons.add(noticeObj);
        }
        return noticePersons;
    }
    /**
     * 医生推送日志
     * @return
     */
    public List<Map<String, Object>> doctorPushLog(String orderId,String teamCode,String createTime){
        List<Map<String, Object>> noticePersons = new ArrayList<>();
        List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembersByLevel(teamCode,2);
        for (BaseDoctorDO doctorDO:doctorDOS) {
            Map<String,Object> noticeObj = new HashMap<>();
            noticeObj.put("type","1");
            noticeObj.put("typeName","社工");
            noticeObj.put("id",doctorDO.getId());
            noticeObj.put("name",doctorDO.getName());
            noticeObj.put("photo",doctorDO.getPhoto());
            noticeObj.put("mobile",doctorDO.getMobile());
            noticeObj.put("doctorLat",doctorDO.getDoctorLat());
            noticeObj.put("doctorLon",doctorDO.getDoctorLon());
            noticeObj.put("status",0);
            noticeObj.put("statusName","未响应");
            noticeObj.put("createTime",createTime);
            EmergencyWarnDoctorResponseDO logDO = emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctorDO.getId(),orderId);
            if (logDO!=null){
                noticeObj.put("status",1);
                noticeObj.put("statusName","已响应");
                noticeObj.put("createTime",DateUtil.dateToStrLong(logDO.getResponseTime()));
            }
            noticePersons.add(noticeObj);
        }
        return noticePersons;
    }
    public int phoneLogSave(BaseEmergencyWarnLogDO baseEmergencyWarnLogDO,Integer type){
        switch (type) {
            case 1:

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceManageService.java

@ -67,8 +67,8 @@ public class DeviceManageService extends BaseJpaService<BaseDeviceRepairEntity,B
    }
    /*设备详细信息*/
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null);
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn,String doctorId,String orderId) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null,doctorId,orderId);
    }
    /*监护信息*/

+ 36 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -927,7 +927,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param deviceSn 设备sn码
     * @return
     */
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day) throws Exception {
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day,String doctor,String orderId) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
@ -1017,6 +1017,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            if ("4".equals(device.getCategoryCode()) || "7".equals(device.getCategoryCode())|| "16".equals(device.getCategoryCode())) {
                devInfo.put("sosContactsDOS", contactsService.getPatientSosContacts(patient));
            }
            String content = "调阅";
            com.alibaba.fastjson.JSONObject devInfoObj = JSON.parseObject(JSON.toJSONString(devInfo, SerializerFeature.WriteMapNullValue));
            switch (device.getCategoryCode()) {
                case "1"://血压设备
@ -1028,6 +1029,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    String bloodPressureSql = ssql + " AND type = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(bloodPressureSql);
                    devInfoObj.put("bloodPressure",dataList); //血压
                    content +="血压监测";
                    break;
                case "2"://血糖设备
                    dataSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 ";
@ -1038,6 +1040,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    recordSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1  AND status = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(recordSql);
                    devInfoObj.put("bloodSugar", dataList);          //血糖异常数据
                    content +="血糖监测";
                    break;
                case "4"://手表 围栏与轨迹
                    if (StringUtils.isBlank(day)) {
@ -1047,6 +1050,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    //轨迹动态
                    JSONArray locations = getX1Locations(deviceSn, day.replace("-", ""));
                    devInfoObj.put("routes", locations);
                    content +="防走失监测";
                    break;
                case "7"://报警器 紧急工单
                    com.alibaba.fastjson.JSONObject response = getAqgDeviceInfo2(deviceSn);
@ -1060,6 +1064,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    } else {
                        devInfoObj.put("contactStatus",1);
                    }
                    content +="SOS紧急呼叫器";
                    break;
                case "12"://监控 视频地址
                    com.alibaba.fastjson.JSONObject tmp = ysDeviceService.getDeviceLiveAddress(patient, deviceSn, 1, null);
@ -1069,9 +1074,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    } else {
                        devInfoObj.put("monitorInfo", tmp.getJSONObject(ResponseContant.resultMsg));
                    }
                    content +="防跌倒视频监测";
                    break;
                case "13"://睡眠带 获取当天睡眠详情
                    securityMonitoringOrderService.preventOutOfBed(devInfoObj, patient, false, day);
                    content +="睡眠监测";
                    break;
                case "14"://气感报警器 当天监测记录以及最新浓度
                    if (StringUtils.isBlank(day)) {
@ -1081,10 +1088,12 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    devInfoObj.put("monitorInfo", listTmp);
                    devInfoObj.put("day", day);
                    securityMonitoringOrderService.preventGasLeakage(devInfoObj, patient, false);
                    content +="燃气泄漏监测";
                    break;
                case "15"://烟感报警器 获取最新浓度
                    securityMonitoringOrderService.preventFire(devInfoObj, patient, deviceSn, false);
                    devInfoObj.put("day", DateUtil.getStringDateShort());
                    content +="火灾监测";
                    break;
                case "16":
                    if (StringUtils.isBlank(day)) {
@ -1143,17 +1152,43 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                            devInfoObj.put("isNotAlarm","未报警");
                        }
                    }
                    content +="防走失监测";
                    break;
                case "18"://日常用水监测
                    content +="日常用水监测";
                    break;
                case "19": //门禁 todo 出入记录
                    patientFaceService.findFaceRecord(patient,day,devInfoObj);
                    content +="人脸识别检测";
                    break;
                case "20": //电表 todo 日常用电情况
                    content +="日常用电监测";
                    break;
                case "21": //天然气 todo 天然气情况
                    naturalGasRecord(patientDO.getIdcard(),devInfoObj);
                    content +="天然气使用监测";
                    break;
                default:
                    content +="智能设备";
                    break;
            }
            //记录日志
            if(StringUtils.isNotBlank(doctor)&&StringUtils.isNotBlank(orderId)){
                BaseDoctorDO doctorDO = doctorDao.findById(doctor);
                if(doctorDO!=null){
                    content+="详情页";
                    BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                    logDO.setUserCode(doctor);
                    logDO.setUserName(doctorDO.getName());
                    logDO.setOrderId(orderId);
                    logDO.setUserType(2);
                    logDO.setCreateTime(new Date());
                    logDO.setContent(content);
                    logDO.setType(10);
                    logDao.save(logDO);
                }
            }
//        }
                result.put(ResponseContant.resultFlag,ResponseContant.success);

+ 7 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -302,6 +302,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            message.put("orgType", orgDO.getType());
        }
        String url = "/sos/info?id="+orderDO.getId()+"&OrderType=22";
        for (BaseDoctorDO doctorDO : doctorDOS) {
            try {
                if (StringUtils.isNotBlank(doctorDO.getMobile())) {
@ -311,7 +312,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            }
            String body = "您好," + orderDO.getPatientName() + "居民" + orderDO.getServeDesc() + ",请关注并及时处理。";
            String dingDingBody = orderDO.getPatientName()+"居民存在异常情况,请及时处理,异常内容:"+orderDO.getServeDesc()+"。";
            messageUtil.sendDoctorGetuiMessage(doctorDO.getId(), "1", "/securityMonitoring/index", "安防紧急预警", body);
            messageUtil.sendDoctorGetuiMessage(doctorDO.getId(), "1", url, "安防紧急预警", body);
            messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","1",dingDingBody,null,null);
            imUtil.sendMDTSocketMessageToDoctor(doctorDO.getId(), message.toString());
        }
@ -442,6 +443,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                emergencyOrderVO.setEmergencyWarnConclusionDO(conclusionDO);
            }
        }
        //复核
        List<BaseEmergencyWarnLogDO> review = logDao.findByOrderIdAndType(orderDO.getId(),7);
        if(review.size()>0){
            emergencyOrderVO.setReviewWarnLogDO(review.get(0));
        }
        //附加信息 电子围栏状态
        if (2 == orderDO.getOrderSource() || 8 == orderDO.getOrderSource()) {//手表/拐杖
            Map<String, Object> map = new HashMap<>();

+ 72 - 25
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -3723,17 +3723,22 @@ public class StatisticsService {
    }
    //健康设备-安防设备 列表
    public PageEnvelop healthySecurityDeviceList(String name, String deviceSn, String categoryCode, String contactStatus, String type, Integer page, Integer size) {
    public PageEnvelop healthySecurityDeviceList(String name, String deviceSn,String teamId, String categoryCode, String contactStatus, String type, Integer page, Integer size) {
        String nameSql = "";
        String deviceSnSql = "";
        String categoryCodeSql = "";
        String contactStatusSql = "";
        String totalSql = "";
        String teamCodeSql = "";
        if (StringUtils.isNotBlank(contactStatus))
            contactStatusSql = " AND wd.contact_status = '" + contactStatus + "'";
        if (StringUtils.isNotBlank(name)) nameSql = " AND p.name LIKE '%" + name + "%'";
        if (StringUtils.isNotBlank(deviceSn)) deviceSnSql = " AND pd.device_sn = '" + deviceSn + "'";
        if(StringUtils.isNotBlank(teamId)){
            teamCodeSql += " INNER JOIN base_service_package_sign_record sr ON CONVERT( sr.patient USING utf8 ) = p.id AND sr.STATUS = 1 AND sr.`status` = 1 "+
                    " INNER JOIN base_service_package_record r ON sr.id = r.sign_id  and r.team_code = '"+teamId+"'";
        }
        String filter="AND pd.USER NOT IN ( SELECT DISTINCT dict_code FROM wlyy_hospital_sys_dict WHERE ( dict_name = 'jkzl_user' OR dict_name = 'jkzl_older' ) AND dict_code IS NOT NULL ) ";
        /*String sqltmp = " SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE (dict_name = 'jkzl_child' or dict_name = 'jkzl_older' OR dict_name ='jkzl_helper' OR dict_name= 'jkzl_olderRelative' OR dict_name ='jkzl_user') ";
@ -3754,18 +3759,18 @@ public class StatisticsService {
            if (StringUtils.isNotBlank(categoryCode))
                categoryCodeSql = " AND pd.category_code = '" + categoryCode + "'";
            deviceSql = "SELECT p.id AS patient,pd.id AS id,pd.device_name AS deviceName,pd.device_sn AS deviceSn,dd.photo,'健康设备' AS deviceType,p.`name`,p.mobile,p.phone,wd.contact_status * 1 AS contactStatus,pd.category_code as categoryCode " +
            deviceSql = "SELECT distinct p.id AS patient,pd.id AS id,pd.device_name AS deviceName,pd.device_sn AS deviceSn,dd.photo,'健康设备' AS deviceType,p.`name`,p.mobile,p.phone,wd.contact_status * 1 AS contactStatus,pd.category_code as categoryCode " +
                    " FROM " +
                    " wlyy_patient_device pd " +
                    " INNER JOIN wlyy_devices wd ON pd.device_sn = wd.device_code " +
                    " INNER JOIN base_patient p ON pd.USER = p.id AND pd.del = 0 AND p.del = 1    " +
                    " INNER JOIN base_patient p ON pd.USER = p.id AND pd.del = 0 AND p.del = 1    " + teamCodeSql +
                    " LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
                    "WHERE " +
                    " 1=1 "+filter + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
            totalSql = "SELECT count(pd.id) FROM " +
            totalSql = "SELECT count(distinct pd.id) FROM " +
                    " wlyy_patient_device pd " +
                    " INNER JOIN wlyy_devices wd ON pd.device_sn = wd.device_code " +
                    " INNER JOIN base_patient p ON pd.USER = p.id  AND pd.del = 0  AND p.del = 1  " +
                    " INNER JOIN base_patient p ON pd.USER = p.id  AND pd.del = 0  AND p.del = 1  " + teamCodeSql +
                    " LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
                    " WHERE " +
                    " 1=1 "+filter + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
@ -3777,18 +3782,18 @@ public class StatisticsService {
            if (StringUtils.isNotBlank(categoryCode))
                categoryCodeSql = " AND pd.category_code = '" + categoryCode + "'";
            deviceSql = "SELECT p.id AS patient,pd.id AS id,pd.device_name AS deviceName,pd.device_sn AS deviceSn,dd.photo,'安防设备' AS deviceType,p.`name`,p.mobile,p.phone,wd.contact_status * 1 AS contactStatus,pd.category_code as categoryCode " +
            deviceSql = "SELECT distinct p.id AS patient,pd.id AS id,pd.device_name AS deviceName,pd.device_sn AS deviceSn,dd.photo,'安防设备' AS deviceType,p.`name`,p.mobile,p.phone,wd.contact_status * 1 AS contactStatus,pd.category_code as categoryCode " +
                    " FROM " +
                    " wlyy_patient_device pd " +
                    " INNER JOIN wlyy_devices wd ON pd.device_sn = wd.device_code " +
                    " INNER JOIN base_patient p ON pd.USER = p.id AND pd.del = 0 AND p.del = 1    " +
                    " INNER JOIN base_patient p ON pd.USER = p.id AND pd.del = 0 AND p.del = 1    "+ teamCodeSql +
                    " LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
                    "WHERE " +
                    " 1=1 "+filter + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
            totalSql = "SELECT count(pd.id) FROM " +
            totalSql = "SELECT count(distinct pd.id) FROM " +
                    " wlyy_patient_device pd " +
                    " INNER JOIN wlyy_devices wd ON pd.device_sn = wd.device_code " +
                    " INNER JOIN base_patient p ON pd.USER = p.id  AND pd.del = 0  AND p.del = 1  " +
                    " INNER JOIN base_patient p ON pd.USER = p.id  AND pd.del = 0  AND p.del = 1  " + teamCodeSql +
                    " LEFT JOIN dm_device dd ON pd.category_code = dd.category_code " +
                    " WHERE " +
                    " 1=1 "+filter + nameSql + deviceSnSql + categoryCodeSql + contactStatusSql;
@ -3842,58 +3847,99 @@ public class StatisticsService {
    //获取设备
    public JSONObject deviceinfoStatisticsNum(String type,String deviceCategory){
    public JSONObject deviceinfoStatisticsNum(String type,String deviceCategory,String teamId){
        JSONObject jsonObject = new JSONObject();
        String teamCodeSql = "";
        if(StringUtils.isNotBlank(teamId)){
            teamCodeSql += " INNER JOIN base_service_package_sign_record sr ON CONVERT( sr.patient USING utf8 ) = p.id AND sr.STATUS = 1 AND sr.`status` = 1 "+
                    " INNER JOIN base_service_package_record r ON sr.id = r.sign_id  and r.team_code = '"+teamId+"'";
        }
        //测试用户
        String testUsqlSql = "SELECT DISTINCT dict_code FROM wlyy_hospital_sys_dict WHERE (dict_name = 'jkzl_user' OR dict_name = 'jkzl_older' ) AND dict_code IS NOT NULL";
        String testUsqlSql = "SELECT DISTINCT dict_code FROM wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_older' AND dict_code IS NOT NULL";
        //类型数量
        String typeTotalSql = "SELECT count(DISTINCT category_code) AS total FROM dm_device WHERE 1=1 AND device_type = "+type+" AND del = 1 GROUP BY device_type";
        if(StringUtils.isNotBlank(teamId)){
            typeTotalSql = "select count(distinct pd.category_code) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                    "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                    "                where  pd.device_type = "+type+"  AND pd.user NOT IN ("+testUsqlSql+") ";
        }
        //离线设备数量
        String offLineDeviceSql="select count(distinct pd.device_sn) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                "                 INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
                "                 INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                "                where dev.contact_status=0  and pd.device_type = "+type+"  AND pd.user NOT IN ("+testUsqlSql+") group by pd.device_type";
        //设备总数
        String deviceTotalSql = "SELECT count(DISTINCT device_code) FROM wlyy_devices WHERE (device_code IS NOT NULL OR device_code <> '') AND device_type = "+type+"";
        if(StringUtils.isNotBlank(teamId)){
            deviceTotalSql = "select count(distinct pd.device_sn) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                    "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                    "                where  pd.device_type = "+type+"  AND pd.user NOT IN ("+testUsqlSql+") ";
        }
        //设备在线量
        String lineDeviceSql ="select count(distinct pd.device_sn) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
                "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                "                where dev.contact_status=1 and pd.device_type = 0  AND pd.user NOT IN ("+testUsqlSql+") group by pd.device_type";
        String deviceCategorySql = "";
        String categoryCodeSql = "";
        String categoryCodeTotalSql = "";
        if (StringUtils.isNotBlank(deviceCategory)){
            deviceCategorySql = " AND device_category= '"+deviceCategory+"' ";
            categoryCodeSql = " AND category_code= '"+deviceCategory+"' ";
            categoryCodeTotalSql = " AND  pd.category_code = '"+deviceCategory+"' ";
        }
        //七天使用      AND device_category= 4  手表
        String sevenDayUseSql ="select count(distinct pd.device_sn) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " +
                "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                "                where pd.device_type = "+type+"  AND EXISTS(SELECT 1 FROM device_data_push_log pl WHERE pl.device_sn = pd.device_sn "+deviceCategorySql+" AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= pl.create_time ) AND pd.user NOT IN ("+testUsqlSql+") group by pd.device_type";
        //设备类型总数
        String deviceCodeTotalSql ="SELECT count(DISTINCT device_code) FROM wlyy_devices WHERE (device_code IS NOT NULL OR device_code <> '') AND category_code = '"+deviceCategory+"'";
        String deviceCodeTotalSql ="SELECT count(DISTINCT device_code) FROM wlyy_devices WHERE (device_code IS NOT NULL OR device_code <> '') " + categoryCodeSql;
        if(StringUtils.isNotBlank(teamId)){
            deviceCodeTotalSql = "select count(distinct pd.device_sn) total from wlyy_patient_device pd INNER JOIN wlyy_devices dev on pd.device_sn = dev.device_code " +
                    "                INNER JOIN base_patient p on pd.user = p.id and pd.del=0 and p.del=1 " + teamCodeSql +
                    "                where pd.user NOT IN ("+testUsqlSql+") "+categoryCodeTotalSql;
        }
        //long start=System.currentTimeMillis();
        Integer typeTotal = 0;
        Integer offLineDevice = 0;
        Integer deviceTotal = 0;
        Integer lineDevice = 0;
        List<Integer> total = jdbcTemplate.queryForList(typeTotalSql, Integer.class);
        //long end=System.currentTimeMillis();
        //System.out.println("类型数量运行多少毫秒:" + "=" + (end-start));
        jsonObject.put("typeTotal",total.get(0));
        if(total.size()>0){
            typeTotal = total.get(0);
        }
        jsonObject.put("typeTotal",typeTotal);
        total = jdbcTemplate.queryForList(offLineDeviceSql,Integer.class);
        jsonObject.put("offLineDevice",total.get(0));
        if(total.size()>0){
            offLineDevice = total.get(0);
        }
        jsonObject.put("offLineDevice",offLineDevice);
        total = jdbcTemplate.queryForList(deviceTotalSql,Integer.class);
        jsonObject.put("deviceTotal",total.get(0));
        if(total.size()>0){
            deviceTotal = total.get(0);
        }
        jsonObject.put("deviceTotal",deviceTotal);
        total = jdbcTemplate.queryForList(lineDeviceSql,Integer.class);
        jsonObject.put("lineDevice",total.get(0));
        if(total.size()>0){
            lineDevice = total.get(0);
        }
        jsonObject.put("lineDevice",lineDevice);
        total = jdbcTemplate.queryForList(sevenDayUseSql,Integer.class);
        Integer deviceCodeTotal = jdbcTemplate.queryForObject(deviceCodeTotalSql,Integer.class);
        Float num = 0F;
        if (total.size()>0) {
            num= (float)total.get(0)/(float)deviceCodeTotal;
            Integer deviceCodeTotal = jdbcTemplate.queryForObject(deviceCodeTotalSql,Integer.class);
            if(deviceCodeTotal>0){
                num= (float)total.get(0)/(float)deviceCodeTotal;
            }
        }
        jsonObject.put("sevenDayUse",num*100);
        return jsonObject;
@ -3925,7 +3971,8 @@ public class StatisticsService {
                " base_doctor d WHERE sr.id = r.sign_id AND sr.STATUS = 1 AND sr.patient = '"+patient+"' AND r.service_package_id = i.id AND i.del = 1 AND m.team_code = r.team_code " +
                " AND sr.id = r.sign_id AND m.doctor_code = d.id AND m.del = '1'";
        //助老元
        String dHelpSql = "SELECT DISTINCT ph.doctor,ph.doctor_name as name,d.mobile,d.photo,case WHEN d.openid IS NOT NULL THEN 1 WHEN d.openid <> '' THEN 1 ELSE 0 END AS online FROM base_patient_helper ph INNER JOIN base_doctor d  WHERE ph.patient= '"+patient+"' AND ph.del = 1 GROUP BY ph.id";
        String dHelpSql = "SELECT DISTINCT d.id doctor,d.name,d.mobile,d.photo,case WHEN d.openid IS NOT NULL THEN 1 WHEN d.openid <> '' THEN 1 ELSE 0 END AS online" +
                " FROM base_patient_helper ph INNER JOIN base_doctor d  on ph.doctor=d.id WHERE ph.patient= '"+patient+"' AND ph.del = 1 ";
        List<Map<String, Object>> doctorList = jdbcTemplate.queryForList(doctorSql);
        List<Map<String, Object>> familyList = jdbcTemplate.queryForList(familySql);
        List<Map<String, Object>> helperList = jdbcTemplate.queryForList(dHelpSql);

+ 127 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java

@ -350,4 +350,131 @@ public class HealthUploadPoint extends EnvelopRestEndpoint {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexHeader")
    @ApiOperation(value = "首页头部统计", notes = "首页头部统计")
    public Envelop selectIndexHeader(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                         @RequestParam(value = "dept", required = false) String dept,
                                     @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                         @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexHeader(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexScheduleDept")
    @ApiOperation(value = "首页出差科室统计", notes = "首页出差科室统计")
    public Envelop selectIndexScheduleDept(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                               @RequestParam(value = "dept", required = false) String dept,
                                           @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                               @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexScheduleDept(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexScheduleCityName")
    @ApiOperation(value = "首页出差分布统计", notes = "首页出差分布统计")
    public Envelop selectIndexScheduleCityName(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                                   @RequestParam(value = "dept", required = false) String dept,
                                               @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                                   @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexScheduleCityName(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexScheduleTown")
    @ApiOperation(value = "首页本地分布统计", notes = "首页本地分布统计")
    public Envelop selectIndexScheduleTown(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                               @RequestParam(value = "dept", required = false) String dept,
                                           @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                               @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexScheduleTown(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexYichangList")
    @ApiOperation(value = "首页异常实时情况", notes = "首页异常实时情况")
    public Envelop selectIndexYichangList(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                              @RequestParam(value = "dept", required = false) String dept,
                                          @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                              @RequestParam(value = "level", required = false) Integer level,
                                          @ApiParam(name = "startDate", value = "开始时间")
                                              @RequestParam(value = "startDate", required = false) String startDate,
                                          @ApiParam(name = "endDate", value = "结束时间")
                                              @RequestParam(value = "endDate", required = false) String endDate,
                                          @ApiParam(name = "condition", value = "条件(医生名称)")
                                              @RequestParam(value = "condition", required = false) String condition) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexYichangList(dept,level,startDate,endDate,condition));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexTotalCircle")
    @ApiOperation(value = "首页上报分析", notes = "首页上报分析")
    public Envelop selectIndexTotalCircle(@ApiParam(name = "flag", value = "1周2月")
                                              @RequestParam(value = "flag", required = false) Integer flag,
                                          @ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                          @RequestParam(value = "dept", required = false) String dept,
                                          @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                              @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexTotalCircle(flag,dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexNucleicTotal")
    @ApiOperation(value = "首页核酸检测情况", notes = "首页核酸检测情况")
    public Envelop selectIndexNucleicTotal(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                               @RequestParam(value = "dept", required = false) String dept,
                                           @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                               @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexNucleicTotal(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexNewAdd")
    @ApiOperation(value = "首页当日新增统计", notes = "首页当日新增统计")
    public Envelop selectIndexNewAdd(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                         @RequestParam(value = "dept", required = false) String dept,
                                     @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                         @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexNewAdd(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectIndexDeptList")
    @ApiOperation(value = "首页未报科室统计", notes = "首页未报科室统计")
    public Envelop selectIndexDeptList(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                           @RequestParam(value = "dept", required = false) String dept,
                                       @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                           @RequestParam(value = "level", required = false) Integer level) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectIndexDeptList(dept,level));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
}

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

@ -1282,10 +1282,24 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                            String mobile = patientDO.getMobile();
                                            String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                            String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                            WlyyHospitalSysDictDO hospitalSysDictDO = wlyyHospitalSysDictDao.findById("natConfigTestNew");
                                            String addres = "我院五号楼北侧(急诊部后侧)";
                                            String timeDes = "6-8小时";
                                            if (hospitalSysDictDO!=null){
                                                com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(hospitalSysDictDO.getDictValue());
                                                for (int i=0;i<array.size();i++){
                                                    JSONObject object1 = array.getJSONObject(i);
                                                    String chargeCode = object1.getString("chargeCode");
                                                    if (natAppointmentDO.getChargeCode().equalsIgnoreCase(chargeCode)){
                                                        addres = "我院发热门诊";
                                                        timeDes = "2小时";
                                                    }
                                                }
                                            }
                                            String first = "尊敬的用户"+natAppointmentDO.getName()+",您已完成线上自助核酸检测预约申请";
                                            String contentMsg = "申请人:"+natAppointmentDO.getName()+"\r\n 预约时间:"+date+" \r\n发票流水号:"+waitPayDetailVO.getRecipeNo();
                                            String remark="1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                                    "2、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                            String remark="1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至"+addres+"核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                                    "2、核酸检测标本采集"+timeDes+"后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                            String responseMsg="";
                                            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
@ -1313,10 +1327,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                logger.info("支付宝发送模板消息开始111");
                                                String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                                String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"3",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo());
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"3",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo(),natAppointmentDO.getId());
                                                logger.info("支付宝发送模板消息结束1111");
                                                logger.info("支付宝发送模板消息结束22222");
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"13",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo());
                                                prescriptionService.sendAlipayMessage(natAppointmentDO.getPatientId(),"13",waitPayDetailVO.getFee(),url,date,waitPayDetailVO.getRecipeNo(),natAppointmentDO.getId());
                                                logger.info("支付宝发送模板消息结束2222222");
                                            }
                                        }

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

@ -423,7 +423,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                return success(prescriptionService.findPatientCard(patient));
                return success(prescriptionService.findPatientCardList(patient));
            } else if ("xm_hcyy_wx".equalsIgnoreCase(wxId)) {
                String result = hcyyEntranceService.findPatientCard(patient);
                JSONArray jsonArray = new JSONArray();
@ -3474,9 +3474,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @ApiParam(name = "realorder", value = "realorder")
                                     @RequestParam(value = "realorder", required = false) String realorder,
                                     @ApiParam(name = "reserverTime", value = "reserverTime")
                                     @RequestParam(value = "reserverTime", required = false) String reserverTime) throws Exception {
                                     @RequestParam(value = "reserverTime", required = false) String reserverTime,
                                     @ApiParam(name = "id", value = "id")
                                         @RequestParam(value = "id", required = false) Integer id) throws Exception {
        try {
            return success(prescriptionService.sendAlipayMessage(patientId, code, fee, redirdctUrl, reserverTime, realorder));
            return success(prescriptionService.sendAlipayMessage(patientId, code, fee, redirdctUrl, reserverTime, realorder,id));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/WlyyXeekPatientDeviceDao.java

@ -15,6 +15,6 @@ public interface WlyyXeekPatientDeviceDao extends PagingAndSortingRepository<Wly
    WlyyXeekPatientDeviceDO findByDeviceSnAndNameAndSexAndBirthday(String deviceSn,String name,Integer sex,String birthday);
    @Query("from WlyyXeekPatientDeviceDO c where c.patient is null)")
    @Query("from WlyyXeekPatientDeviceDO c where c.patient is null")
    List<WlyyXeekPatientDeviceDO> findNoPatient();
}