LAPTOP-KB9HII50\70708 11 mesi fa
parent
commit
b7f14f7d3c

File diff suppressed because it is too large
+ 18 - 2
common/common-entity/src/db/2024.sql


+ 6 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/controller/ChronicDiseaseController.java

@ -468,12 +468,14 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
    @ApiOperation("获取红黄绿标高血压糖尿病的指标人数")
    public String getLabelCount(
            @ApiParam(name = "doctorId", value = "医生id") @RequestParam(value = "doctorId", required = false) String doctorId,
            @ApiParam(name = "isTrack", value = "是否重点关注 1是0否") @RequestParam(value = "isTrack", required = false) String isTrack,
            @ApiParam(name = "pastWeek", value = "是否近一周 1是0否") @RequestParam(value = "pastWeek", required = false) String pastWeek,
            @ApiParam(name = "diseaseCondition", value = "病情") @RequestParam(value = "diseaseCondition", required = false) String diseaseCondition) {
        try {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
            }
            HashMap<String, Object> result = doctorSchemeService.getLabelCount(doctorId,diseaseCondition);
            HashMap<String, Object> result = doctorSchemeService.getLabelCount(doctorId,diseaseCondition,isTrack,pastWeek);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
@ -487,6 +489,8 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
            @ApiParam(name = "labelType", value = "1高血压 2糖尿病 空全部") @RequestParam(value = "labelType", required = false) String labelType,
            @ApiParam(name = "searchContent", value = "检索内容") @RequestParam(value = "searchContent", required = false) String searchContent,
            @ApiParam(name = "diseaseCondition", value = "病情") @RequestParam(value = "diseaseCondition", required = false) String diseaseCondition,
            @ApiParam(name = "isTrack", value = "是否重点关注 1是0否") @RequestParam(value = "isTrack", required = false) String isTrack,
            @ApiParam(name = "pastWeek", value = "是否近一周 1是0否") @RequestParam(value = "pastWeek", required = false) String pastWeek,
            @ApiParam(name = "page", value = "页码") @RequestParam(value = "page", required = false) int page,
            @ApiParam(name = "pageSize", value = "数量") @RequestParam(value = "pageSize", required = false) int pageSize
    ) {
@ -494,7 +498,7 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
            }
            List<Map<String, Object>> result = doctorSchemeService.getLabelDetail(doctorId, labelType,diseaseCondition, searchContent, page, pageSize);
            List<Map<String, Object>> result = doctorSchemeService.getLabelDetail(doctorId, labelType,diseaseCondition,isTrack,pastWeek, searchContent, page, pageSize);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();

+ 33 - 4
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/scheme/DoctorSchemeService.java

@ -39,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -238,9 +237,11 @@ public class DoctorSchemeService {
                t.setPatientCode(patient);
                t.setPatientName(patientDO.getName());
                t.setDel("0");
                t.setUpdateTime(new Date());
                trackPatientDao.save(t);
            }else {
                trackPatient.setDel("0");
                trackPatient.setUpdateTime(new Date());
                trackPatientDao.save(trackPatient);
            }
        }
@ -265,6 +266,7 @@ public class DoctorSchemeService {
                BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
                TrackPatient t = new TrackPatient();
                t.setCreateTime(new Date());
                t.setUpdateTime(new Date());
                t.setDoctorCode(doctorDO.getId());
                t.setDoctorName(doctorDO.getName());
                t.setIdcard(patientDO.getIdcard());
@ -275,6 +277,7 @@ public class DoctorSchemeService {
                trackPatientDao.save(t);
            }else {
                trackPatient.setDel("1");
                trackPatient.setUpdateTime(new Date());
                trackPatientDao.save(trackPatient);
            }
        }
@ -932,7 +935,7 @@ public class DoctorSchemeService {
        if(StringUtils.isNotBlank(patient)){
            filter += " AND i.user = '"+patient+"' ";
        }
        if(StringUtils.isNotBlank(patient)){
        if(StringUtils.isNotBlank(doctor)){
            filter += " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' ) ";
        }
        String highSql = "SELECT  " +
@ -2324,12 +2327,13 @@ public class DoctorSchemeService {
     *
     * @return
     */
    public HashMap<String, Object> getLabelCount(String doctorId,String diseaseCondition) throws ExecutionException, InterruptedException {
    public HashMap<String, Object> getLabelCount(String doctorId,String diseaseCondition,String isTrack,String pastWeek){
        // 高血压预警
        String sql01 = "SELECT count(DISTINCT  a.id)\n" +
                "FROM base_patient a \n" +
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient " +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.disease_condition IN('1','2','0')\n" +
@ -2340,6 +2344,7 @@ public class DoctorSchemeService {
                "FROM base_patient a \n" +
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','0')\n" +
                "and l.label_name='高血压' " +
@ -2350,6 +2355,7 @@ public class DoctorSchemeService {
                "FROM base_patient a \n" +
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.disease_condition IN('1','2','0')\n" +
@ -2360,6 +2366,7 @@ public class DoctorSchemeService {
                "FROM base_patient a \n" +
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','0')\n" +
                "and l.label_name='糖尿病' " +
@ -2370,6 +2377,19 @@ public class DoctorSchemeService {
            sql03 += " and a.disease_condition = '"+diseaseCondition+"' ";
            sql04 += " and a.disease_condition = '"+diseaseCondition+"' ";
        }
        if("1".equals(isTrack)){
            sql01 += " and t.id is not null ";
            sql02 += " and t.id is not null ";
            sql03 += " and t.id is not null ";
            sql04 += " and t.id is not null ";
        }
        if("1".equals(pastWeek)){
            String startDate = DateUtil.getNextDay(new Date(),-7);
            sql01 += " and t.create_time >='"+startDate+"' ";
            sql02 += " and t.create_time >='"+startDate+"' ";
            sql03 += " and t.create_time >='"+startDate+"' ";
            sql04 += " and t.create_time >='"+startDate+"' ";
        }
        Integer count1 = jdbcTemplate.queryForObject(sql01, Integer.class);// 高血压预警
        Integer count2 = jdbcTemplate.queryForObject(sql02, Integer.class);// 高血压
        Integer count3 = jdbcTemplate.queryForObject(sql03, Integer.class);// 糖尿病预警
@ -2386,12 +2406,14 @@ public class DoctorSchemeService {
    /**
     * labelType 1高血压 2糖尿病
     */
    public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType,String diseaseCondition, String searchContent, int page, int pageSize) {
    public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType,String diseaseCondition,String isTrack
            ,String pastWeek, String searchContent, int page, int pageSize) {
        String sql = "SELECT DISTINCT a.id,a.`name`,a.idcard,a.mobile,a.ssc, TIMESTAMPDIFF(YEAR, a.birthday, CURDATE()) AS age " +
                ",a.sex,a.disease,CAST(a.disease_condition AS CHAR) diseaseCondition,a.photo,CAST(a.standard_status AS CHAR) standardStatus " +
                "FROM base_patient a \n" +
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','0') " +
                "AND b.doctor ='" + doctorId + "'";
@ -2409,6 +2431,13 @@ public class DoctorSchemeService {
        if (StringUtils.isNotBlank(searchContent)) {
            sql += " AND a.`name` LIKE '%" + searchContent + "%' ";
        }
        if("1".equals(isTrack)){
            sql += " and t.id is not null ";
        }
        if("1".equals(pastWeek)){
            String startDate = DateUtil.getNextDay(new Date(),-7);
            sql += " and t.create_time >='"+startDate+"' ";
        }
        sql += " LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;