瀏覽代碼

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

wangzhinan 10 月之前
父節點
當前提交
4dff168d2e
共有 23 個文件被更改,包括 839 次插入121 次删除
  1. 126 4
      business/base-service/src/main/java/com/yihu/jw/hospital/disease/service/BaseDiseaseHospitalService.java
  2. 12 28
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 12 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/BaseDiseaseSurveyDao.java
  4. 20 1
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  5. 100 0
      business/es-service/src/main/java/com/yihu/jw/es/service/DataService.java
  6. 7 7
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  7. 3 0
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  8. 2 2
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  9. 1 1
      business/im-service/src/main/java/com/yihu/jw/im/service/RobotService.java
  10. 16 0
      common/common-entity/src/db/2024.sql
  11. 1 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/sms/SmsTemplateDO.java
  12. 111 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/BaseDiseaseSurveyDO.java
  13. 2 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  14. 3 50
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  15. 19 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/DsyyPrescriptionCotroller.java
  16. 158 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/specialist/BaseDiseaseHospitalController.java
  17. 6 8
      svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/etl/extract/db/DBPageExtract.java
  18. 26 4
      svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/MysqlToEsQuotaJob.java
  19. 17 0
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/StatisticsController.java
  20. 157 5
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/StatisticsService.java
  21. 5 3
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceUploadService.java
  22. 14 0
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DoctorRehabilitaionInfoController.java
  23. 21 4
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

+ 126 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/disease/service/BaseDiseaseHospitalService.java

@ -2,27 +2,32 @@ package com.yihu.jw.hospital.disease.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.hospital.survey.BaseDiseaseSurveyDO;
import com.yihu.jw.entity.specialist.BaseDiseaseHospitalDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationPlanTemplateDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationTemplateDetailDO;
import com.yihu.jw.hospital.disease.dao.BaseDiseaseHospitalDao;
import com.yihu.jw.hospital.disease.dao.RehabilitationPlanTemplateDao;
import com.yihu.jw.hospital.disease.dao.RehabilitationTemplateDetailDao;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.survey.dao.BaseDiseaseSurveyDao;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.utils.AES;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
@ -38,6 +43,123 @@ public class BaseDiseaseHospitalService extends BaseJpaService<BaseDiseaseHospit
    private RehabilitationTemplateDetailDao templateDetailDao;
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    @Autowired
    private BaseDiseaseSurveyDao baseDiseaseSurveyDao;
    @Autowired
    private BaseSmsTemplateDao baseSmsTemplateDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    //疾病筛查管理发送短信
    public void sendSms(String mobiles,String surveyCodes,String smsTemplateId,String content,String header,String doctor){
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
        Map<String,Integer> map = new HashMap<>();
        String mobile[] = mobiles.split(",");
        for (String key:mobile){
            if(!map.containsKey(key)){
                map.put(key,1);
                try {
                    dsyyPrescriptionService.SendSms(key, content);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        SmsTemplateDO smsTemplateDO = findSmsTemplate(smsTemplateId);
        if(smsTemplateDO==null){
            smsTemplateDO = new SmsTemplateDO();
            smsTemplateDO.setClientId("dsyy");
            smsTemplateDO.setType(SmsTemplateDO.Type.login);
            smsTemplateDO.setCreateTime(new Date());
            smsTemplateDO.setUpdateTime(new Date());
        }
        smsTemplateDO.setContent(content);
        smsTemplateDO.setHeader(header);
        baseSmsTemplateDao.save(smsTemplateDO);
        //添加i健康发送记录
        wlyyBusinessService.addSurveyThird(surveyCodes,doctorDO.getIdcard());
    }
    public SmsTemplateDO findSmsTemplate(String id){
        if(StringUtils.isBlank(id)){
            return null;
        }
        return baseSmsTemplateDao.findById(id).orElse(null);
    }
    //新增和修改短信模板
    public SmsTemplateDO addOrUpdSmsTemplate(SmsTemplateDO smsTemplateDO){
        if (StringUtils.isBlank(smsTemplateDO.getId())) {
            smsTemplateDO.setCreateTime(new Date());
            smsTemplateDO.setUpdateTime(new Date());
        }else {
            smsTemplateDO.setUpdateTime(new Date());
        }
        smsTemplateDO = baseSmsTemplateDao.save(smsTemplateDO);
        return smsTemplateDO;
    }
    //短信模板分页
    public MixEnvelop smsTemplatePage(String header,String clientId, Integer page, Integer size){
        String orderBy = "  order by create_time desc limit "+(page-1)*size+","+size;
        String condition = " ";
        String sql = "SELECT * FROM base_sms_template where 1=1 ";
        if (StringUtils.isNoneBlank(header)){
            condition +=" and header like '%"+header+"%' ";
        }
        if (StringUtils.isNoneBlank(clientId)){
            condition +=" and client_d ='"+clientId+"' ";
        }
        List<SmsTemplateDO> list = jdbcTemplate.query(sql+condition+orderBy, new BeanPropertyRowMapper<>(SmsTemplateDO.class));
        String sqlCount ="select COUNT(1) as total from base_sms_template where 1=1 ";
        Long count = jdbcTemplate.queryForObject(sqlCount+condition,Long.class);
        return MixEnvelop.getSuccessListWithPage("success", list, page, size, count);
    }
    //新增和修改疾病筛查配置
    public BaseDiseaseSurveyDO addOrUpd(BaseDiseaseSurveyDO diseaseSurveyDO){
        if (StringUtils.isBlank(diseaseSurveyDO.getId())) {
            diseaseSurveyDO.setCreateTime(new Date());
        }
        diseaseSurveyDO = baseDiseaseSurveyDao.save(diseaseSurveyDO);
        return diseaseSurveyDO;
    }
    //查询疾病筛查配置列表
    public MixEnvelop diseaseSurveyPage(String name,String dept,String doctor,String surveyCode, String status, Integer page, Integer size){
        String orderBy = "  order by create_time desc limit "+(page-1)*size+","+size;
        String condition = " ";
        String sql = "SELECT * FROM base_disease_survey where 1=1 ";
        if (StringUtils.isNoneBlank(name)){
            condition +=" and name like '%"+name+"%' ";
        }
        if (StringUtils.isNoneBlank(status)){
            condition +=" and status ='"+status+"' ";
        }
        if (StringUtils.isNoneBlank(surveyCode)){
            condition +=" and survey_code ='"+surveyCode+"' ";
        }
        if (StringUtils.isNoneBlank(dept)){
            condition +=" and dept like '%"+dept+"%' ";
        }
        if (StringUtils.isNoneBlank(doctor)){
            condition +=" and doctor like '%"+doctor+"%' ";
        }
        List<BaseDiseaseSurveyDO> list = jdbcTemplate.query(sql+condition+orderBy, new BeanPropertyRowMapper<>(BaseDiseaseSurveyDO.class));
        for (BaseDiseaseSurveyDO surveyDO : list){
            if("1".equals(surveyDO.getStatus())){
                surveyDO.setStatusName("启用");
            }else if("0".equals(surveyDO.getStatus())){
                surveyDO.setStatusName("禁用");
            }
        }
        String sqlCount ="select COUNT(1) as total from base_disease_survey where 1=1 ";
        Long count = jdbcTemplate.queryForObject(sqlCount+condition,Long.class);
        return MixEnvelop.getSuccessListWithPage("success", list, page, size, count);
    }
    /**
     * 新增和修改专病配置

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

@ -7301,7 +7301,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    @Transactional(readOnly = true)
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(String iswork, String patientid, String orgCode, String dept,
                                                            String diseaseKey, String doctorNameKey,
                                                             String diseaseId,String diseaseKey, String doctorNameKey,
                                                            String jobTitleNameKey, String outpatientType,
                                                            String keyName, String workingTime, String consultStatus, String chargType, String consutlSort,
                                                             String isAttention,String isNurse, Integer page, Integer pagesize) {
@ -7368,7 +7368,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
        }
        sql += " WHERE  1=1 and h.del = '1' ";
@ -7428,6 +7427,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                params.put("dept", dept);
            }
        }
        if (StringUtils.isNotBlank(diseaseId)) {
            List<Map<String,Object>> listTmp = jdbcTemplate.queryForList("select dept from base_disease_hospital where id='"+diseaseId+"' ");
            if(listTmp.size()>0){
                String depts = listTmp.get(0).get("dept")+"";
                if(depts.contains(",")){
                    sql += " AND h.dept_code in ('"+depts.replace(",","','")+"')  ";
                }else {
                    sql += " AND h.dept_code = '"+depts+"' ";
                }
            }
        }
        if ("1".equals(isNurse)) {
            sql += " AND jt.saas_id = 'hlys' ";
@ -7492,16 +7502,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        /*list.stream().forEach(e->{
            if (null==e.get("consultStatus")){
                e.put("consultStatus",0);
            }
            if (null==e.get("workTotal")){
                e.put("workTotal",0);
            }
        });
        list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
        String hospital="";
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
@ -7513,22 +7513,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            /*List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            if(null!=map.get("chargeType")){
                String chargeType = map.get("chargeType").toString();
                if (chargeType.contains(",")){
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if (StringUtils.isNoneBlank(deptTyepCode)){
                    sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
                }
                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            }
            map.put("chargeTypeList",chargeDictDOLists);*/
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            String sqlCharge = "SELECT\n" +
                    "\tm.req_fee as \"twfzFee\",\n" +

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/BaseDiseaseSurveyDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.BaseDiseaseSurveyDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
 * Created by yeshijie on 2024/8/19.
 */
public interface BaseDiseaseSurveyDao extends JpaRepository<BaseDiseaseSurveyDO, String>, JpaSpecificationExecutor<BaseDiseaseSurveyDO> {
}

+ 20 - 1
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -886,6 +886,24 @@ public class WlyyBusinessService {
        return re;
    }
    public JSONObject addSurveyThird(String surveyCodes,String idcard) {
        try {
            String param = "?surveyCodes=" + nullToTransfor(surveyCodes) + "&idcard=" + nullToTransfor(idcard);
            JSONObject re = wlyyHttpService.sendWlyyMesGet("addSurveyThird", param);
            return re;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
    public JSONObject findThirdScreenList(String hospital,String patientName,String startDate,String endDate,String templateCode,
                                          String isDanger,String manageStatus,Integer page,Integer size) {
        String param = "?hospital=" + nullToTransfor(hospital) + "&patientName=" + nullToTransfor(patientName) + "&startDate=" + nullToTransfor(startDate)
                + "&endDate=" + nullToTransfor(endDate)+ "&templateCode=" + nullToTransfor(templateCode)+ "&isDanger=" + nullToTransfor(isDanger)
                + "&manageStatus=" + nullToTransfor(manageStatus)+ "&page=" + page+ "&size=" + size;
        JSONObject re = wlyyHttpService.sendWlyyMesGet("findThirdScreenList", param);
        return re;
    }
    public JSONObject getReservationByDoctorAndSource_IJK(String doctorCode, String patientName, String source) {
        String param = "?doctorCode=" + nullToTransfor(doctorCode) + "&patientName=" + nullToTransfor(patientName) + "&source=" + source;
@ -901,7 +919,8 @@ public class WlyyBusinessService {
            param += "&type=" + nullToTransfor(type);
        }
        param += "&pageNo=" + nullToTransfor(String.valueOf(pageNo)) + "&pageSize=" + nullToTransfor(String.valueOf(pageSize)) + "&patientName=" + nullToTransfor(patientName) +
                "&isDanger=" + nullToTransfor(isDanger) + "&diseaseType=" + nullToTransfor(diseaseType) + "&filterType=" + nullToTransfor(String.valueOf(filterType)) + "&patientCode=" + nullToTransfor(patientCode);
                "&isDanger=" + nullToTransfor(isDanger) + "&diseaseType=" + nullToTransfor(diseaseType) + "&filterType=" +
                nullToTransfor(String.valueOf(filterType)) + "&patientCode=" + nullToTransfor(patientCode);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getScreeList_IJK", param);
        return re;

+ 100 - 0
business/es-service/src/main/java/com/yihu/jw/es/service/DataService.java

@ -0,0 +1,100 @@
package com.yihu.jw.es.service;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.elasticsearch.ElasticSearch7Helper;
import com.yihu.jw.es.util.SaveModel;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Created by yeshijie on 2024/8/15.
 */
@Service
public class DataService {
    private Logger logger = LoggerFactory.getLogger(DataService.class);
    @Autowired
    private ElasticSearch7Helper elasticSearch7Helper;
    @Resource(name="restHighLevelClient")
    private RestHighLevelClient restHighLevelClient;
    @Value("${es.index.Statistics}")
    private String esIndex;
    public void deleteData(String quotaDate, String quotaCode, String timeLevel) {
        try {
            //es超过5w条的删除不干净。循环处理,最多删除10次
            int i = 0;
            int num = delData(quotaDate, quotaCode, timeLevel);
            while (num==50000&&i<10){
                i++;
                TimeUnit.MILLISECONDS.sleep(100);
                num = delData(quotaDate, quotaCode, timeLevel);
                logger.info("============================="+i);
            }
        } catch (Exception e) {
            logger.info("delete error:"+e.getMessage());
        }
    }
    /**
     * 删除 某个指标某一天的某个timelevel的数据
     *
     */
    public int delData(String quotaDate, String quotaCode, String timeLevel) {
        int num = 0;
        try {
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("quotaCode", quotaCode))
                            .must(QueryBuilders.matchQuery("timeLevel", timeLevel))
                            .must(QueryBuilders.matchQuery("quotaDate", quotaDate))
            ).size(50000);//一次取10000条
            List<String> result = elasticSearch7Helper.search(esIndex,searchSourceBuilder);
            List<SaveModel> saveModels = new ArrayList<>();
            for (String s:result){
                SaveModel saveModel = new SaveModel();
                saveModel = JSON.parseObject(s,SaveModel.class);
                saveModels.add(saveModel);
            }
            //根据id批量删除
            BulkRequest bulkRequest = new BulkRequest();
//            bulkRequest.timeout(TimeValue.timeValueSeconds(60));
            for (SaveModel obj : saveModels) {
                bulkRequest.add(new DeleteRequest(esIndex)
                        .id(obj.getId()));
            }
            num = result.size();
            logger.info("delete size:"+num);
            if (saveModels!=null&&saveModels.size()!=0){
                BulkResponse bulkResponse = restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT);
                logger.info(bulkResponse.buildFailureMessage());
                logger.info("delete data count:" + saveModels.size());
                logger.info("delete flag:" + !bulkResponse.hasFailures());
            }
        } catch (Exception e) {
            logger.info("delete error:"+e.getMessage());
        }
        return num;
    }
}

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

@ -5624,9 +5624,9 @@ public class StatisticsEsService {
        String[] periodYear = calculatePreviousYearPeriod(startDate, endDate);
        JSONObject object = new JSONObject();
        //发布量统计
        saveModel = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL,slaveKey1);
        saveModelH = elasticsearchUtil.findOneDateQuotaLevel1(period[0], period[1], area, level, "75", SaveModel.timeLevel_ZL,slaveKey1);
        saveModelT = elasticsearchUtil.findOneDateQuotaLevel1(periodYear[0], periodYear[1], area, level, "75", SaveModel.timeLevel_ZL,slaveKey1);
        saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL);
        saveModelH = elasticsearchUtil.findOneDateQuotaLevel0(period[0], period[1], area, level, "75", SaveModel.timeLevel_ZL);
        saveModelT = elasticsearchUtil.findOneDateQuotaLevel0(periodYear[0], periodYear[1], area, level, "75", SaveModel.timeLevel_ZL);
        Integer publishTotal = saveModel != null ? saveModel.getResult1().intValue() : 0;
        Integer publishTotalT = saveModelT != null ? saveModelT.getResult1().intValue() : 0;
        Integer publishTotalH = saveModelH != null ? saveModelH.getResult1().intValue() : 0;
@ -5691,7 +5691,7 @@ public class StatisticsEsService {
        }
        JSONObject object = new JSONObject();
        //发布量统计
        saveModel = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL,slaveKey1);
        saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL);
        Integer publishTotal = saveModel != null ? saveModel.getResult1().intValue() : 0;
        object.put("publishTotal", publishTotal);//发布量
        //收藏量统计
@ -5981,7 +5981,7 @@ public class StatisticsEsService {
            endDate = DateUtil.getCurrentYearEndTime() + " 23:59:59";
        }
        //文章发布数
        List<SaveModel> total = elasticsearchUtil.findListDateQuotaLevel1Empty(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL, lowLevel, lowCode);//总数
        List<SaveModel> total = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL, null, lowLevel);//总数
        //发布类型
        List<SaveModel> publishTypeTotal = elasticsearchUtil.findListDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL, lowLevel, lowCode);//发布类型
        //文章评论数
@ -6080,10 +6080,10 @@ public class StatisticsEsService {
            endDate = DateUtil.getCurrentYearEndTime() + " 23:59:59";
        }
        //文章发布数
        SaveModel totalMap = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL,lowCode);//总数
        SaveModel totalMap = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL);//总数
        int total = 0;
        if (totalMap != null) {
            total = totalMap.getResult1().intValue();
        }
        //发布类型
        List<SaveModel> publishTypeTotal = elasticsearchUtil.findListDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL, lowLevel, lowCode);//发布类型

+ 3 - 0
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -2812,6 +2812,9 @@ public class ElasticsearchUtil {
     * @return
     */
    private SaveModel calculateResult(List<SaveModel> list) {
        if(list==null||list.size() == 0){
            return null;
        }
        SaveModel saveModel = list.get(0);
        double sum = list.stream().mapToDouble(SaveModel::getResult1).sum();
        double sum2 = list.stream().mapToDouble(SaveModel::getResult2).sum();

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

@ -193,7 +193,7 @@ public class ImService {
        if (dictDO == null) {
            dictDO = new WlyyHospitalSysDictDO();
            dictDO.setDictCode("customer");
            dictDO.setDictValue("客服");
            dictDO.setDictValue("系统");
        }
        return dictDO.getDictCode();
    }
@ -3218,7 +3218,7 @@ public class ImService {
            json.put("msg", msg);
            WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findById("customer").orElse(null);
            String sender_id = "customer";
            String sender_name = "客服";
            String sender_name = "系统";
            if (dictDO != null) {
                sender_id = dictDO.getDictCode();
                sender_name = dictDO.getDictValue();

+ 1 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/RobotService.java

@ -88,7 +88,7 @@ public class RobotService {
        if (dictDO == null) {
            dictDO = new WlyyHospitalSysDictDO();
            dictDO.setDictCode("customer");
            dictDO.setDictValue("客服");
            dictDO.setDictValue("系统");
        }
        return dictDO;
    }

+ 16 - 0
common/common-entity/src/db/2024.sql

@ -38,6 +38,8 @@ INSERT INTO `base`.`wx_wechat` (`id`, `name`, `token`, `encoding_aes_key`, `enc_
INSERT INTO `base`.`oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES
    ('findThirdScreenList', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/tongan/hospital/findThirdScreenList', '厦门I健康获取同安筛查记录');
@ -343,3 +345,17 @@ INSERT INTO `wlyy_doctor_scheme_blood_pressure` (`id`, `name`, `code`, `doctorco
INSERT INTO `wlyy_doctor_scheme_blood_pressure` (`id`, `name`, `code`, `doctorcode`, `dayofweek`, `early_morning`, `early_morning_time`, `morning`, `morning_time`, `noon`, `noon_time`, `after_noon`, `after_noon_time`, `night`, `night_time`, `create_time`, `alert_tag`, `content`, `del`) VALUES ('5', '基础监测方案', 'default', NULL, '5', '1', '10:00:00', '0', NULL, '0', NULL, '0', NULL, '0', NULL, '2017-01-01 00:00:32', '1', '针对血压相对稳定或微小波动的用户', '0');
INSERT INTO `wlyy_doctor_scheme_blood_pressure` (`id`, `name`, `code`, `doctorcode`, `dayofweek`, `early_morning`, `early_morning_time`, `morning`, `morning_time`, `noon`, `noon_time`, `after_noon`, `after_noon_time`, `night`, `night_time`, `create_time`, `alert_tag`, `content`, `del`) VALUES ('6', '基础监测方案', 'default', NULL, '6', '1', '10:00:00', '0', NULL, '0', NULL, '0', NULL, '0', NULL, '2017-01-01 00:00:32', '1', '针对血压相对稳定或微小波动的用户', '0');
INSERT INTO `wlyy_doctor_scheme_blood_pressure` (`id`, `name`, `code`, `doctorcode`, `dayofweek`, `early_morning`, `early_morning_time`, `morning`, `morning_time`, `noon`, `noon_time`, `after_noon`, `after_noon_time`, `night`, `night_time`, `create_time`, `alert_tag`, `content`, `del`) VALUES ('7', '基础监测方案', 'default', NULL, '7', '1', '10:00:00', '0', NULL, '0', NULL, '0', NULL, '0', NULL, '2017-01-01 00:00:32', '1', '针对血压相对稳定或微小波动的用户', '0');
INSERT INTO `base`.`wlyy_job_config_new` (`id`, `job_name`, `job_info`, `job_type`, `area_level`, `job_class`, `sql`,
`sql_count`, `sql_day`, `sql_year`, `cache_key`, `quartz_cron`, `status`, `quota_id`, `del`, `extract_type`,
`time_level`, `increment_interval`) VALUES ('78', '护理咨询-门诊状态', '护理咨询-门诊状态', '2', '6',
 'com.yihu.jw.statistics.job.business.MysqlToEsQuotaJob', 'SELECT c.id AS business_id, c.doctor AS doctor,CONCAT(c.outpatient_status,\'\') AS slaveKey2 , CONCAT(c.type,\'\') as slaveKey1 FROM wlyy_consult_outpatient_info c WHERE c.type =18 ', 'SELECT COUNT(c.id) FROM wlyy_consult_outpatient_info c WHERE c.type =18 ', 'AND c.create_time <:endTime  AND c.create_time  >=:startTime ', NULL, NULL, '0 30 0 * * ?', '0', '78', '1', NULL, '3', '1');
INSERT INTO `base`.`dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`)
VALUES ('64', '78', '8', 'select s.dict_code code,s.dict_value name from wlyy_hospital_sys_dict s where  s.dict_name=\'OUT_PATIENT_STATUS\'', NULL, '2', 'slaveKey2');
INSERT INTO `oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES
    ('findThirdScreenList', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/tongan/hospital/findThirdScreenList', '厦门I健康获取同安筛查记录');
INSERT INTO `oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES
    ('addSurveyThird', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/tongan/hospital/addSurveyThird', '厦门I健康新增三院疾病筛查管理记录');

+ 1 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/sms/SmsTemplateDO.java

@ -1,6 +1,5 @@
package com.yihu.jw.entity.base.sms;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -33,7 +32,7 @@ public class SmsTemplateDO extends UuidIdentityEntityWithOperator {
            case 0:
                return Type.register;
            case 1:
                return Type.register;
                return Type.login;
            case 2:
                return Type.resetPassword;
            case 3:

+ 111 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/BaseDiseaseSurveyDO.java

@ -0,0 +1,111 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 疾病筛查关联表
 * Created by yeshijie on 2024/8/19.
 */
@Entity
@Table(name = "base_disease_survey")
public class BaseDiseaseSurveyDO extends UuidIdentityEntityWithCreateTime {
    private String name;//病种名称
    private String comment;//病种描述
    private String dept;//关联科室
    private String deptName;//
    private String doctor;//关联医生
    private String doctorName;//
    private String status;//使用状态 1启用 0禁用
    private String statusName;//使用状态 1启用 0禁用
    private String surveyCode;//关联厦门i健康筛查code
    private String surveyTitle;//关联厦门i健康筛查名称
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "comment")
    public String getComment() {
        return comment;
    }
    public void setComment(String comment) {
        this.comment = comment;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "survey_code")
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    @Column(name = "survey_title")
    public String getSurveyTitle() {
        return surveyTitle;
    }
    public void setSurveyTitle(String surveyTitle) {
        this.surveyTitle = surveyTitle;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
}

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

@ -368,6 +368,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "patientid", value = "居民ID") @RequestParam(value = "patientid", required = false) String patientid,
            @ApiParam(name = "orgCode", value = "机构code") @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "dept", value = "部门code") @RequestParam(value = "dept", required = false) String dept,
            @ApiParam(name = "diseaseId", value = "专病id") @RequestParam(value = "diseaseId", required = false)String diseaseId,
            @ApiParam(name = "diseaseKey", value = "疾病名称关键字") @RequestParam(value = "diseaseKey", required = false) String diseaseKey,
            @ApiParam(name = "doctorNameKey", value = "医生名称关键字") @RequestParam(value = "doctorNameKey", required = false) String doctorNameKey,
            @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字") @RequestParam(value = "jobTitleNameKey", required = false) String jobTitleNameKey,
@ -385,7 +386,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
        try {
            logger.info("findDoctorByHospitalAndDiseaseAndDept start:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
            return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork, patientid,
                    orgCode, dept,
                    orgCode, dept,diseaseId,
                    diseaseKey, doctorNameKey,
                    jobTitleNameKey, outpatientType,
                    keyName, workingTime, consultStatus, chargType, consutlSort, isAttention,isNurse, page, pagesize);

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

@ -314,6 +314,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                                @RequestParam(value = "patientid", required = false)String patientid,
                                                            @ApiParam(name = "dept", value = "部门code")
                                                             @RequestParam(value = "dept", required = false)String dept,
                                                            @ApiParam(name = "diseaseId", value = "专病id")
                                                                @RequestParam(value = "diseaseId", required = false)String diseaseId,
                                                            @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
                                                             @RequestParam(value = "diseaseKey", required = false)String diseaseKey,
                                                            @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
@ -344,7 +346,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        try {
            logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                    orgCode,dept,
                    orgCode,dept,diseaseId,
                    diseaseKey,doctorNameKey,
                    jobTitleNameKey,outpatientType,
                    keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,isNurse,page,pagesize);
@ -352,55 +354,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return  failedMixEnvelopException2(e);
        }
    }
    @GetMapping("/testFrontQuery")
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
                                                            @RequestParam(value = "iswork", required = true)String iswork,
                                                            @ApiParam(name = "orgCode", value = "机构code")
                                                            @RequestParam(value = "orgCode", required = true,defaultValue = "350211A1002")String orgCode,
                                                            @ApiParam(name = "patientid", value = "patientid")
                                                            @RequestParam(value = "patientid", required = false)String patientid,
                                                            @ApiParam(name = "dept", value = "部门code")
                                                            @RequestParam(value = "dept", required = false)String dept,
                                                            @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
                                                            @RequestParam(value = "diseaseKey", required = false)String diseaseKey,
                                                            @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
                                                            @RequestParam(value = "doctorNameKey", required = false)String doctorNameKey,
                                                            @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
                                                            @RequestParam(value = "jobTitleNameKey", required = false)String jobTitleNameKey,
                                                            @ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
                                                            @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                            @ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
                                                            @RequestParam(value = "keyName", required = false)String keyName,
                                                            @ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
                                                            @RequestParam(value = "workingTime", required = false)String workingTime,
                                                            @ApiParam(name = "consultStatus", value = "在线状态")
                                                            @RequestParam(value = "consultStatus", required = false,defaultValue = "")String consultStatus,
                                                            @ApiParam(name = "chargType", value = "医生号别")
                                                            @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                            @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                            @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                            @ApiParam(name = "isAttention", value = "是否关注 1:关注 0:不关注 不传:查所有")
                                                            @RequestParam(value = "isAttention", required = false)String isAttention,
                                                             @ApiParam(name = "isNurse", value = "是否护师 1:是 0:否 不传:查所有")
                                                                 @RequestParam(value = "isNurse", required = false)String isNurse,
                                                            @ApiParam(name = "page", value = "第几页")
                                                            @RequestParam(value = "page",required = false) Integer page,
                                                            @ApiParam(name = "pagesize", value = "分页大小")
                                                            @RequestParam(value = "pagesize",required = false) Integer pagesize
    ) throws Exception{
        try {
            logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                    orgCode,dept,
                    diseaseKey,doctorNameKey,
                    jobTitleNameKey,outpatientType,
                    keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,isNurse,page,pagesize);
        } catch (Exception e){
            return  failedMixEnvelopException2(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findHotDeptAndDiseaseDict)
    @ApiOperation(value = "获取常见疾病、热门部门、医生拒绝接诊原因 字典", notes = "获取常见疾病、热门部门、医生拒绝接诊原因 字典")

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

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.elasticsearch.ElasticSearch7Util;
import com.yihu.jw.es.service.DataService;
import com.yihu.jw.es.util.ElasticsearchUtil;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
@ -12,6 +13,7 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
@ -38,6 +40,23 @@ public class DsyyPrescriptionCotroller extends EnvelopRestEndpoint {
    private ElasticSearch7Util elasticSearch7Util;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DataService dataService;
    @PostMapping(value = "open/exportExcel/deleteData")
    @ApiOperation(value = "删除es数据")
    public Envelop deleteData(String quotaDate, String quotaCode, String timeLevel){
        try {
            if(StringUtils.isBlank(quotaDate)||StringUtils.isBlank(quotaCode)||StringUtils.isBlank(timeLevel)){
                return Envelop.getError("参数错误");
            }
            dataService.deleteData(quotaDate,quotaCode,timeLevel);
            return Envelop.getSuccess("ok");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("失败");
        }
    }
    @PostMapping(value = "open/exportExcel/dmSql")
    @ApiOperation(value = "执行sql语句")

+ 158 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/specialist/BaseDiseaseHospitalController.java

@ -2,6 +2,8 @@ package com.yihu.jw.hospital.endpoint.specialist;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.hospital.survey.BaseDiseaseSurveyDO;
import com.yihu.jw.entity.specialist.BaseDiseaseHospitalDO;
import com.yihu.jw.hospital.disease.service.BaseDiseaseHospitalService;
import com.yihu.jw.restmodel.web.Envelop;
@ -13,8 +15,13 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.PREFIX)
@ -23,10 +30,160 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @Autowired
    private BaseDiseaseHospitalService baseDiseaseHospitalService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    WlyyBusinessService wlyyBusinessService;
    @ApiOperation("疾病筛查管理发送短信")
    @PostMapping(value = "sendSms")
    public Envelop sendSms(@ApiParam(name = "header", value = "模板名称", required = true)
                                   @RequestParam(value = "header", required = true) String header,
                                   @ApiParam(name = "surveyCodes", value = "筛查code,多个逗号间隔", required = true)
                                   @RequestParam(value = "surveyCodes", required = true) String surveyCodes,
                                   @ApiParam(name = "mobiles", value = "手机号,多个逗号间隔", required = true)
                                   @RequestParam(value = "mobiles", required = true) String mobiles,
                                   @ApiParam(name = "doctor", value = "医生code", required = false)
                                   @RequestParam(value = "doctor", required = false) String doctor,
                                   @ApiParam(name = "smsTemplateId", value = "短信模板id", required = false)
                                   @RequestParam(value = "smsTemplateId", required = false) String smsTemplateId,
                                   @ApiParam(name = "content", value = "短信模板内容", required = true)
                                   @RequestParam(value = "content", required = true) String content) {
        try {
            if(StringUtils.isBlank(doctor)){
                doctor = getUID();
            }
            baseDiseaseHospitalService.sendSms(mobiles,surveyCodes,smsTemplateId,content,header,doctor);
            return success("发送成功");
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = "findThirdScreenList")
    @ApiOperation(value = "同安筛查记录")
    public Envelop findThirdScreenList(
            @ApiParam(value = "社区医院code") @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(value = "病种类型code") @RequestParam(value = "diseaseSurveyCode", required = false) String diseaseSurveyCode,
            @ApiParam(value = "是否管理员1是 0否") @RequestParam(value = "isManager", required = true) String isManager,
            @ApiParam(value = "当前页") @RequestParam(value = "page") Integer page,
            @ApiParam(value = "显示记录数") @RequestParam(value = "size") Integer size,
            @ApiParam(value = "模板code,多个用逗号隔开") @RequestParam(value = "templateCode", required = false) String templateCode,
            @ApiParam(value = "居民姓名") @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger,
            @ApiParam(value = "开始时间") @RequestParam(value = "startDate", required = false) String startDate,
            @ApiParam(value = "结束时间") @RequestParam(value = "endDate", required = false) String endDate,
            @ApiParam(value = "管理状态 0未管理 1已管理 2 日常健康管理") @RequestParam(value = "manageStatus", required = false) String manageStatus
    ) {
        try {
            if(StringUtils.isBlank(templateCode)){
                String sql = "SELECT GROUP_CONCAT(survey_code) survey_code from base_disease_survey";
                if("0".equals(isManager)){
                    sql += " where doctor like '%"+getUID()+"%' ";
                }
                List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
                if(list.size()>0){
                    templateCode = list.get(0).get("survey_code")+"";
                }
            }
            if(StringUtils.isBlank(templateCode)){
                JSONObject json = new JSONObject();
                json.put("detailModelList",new ArrayList<>());
                json.put("currPage",page);
                json.put("totalPage",0);
                json.put("pageSize",size);
                json.put("message","查询成功");
                json.put("totalCount",0);
                json.put("status",200);
                return success(json);
            }
            return success(wlyyBusinessService.findThirdScreenList(hospital, patientName, startDate, endDate, templateCode,
                    isDanger, manageStatus, page, size));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @ApiOperation("按id查找短信模板")
    @PostMapping(value = "findSmsTemplate")
    public Envelop findSmsTemplate(@ApiParam(name = "id", value = "模板id", required = true)
                            @RequestParam(value = "id", required = true) String id) {
        try {
            return success(baseDiseaseHospitalService.findSmsTemplate(id));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("新增和修改短信模板")
    @PostMapping(value = "addOrUpdSmsTemplate")
    public Envelop addOrUpdSmsTemplate(@ApiParam(name = "json", value = "专病配置实体类json", required = true)
                                       @RequestParam(value = "json", required = true) String json) {
        try {
            SmsTemplateDO smsTemplateDO = toEntity(json, SmsTemplateDO.class);
            return success(baseDiseaseHospitalService.addOrUpdSmsTemplate(smsTemplateDO));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("短信模板分页")
    @GetMapping(value = "smsTemplatePage")
    public Envelop smsTemplatePage(@ApiParam(name = "header", value = "模板名称", required = false)
                                     @RequestParam(value = "header", required = false) String header,
                                     @ApiParam(name = "clientId", value = "固定传dsyy", required = false)
                                     @RequestParam(value = "clientId", required = false) String clientId,
                                     @ApiParam(name = "page", value = "页码", required = true)
                                     @RequestParam(value = "page", required = true) Integer page,
                                     @ApiParam(name = "size", value = "大小", required = true)
                                     @RequestParam(value = "size", required = true) Integer size) {
        try {
            return baseDiseaseHospitalService.smsTemplatePage(header,clientId, page, size);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("新增和修改疾病筛查配置")
    @PostMapping(value = "addOrUpd")
    public Envelop addOrUpd(@ApiParam(name = "json", value = "专病配置实体类json", required = true)
                                           @RequestParam(value = "json", required = true) String json) {
        try {
            BaseDiseaseSurveyDO diseaseSurveyDO = toEntity(json, BaseDiseaseSurveyDO.class);
            return success(baseDiseaseHospitalService.addOrUpd(diseaseSurveyDO));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("查询疾病筛查配置列表")
    @GetMapping(value = "diseaseSurveyPage")
    public Envelop diseaseSurveyPage(@ApiParam(name = "name", value = "疾病名称", required = false)
                                      @RequestParam(value = "name", required = false) String name,
                                      @ApiParam(name = "dept", value = "关联科室code", required = false)
                                      @RequestParam(value = "dept", required = false) String dept,
                                     @ApiParam(name = "doctor", value = "关联医生code", required = false)
                                         @RequestParam(value = "doctor", required = false) String doctor,
                                     @ApiParam(name = "surveyCode", value = "i健康疾病筛查code", required = false)
                                         @RequestParam(value = "surveyCode", required = false) String surveyCode,
                                     @ApiParam(name = "status", value = "1启用0禁用", required = false)
                                         @RequestParam(value = "status", required = false) String status,
                                      @ApiParam(name = "page", value = "页码", required = true)
                                      @RequestParam(value = "page", required = true) Integer page,
                                      @ApiParam(name = "size", value = "大小", required = true)
                                      @RequestParam(value = "size", required = true) Integer size) {
        try {
            return baseDiseaseHospitalService.diseaseSurveyPage(name,dept,doctor,surveyCode, status, page, size);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("新增/修改专病配置")
    @PostMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.insertAndUpdate)
    public Envelop insertAndUpdateQuestion(@ApiParam(name = "json", value = "专病配置实体类json", required = true)

+ 6 - 8
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/etl/extract/db/DBPageExtract.java

@ -96,9 +96,9 @@ public class DBPageExtract<T> {
            forCount++;
            //綫程返回值的值
            List<AsyncResult<Boolean>> asyncResultPool=new ArrayList<AsyncResult<Boolean>>();
            for(int page=0;page<forCount;page++){
            for(int page=1;page<=forCount;page++){
                //启动多线程采集数据
                AsyncResult<Boolean> future= multiExtractData(sql,page*pageSize,pageSize,clazz,jdbcTemplate,params);
                AsyncResult<Boolean> future= multiExtractData(sql,page,pageSize,clazz,jdbcTemplate,params);
                asyncResultPool.add(future);
            }
            ///循环判断,等待获取结果信息
@ -161,22 +161,20 @@ public class DBPageExtract<T> {
    /**
     * 多线程采集数据
     * @param sql
     * @param start
     * @param page
     * @param pageSize
     * @param clazz
     * @return
     */
    @Async("dbExtractExecutor")
    private AsyncResult<Boolean> multiExtractData(String sql, int start, int pageSize, Class<T> clazz, JdbcTemplate jdbcTemplate,Map<String,Object> params) throws Exception {
    private AsyncResult<Boolean> multiExtractData(String sql, int page, int pageSize, Class<T> clazz, JdbcTemplate jdbcTemplate,Map<String,Object> params) throws Exception {
 /*       String finalSql=sql+" limit "+start+","+pageSize; //拼凑分页的语句
        List<T> listTemp= jdbcTemplate.query(finalSql,new BeanPropertyRowMapper(clazz));*/
        List<Map<String,Object>> mapList = new ArrayList<>();
        start  =1;
        if (sql.contains("startTime")||sql.contains("endTime")){
            mapList = hibenateUtils.createSQLQuery(sql,params,start,pageSize);
            mapList = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        }else {
            mapList = hibenateUtils.createSQLQuery(sql,start,pageSize);
            mapList = hibenateUtils.createSQLQuery(sql,page,pageSize);
        }
        List<T> listTemp = hibenateUtils.castMapToBean(mapList,clazz);
        if (listTemp!=null&&listTemp.size()!=0){

+ 26 - 4
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/MysqlToEsQuotaJob.java

@ -46,6 +46,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Created by chenweida on 2017/7/10.
@ -150,7 +151,7 @@ public class MysqlToEsQuotaJob implements Job {
     */
    private void computequota() {
        try {
            logger.info("========================quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " start========================");
            logger.info("===quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " start==========");
            QuartzJobLog tjQuotaLog = new QuartzJobLog();
            tjQuotaLog.setJobId(wlyyJobCongId);
            tjQuotaLog.setJobStartTime(new Date());
@ -178,7 +179,7 @@ public class MysqlToEsQuotaJob implements Job {
            tjQuotaLog.setJobEndTime(new Date());
            tjQuotaLog.setJobContent(JSONArray.fromObject(filterModel.getErrorModels()).toString());
            saveLog(tjQuotaLog);
            logger.info("========================quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " end========================");
            logger.info("=====quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " end=======");
    /*        }*/
        } catch (Exception e) {
            e.printStackTrace();
@ -193,6 +194,24 @@ public class MysqlToEsQuotaJob implements Job {
     * @param timeLevel
     */
    private void deleteData(Date quotaDate, String quotaCode, String timeLevel) {
        try {
            //es超过5w条的删除不干净。循环处理,最多删除10次
            int i = 0;
            int num = delData(quotaDate, quotaCode, timeLevel);
            while (num==50000&&i<10){
                i++;
                TimeUnit.MILLISECONDS.sleep(100);
                logger.info("============================="+i);
                num = delData(quotaDate, quotaCode, timeLevel);
            }
        } catch (Exception e) {
            logger.info("delete error:"+e.getMessage());
        }
    }
    private int delData(Date quotaDate, String quotaCode, String timeLevel) {
        int num = 0;
        try {
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -201,7 +220,7 @@ public class MysqlToEsQuotaJob implements Job {
                            .must(QueryBuilders.matchQuery("quotaCode", quotaCode))
                            .must(QueryBuilders.matchQuery("timeLevel", timeLevel))
                            .must(QueryBuilders.matchQuery("quotaDate", quotaDate))
            ).size(10000);//一次取10000条
            ).size(50000);//一次取10000条 es目前配置最多查5w.可通过修改配置,但是占用资源比较多
            List<String> result = elasticSearch7Helper.search(esIndex,searchSourceBuilder);
            List<SaveModel> saveModels = new ArrayList<>();
            for (String s:result){
@ -216,16 +235,19 @@ public class MysqlToEsQuotaJob implements Job {
                bulkRequest.add(new DeleteRequest(esIndex)
                        .id(obj.getId()));
            }
            logger.info("delete size:"+result.size());
            num = result.size();
            logger.info("delete size:"+num);
            if (saveModels!=null&&saveModels.size()!=0){
                BulkResponse bulkResponse = restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT);
                logger.info(bulkResponse.buildFailureMessage());
                logger.info("delete data count:" + saveModels.size());
                logger.info("delete flag:" + !bulkResponse.hasFailures());
            }
        } catch (Exception e) {
            logger.info("delete error:"+e.getMessage());
        }
        return num;
    }
    @Transactional

+ 17 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/StatisticsController.java

@ -99,6 +99,23 @@ public class StatisticsController extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value="exportExcel/exportServiceSituationDetail")
    public void exportServiceSituationDetail(
            @RequestParam(required = false) String startDate,
            @RequestParam(required = false) String endDate,
            HttpServletRequest request,HttpServletResponse response){
        try {
            List<Map<String,Object>> list = statisticsService.serviceSituationDetail2(request);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=serviceSituationDetail.xls");
            OutputStream os = response.getOutputStream();
            String header[] = {"科室","医生","回复次数","回复率","协诊次数","下转次数"};
            String col[] = {"dept","name","replyNum","replyRate","collaborateNum","turnDownNum"};
            exportUtl.write(os,list,header,col);
        }catch (Exception ex){
            error(ex);
        }
    }
    @GetMapping(value = "uploadAnalysis")
    @ApiOperation(value = "设备上传次数趋势")

+ 157 - 5
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/StatisticsService.java

@ -346,6 +346,157 @@ public class StatisticsService {
        return result;
    }
    public List<Map<String,Object>> serviceSituationDetail2(HttpServletRequest request){
        String sql = "SELECT DISTINCT d.idcard,d.name,h.dept_code dept,h.dept_name deptName,0 collaborateNum,0 inviteNum" +
                ",0 replyNum,0 turnUpNum,0 turnDownNum  from base_doctor_hospital h,base_doctor d " +
                "WHERE h.del='1' and d.del='1' and h.doctor_code=d.id and d.idcard is not null and h.dept_name is not null order by h.dept_name";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        JSONObject jsonObject = wlyyBusinessService.commonGet(request,"serviceSituationDetail");
        JSONArray jsonArray = null;
        int collaborateNumTotal = 0;
        int inviteNumTotal = 0;
        int replyNumTotal = 0;
        int turnUpNumTotal = 0;
        int turnDownNumTotal = 0;
        List<Map<String,Object>> listTmp = new ArrayList<>();
        Map<String, List<Map<String,Object>>> deptMap = new HashMap<>();
        if(jsonObject!=null&&jsonObject.getInteger("status")==200){
            jsonArray = jsonObject.getJSONArray("list");
            for (Map<String,Object> map:list){
                String idcard1 = map.get("idcard")+"";
                for (int i=0;i<jsonArray.size();i++){
                    JSONObject json = jsonArray.getJSONObject(i);
                    String idcard = json.getString("code");
                    int collaborateNum = json.getInteger("collaborateNum");
                    int inviteNum = json.getInteger("inviteNum");
                    int replyNum = json.getInteger("replyNum");
                    int turnUpNum = json.getInteger("turnUpNum");
                    int turnDownNum = json.getInteger("turnDownNum");
                    int total = collaborateNum + inviteNum + replyNum + turnUpNum + turnDownNum;
                    if(total==0){
                        jsonArray.remove(i);
                        break;
                    }
                    collaborateNumTotal += collaborateNum;
                    inviteNumTotal += inviteNum;
                    replyNumTotal += replyNum;
                    turnUpNumTotal += turnUpNum;
                    turnDownNumTotal += turnDownNum;
                    if(idcard1.equals(idcard)){
                        map.put("collaborateNum",collaborateNum);
                        map.put("inviteNum",inviteNum);
                        map.put("replyNum",replyNum);
                        map.put("turnUpNum",turnUpNum);
                        map.put("turnDownNum",turnDownNum);
                        map.put("replyRate",getRange(replyNum, inviteNum));
                        listTmp.add(map);
                        jsonArray.remove(i);
                        break;
                    }
                }
            }
        }
        Map<String,Object> totalMap = new HashMap<>();
        totalMap.put("dept","合计");
        totalMap.put("name","-");
        totalMap.put("collaborateNum",collaborateNumTotal);
        totalMap.put("inviteNum",inviteNumTotal);
        totalMap.put("replyNum",replyNumTotal);
        totalMap.put("turnUpNum",turnUpNumTotal);
        totalMap.put("turnDownNum",turnDownNumTotal);
        totalMap.put("replyRate",getRange(replyNumTotal, inviteNumTotal));
        List<Map<String,Object>> result = new ArrayList<>();
        result.add(totalMap);
        Map<String, List<Map<String,Object>>> resList = listTmp.stream().collect(Collectors.groupingBy(e -> e.get("deptName").toString()));
        for (Map.Entry<String, List<Map<String,Object>>> entry:resList.entrySet()){
            String key = entry.getKey();
            int collaborateNumDept = 0;
            int inviteNumDept = 0;
            int replyNumDept = 0;
            int turnUpNumDept = 0;
            int turnDownNumDept = 0;
            Map<String,Object> deptTmp = new HashMap<>();
            List<Map<String,Object>> value = entry.getValue();
            String dept = "";
            for (Map<String,Object> map:value){
                map.put("dept", key);
                dept = map.get("dept")+"";
                int collaborateNum = Integer.parseInt(map.get("collaborateNum")+"");
                int inviteNum = Integer.parseInt(map.get("inviteNum")+"");
                int replyNum = Integer.parseInt(map.get("replyNum")+"");
                int turnUpNum = Integer.parseInt(map.get("turnUpNum")+"");
                int turnDownNum = Integer.parseInt(map.get("turnDownNum")+"");
                collaborateNumDept += collaborateNum;
                inviteNumDept += inviteNum;
                replyNumDept += replyNum;
                turnUpNumDept += turnUpNum;
                turnDownNumDept += turnDownNum;
            }
            deptTmp.put("dept",key);
            deptTmp.put("name","-");
            deptTmp.put("collaborateNum",collaborateNumDept);
            deptTmp.put("inviteNum",inviteNumDept);
            deptTmp.put("replyNum",replyNumDept);
            deptTmp.put("turnUpNum",turnUpNumDept);
            deptTmp.put("turnDownNum",turnDownNumDept);
            deptTmp.put("replyRate",getRange(replyNumDept, inviteNumDept));
            value.sort(Comparator.comparingInt(a->Integer.parseInt(a.get("replyNum")+"")));
            result.add(deptTmp);
            result.addAll(value);
        }
        List<Map<String,Object>> other = new ArrayList<>();
        if(jsonArray!=null&&jsonArray.size()>0){
            int collaborateNumOther = 0;
            int inviteNumOther = 0;
            int replyNumOther = 0;
            int turnUpNumOther = 0;
            int turnDownNumOther = 0;
            for (int i=0;i<jsonArray.size();i++){
                Map<String,Object> map = new HashMap<>();
                JSONObject json = jsonArray.getJSONObject(i);
                String name = json.getString("name");
                int collaborateNum = json.getInteger("collaborateNum");
                int inviteNum = json.getInteger("inviteNum");
                int replyNum = json.getInteger("replyNum");
                int turnUpNum = json.getInteger("turnUpNum");
                int turnDownNum = json.getInteger("turnDownNum");
                map.put("dept","其他");
                map.put("name",name);
                map.put("collaborateNum",collaborateNum);
                map.put("inviteNum",inviteNum);
                map.put("replyNum",replyNum);
                map.put("turnUpNum",turnUpNum);
                map.put("turnDownNum",turnDownNum);
                map.put("replyRate",getRange(replyNum, inviteNum));
                other.add(map);
                collaborateNumOther += collaborateNum;
                inviteNumOther += inviteNum;
                replyNumOther += replyNum;
                turnUpNumOther += turnUpNum;
                turnDownNumOther += turnDownNum;
            }
            Map<String,Object> otherMap = new HashMap<>();
            otherMap.put("dept","其他");
            otherMap.put("name","-");
            otherMap.put("collaborateNum",collaborateNumOther);
            otherMap.put("inviteNum",inviteNumOther);
            otherMap.put("replyNum",replyNumOther);
            otherMap.put("turnUpNum",turnUpNumOther);
            otherMap.put("turnDownNum",turnDownNumOther);
            otherMap.put("replyRate",getRange(replyNumOther, inviteNumOther));
            other.sort(Comparator.comparingInt(a->Integer.parseInt(a.get("replyNum")+"")));
            result.add(otherMap);
            result.addAll(other);
        }
        return result;
    }
    /**
     * 设备上传次数趋势
     */
@ -659,7 +810,7 @@ public class StatisticsService {
        int uploadTotal = 0;
        int uploadXt = 0;//
        int uploadXy = 0;//
        String uploadSql = "select type,count(id) num from wlyy_patient_health_index where 1=1 "+filterUpload+" group by type";
        String uploadSql = "select type,count(id) num from wlyy_patient_health_index where del=1 "+filterUpload+" group by type";
        List<Map<String,Object>> uploadList = jdbcTemplate.queryForList(uploadSql);
        for (Map<String,Object> map:uploadList){
            String type = map.get("type")+"";
@ -752,15 +903,16 @@ public class StatisticsService {
        String sql = "select * from (SELECT d.code dept,d.`name` deptName,IFNULL(t1.xtNum,0) xtNum,IFNULL(t1.xyNum,0) xyNum " +
                ",IFNULL(t2.xtUseNum,0) xtUseNum,IFNULL(t2.xyUseNum,0) xyUseNum " +
                ",IFNULL(t3.xtBindNum,0) xtBindNum,IFNULL(t3.xyBindNum,0) xyBindNum from dict_hospital_dept d " +
                "LEFT JOIN (SELECT d.dept,d.dept_name,COUNT(if(dm.category_code=1,1,null)) xtNum,COUNT(if(dm.category_code=2,1,null)) xyNum " +
                ",IFNULL(t3.xtBindNum,0) xtBindNum,IFNULL(t3.xyBindNum,0) xyBindNum from (SELECT code,name from dict_hospital_dept " +
                " UNION all  SELECT '' code,'' name) d " +
                "LEFT JOIN (SELECT IFNULL(d.dept,'') dept,IFNULL(d.dept_name,'') dept_name,COUNT(if(dm.category_code=1,1,null)) xtNum,COUNT(if(dm.category_code=2,1,null)) xyNum " +
                " from wlyy_devices d,dm_device dm " +
                "WHERE d.category_code=dm.id " + filter +
                "GROUP BY d.dept) t1 on d.code=t1.dept " +
                "LEFT JOIN (SELECT dept,dept_name,COUNT(if(type=1,1,null)) xtUseNum,COUNT(if(type=2,1,null)) xyUseNum from  " +
                "LEFT JOIN (SELECT IFNULL(dept,'') dept,IFNULL(dept_name,'') dept_name,COUNT(if(type=1,1,null)) xtUseNum,COUNT(if(type=2,1,null)) xyUseNum from  " +
                "wlyy_patient_health_index where del=1 " + filterUse +
                "GROUP BY dept) t2 on d.code=t2.dept " +
                "LEFT JOIN (SELECT dept,dept_name,COUNT(if(category_code=1,1,null)) xtBindNum,COUNT(if(category_code=2,1,null)) xyBindNum  " +
                "LEFT JOIN (SELECT IFNULL(dept,'') dept,IFNULL(dept_name,'') dept_name,COUNT(if(category_code=1,1,null)) xtBindNum,COUNT(if(category_code=2,1,null)) xyBindNum  " +
                "from wlyy_patient_device where 1=1 " + filterBind+
                "GROUP BY dept) t3 on d.code=t3.dept ) t " +
                "WHERE (xtNum+xyNum+xtUseNum+xyUseNum+xtBindNum+xyBindNum)>0 ORDER BY "+sort+" desc";

+ 5 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceUploadService.java

@ -155,9 +155,12 @@ public class DeviceUploadService {
        try{
            String patientsql = "select group_concat(label_code) disease from wlyy_patient_label " +
                    "where patient = '" + patient.getId() + "' and label_type = 2 and (label_code = 1 or label_code = 2)  GROUP BY patient";
            System.out.println("patientsql==>"+ patientsql);
            String patientdisease = jdbcTemplate.queryForObject(patientsql,String.class);
            String patientdisease = "";
            List<Map<String, Object>> diseases = jdbcTemplate.queryForList(patientsql);
            if (diseases.size() > 0) {
                patientdisease = (String) diseases.get(0).get("disease");
            }
            //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
            int bloodPressureBbnormalCount = 0;//血压异常次数
            int bloodSuggurBbnormalCount = 0;//血糖异常次数
@ -206,7 +209,6 @@ public class DeviceUploadService {
                }
            }
            System.out.println("patientdisease=>"+patientdisease+"  stdbloodPressureBbnormalCount=>"+stdbloodPressureBbnormalCount+"  bloodPressureBbnormalCount=>"+bloodPressureBbnormalCount);
            //连续5次正常,修改用户为非预警状态
            if(StringUtils.isNotBlank(patientdisease)){
                if ("1".equals(patientdisease)||"3".equals(patientdisease)) {

+ 14 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DoctorRehabilitaionInfoController.java

@ -262,6 +262,20 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value = "planNumAndServiceTime", method = RequestMethod.GET)
    @ApiOperation("康复计划总数,及最近的服务项的服务日期")
    public String planNumAndServiceTime(
            @ApiParam(name = "patientId", value = "居民", required = false) @RequestParam(value = "patientId", required = true) String patientId,
            @ApiParam(name = "diseaseId", value = "专病id", required = false) @RequestParam(value = "diseaseId", required = true) String diseaseId
    ) {
        try {
            return write(200, "请求成功", "data", rehabilitationInfoService.planNumAndServiceTime(patientId, diseaseId));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败");
        }
    }
    /**
     * 查询居民的康复计划

+ 21 - 4
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

@ -1233,6 +1233,26 @@ public class RehabilitationInfoService {
        return map;
    }
    //康复计划总数,及最近的服务项的服务日期(未完成 当前时间之后)
    public JSONObject planNumAndServiceTime(String patientId, String diseaseId){
        JSONObject json = new JSONObject();
        String sql = "SELECT COUNT(id) from wlyy_patient_rehabilitation_plan WHERE patient= '"+patientId+"' and disease='"+diseaseId+"'";
        int planNum = jdbcTemplate.queryForObject(sql, Integer.class);
        String sql2 = "SELECT i.plan_time from wlyy_patient_rehabilitation_plan p,base_service_item_plan i  " +
                "WHERE p.patient= '"+patientId+"' and p.disease='"+diseaseId+"' " +
                "and p.id = i.plan_id and i.`status`= 0 and i.plan_time>'"+DateUtil.getStringDate()+"' " +
                "ORDER BY i.plan_time desc LIMIT 1";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql2);
        String planTime = "";
        if(list.size() > 0){
            planTime = list.get(0).get("plan_time")+"";
        }
        json.put("planNum",planNum);
        json.put("planTime",planTime);
        return json;
    }
    /**
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     */
@ -1283,12 +1303,9 @@ public class RehabilitationInfoService {
                "	CASE  " +
                "		WHEN d.`status`='0' THEN '未下转' " +
                "		WHEN d.`status`='1' THEN '待分配' " +
//                "		WHEN d.`status`='2' THEN '创建计划过程失败' " +
//                "		WHEN d.`status`='3' THEN '患者无住院病历信息' " +
//                "		WHEN d.`status`='5' THEN '同步居民失败' " +
                "		WHEN d.`status`='7' THEN '已管理' " +
                "  END 'statusName', " +
                "  d.`status`,count(DISTINCT p.id) 'count'  " +
                "  d.`status`,count(DISTINCT d.id) 'count'  " +
                "FROM " +
                "	base_patient p " +
                "	INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +