Browse Source

代码修改

LAPTOP-KB9HII50\70708 10 months ago
parent
commit
dbd1ab720d

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

@ -28,6 +28,41 @@ public class LabelController extends EnvelopRestEndpoint {
    @Autowired
    private LabelService labelService;
    @GetMapping(value = "signPage")
    @ApiOperation(value = "慢病管理", notes = "慢病管理")
    public Envelop signPage(@ApiParam(name = "page", value = "第几页")
                             @RequestParam(value = "page", required = true) Integer page,
                             @ApiParam(name = "size", value = "每页大小")
                             @RequestParam(value = "size", required = true) Integer size,
                            @ApiParam(name = "name", value = "居民姓名")
                                @RequestParam(value = "name", required = false) String name,
                            @ApiParam(name = "idcard", value = "身份证")
                                @RequestParam(value = "idcard", required = false) String idcard,
                            @ApiParam(name = "address", value = "地址")
                                @RequestParam(value = "address", required = false) String address,
                            @ApiParam(name = "hospitalName", value = "签约社区")
                                @RequestParam(value = "hospitalName", required = false) String hospitalName,
                            @ApiParam(name = "doctorName", value = "签约医生")
                                @RequestParam(value = "doctorName", required = false) String doctorName,
                            @ApiParam(name = "health", value = "健康情况")
                                @RequestParam(value = "health", required = false) String health,
                            @ApiParam(name = "disease", value = "疾病类型")
                                @RequestParam(value = "disease", required = false) String disease,
                            @ApiParam(name = "zbType", value = "专病类型")
                                @RequestParam(value = "zbType", required = false) String zbType,
                            @ApiParam(name = "zdyGroup", value = "自定义分组")
                                @RequestParam(value = "zdyGroup", required = false) String zdyGroup,
                            @ApiParam(name = "diseaseCondition", value = "病情")
                                @RequestParam(value = "diseaseCondition", required = false) String diseaseCondition) {
        try {
            return labelService.signPage(page, size, name, idcard, address, hospitalName, doctorName, health, disease,
                    zbType, zdyGroup, diseaseCondition);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = "patientLabelLogPage")
    @ApiOperation(value = "查询标签新增日志", notes = "查询标签新增日志")
    public Envelop patientLabelLogPage(@ApiParam(name = "patient", value = "居民id")

+ 84 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java

@ -2,12 +2,15 @@ package com.yihu.jw.hospital.module.common.service;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelLogDO;
import com.yihu.jw.entity.door.WlyySign;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.label.WlyyPatientLabelDao;
import com.yihu.jw.label.WlyyPatientLabelLogDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.entity.ServiceException;
import org.apache.commons.lang3.StringUtils;
@ -30,12 +33,71 @@ public class LabelService {
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private WlyyPatientLabelLogDao logDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    //同步签约信息
    public void sysSign(Long id){
    }
    /**
     * 慢病管理
     */
    public PageEnvelop signPage(Integer page,Integer size,String name,String idcard,String address,String hospitalName,String doctorName
            ,String health,String disease,String zbType,String zdyGroup,String diseaseCondition){
        String sql = "select distinct a.*,GROUP_CONCAT(if(l.label_type='1',l.label_name,null)) health " +
                ",GROUP_CONCAT(if(l.label_type='2',l.label_name,null)) disease " +
                ",GROUP_CONCAT(if(l.label_type='3',l.label_name,null)) zhType " +
                ",GROUP_CONCAT(if(l.label_type='4',l.label_name,null)) zdyGroup,d1.dict_value signSourceName,d2.dict_value statusName ";
        String countSql = "select count(distinct a.id)";
        String filter = " from wlyy_sign a inner join base_patient p on a.patient=p.id " +
                " left join wlyy_patient_label l on l.patient = p.id "+
                " left join wlyy_hospital_sys_dict d1 on d1.dict_name='ijk_sign_source' and d1.dict_code = a.sign_source "+
                " left join wlyy_hospital_sys_dict d2 on d2.dict_name='ijk_sign_status' and d2.dict_code = a.status ";
        String orderBy = " limit "+(page-1)*size+","+size;
        if(StringUtils.isNotBlank(name)){
            filter += " and a.name like '%"+name+"%' ";
        }
        if(StringUtils.isNotBlank(idcard)){
            filter += " and a.idcard like '%"+idcard+"%' ";
        }
        if(StringUtils.isNotBlank(address)){
            filter += " and a.address like '%"+address+"%' ";
        }
        if(StringUtils.isNotBlank(hospitalName)){
            filter += " and a.hospital_name like '%"+hospitalName+"%' ";
        }
        if(StringUtils.isNotBlank(doctorName)){
            filter += " and a.doctor_name like '%"+doctorName+"%' ";
        }
        if(StringUtils.isNotBlank(diseaseCondition)){
            filter += " and a.diseaseCondition = '"+diseaseCondition+"' ";
        }
        //1健康情况 2疾病类型 3专病类型 4自定义标签
        if(StringUtils.isNotBlank(health)){
            filter += " and l.label_type='1' and l.label_name = '"+health+"' ";
        }
        if(StringUtils.isNotBlank(disease)){
            filter += " and l.label_type='2' and l.label_name = '"+disease+"' ";
        }
        if(StringUtils.isNotBlank(zbType)){
            filter += " and l.label_type='3' and l.label_name = '"+zbType+"' ";
        }
        if(StringUtils.isNotBlank(zdyGroup)){
            filter += " and l.label_type='4' and l.label_name = '"+zdyGroup+"' ";
        }
        List<WlyySign> list = jdbcTemplate.query(sql+filter+"GROUP BY a.id"+orderBy,new BeanPropertyRowMapper<>(WlyySign.class));
        long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public List<WlyyPatientLabelDO> findByPatient(String patient) {
        return patientLabelDao.findByPatient(patient);
    }
@ -123,6 +185,28 @@ public class LabelService {
                logDao.saveAll(labelLogDOS);
            }
        }
        //更新居民慢病标签
        List<WlyyPatientLabelDO> labelDOS1 = patientLabelDao.findByPatient2(patient);
        BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
        if(labelDOS1.size()==0){
            patientDO.setDisease("0");
        }else {
            //1高血压,2糖尿病
            int gxy = 0;
            int tnb = 0;
            for (WlyyPatientLabelDO labelDO:labelDOS1){
                if("高血压".equals(labelDO.getLabelName())){
                    gxy = 1;
                }
                if("糖尿病".equals(labelDO.getLabelName())){
                    tnb = 2;
                }
            }
            int disease = gxy+tnb;
            patientDO.setDisease(disease+"");
        }
        patientDao.save(patientDO);
    }
    //添加自定义标签字典

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

@ -23,6 +23,43 @@ public class StatisticsService {
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    /**
     * 医共体分析-头部
     * 1、【新签约人数】= 查询时间范围内,同安区新签约、续签的家签患者人数; i健康
     * 2、【签约患者数】= 时间范围内,同安区的家签患者总数; i健康
     * 3、【共管患者数】 = 时间范围内,签约三院专科团队的家签患者数+与三院医生产生业务交集的家签患者数;【共同管率】 = 共管患者数/签约患者数 X 100%;
     * 4、【家签门诊数】= 时间范围内,同安区的家签居民通过i健康进行预约线下门诊的次数; i健康
     * 5、【本院门诊数】= 时间范围内,同安区的家签居民通过i健康预约本院就诊的次数; i健康
     * 6、【外院门诊数】= 时间范围内,同安区的家签居民通过i健康预约其他医院就诊的次数;i健康
     * 7、【康复下转数】= 时间范围内,三院产生的康复下转总次数;
     * 8、【本院管理数】= 时间范围内,三院产生的康复下转中属于本院管理的次数;
     * 9、【社区管理数】= 时间范围内,三院产生的康复下转中属于社区管理的次数;
     * 10、【在线问诊数】= 时间范围内,三院完成的图文咨询、图文复诊、视频咨询、视频复诊、社区协诊总次数;
     * 11、【家签问诊数】= 时间范围内,同安区的家签居民在三院进行图文咨询、图文复诊、视频咨询、视频复诊、社区协诊的次数;
     * 12、【普患问诊数】= 时间范围内,普通患者三院进行图文咨询、图文复诊、视频咨询、视频复诊、社区协诊的次数;
     */
    public void medicalCommunityTop(String startDate,String endDate){
        String sql3 = "SELECT COUNT(DISTINCT s.id) from base_team_relation r,wlyy_sign s WHERE  r.admin_team_id=s.admin_team_id ";
        String sql7 = "select count(s.id) from wlyy_sign_family s,dm_hospital h " +
                " where s.status>0 and s.hospital=h.`code` and h.town='350212'";
        String sql8 = "select count(s.id) from wlyy_sign_family s,dm_hospital h,wlyy_patient_reservation r " +
                "  where s.status>0 and s.hospital=h.`code` and h.town='350212' and r.patient=s.patient and r.czrq>s.czrq";
        String sql10 = "select count(s.id) from wlyy_sign_family s,dm_hospital h,wlyy_patient_reservation r " +
                "      where s.status>0 and s.hospital=h.`code` and h.town='350212' and r.patient=s.patient " +
                " and r.czrq>s.czrq and r.org_code='350211A1004' ";
        if(StringUtils.isNotBlank(startDate)){
            sql3 += " and s.czrq>'"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql3 += " and s.czrq<='"+endDate+" 23:59:59' ";
        }
    }
    //服务情况明细
    public List<Map<String,Object>> serviceSituationDetail(HttpServletRequest request){
        String sql = "SELECT DISTINCT d.idcard,d.name,h.dept_code dept,h.dept_name deptName,0 collaborateNum,0 inviteNum" +

+ 1 - 1
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/dao/TrackPatientDao.java

@ -22,7 +22,7 @@ public interface TrackPatientDao extends PagingAndSortingRepository<TrackPatient
    @Query(value= "SELECT DISTINCT a.*\n" +
            "FROM wlyy_track_patient a  \n" +
            "INNER JOIN base_patient b ON a.patient_code=b.id \n" +
            "INNER JOIN base_patient_doctor_relation c ON b.id=c.patient_id  \n" +
            "INNER JOIN wlyy_outpatient c ON b.id=c.patient  \n" +
            "WHERE 1=1\n" +
            "AND c.doctor_id=?1 \n" +
            "AND a.del=?2 ",nativeQuery = true)

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

@ -105,7 +105,7 @@ public class DoctorSchemeService {
    public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType, String doctorcode, String trackFlag) throws Exception {
        String sql = "SELECT  a.id\n" +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n";
                "INNER JOIN wlyy_outpatient b ON a.id=b.patient\n";
        //1.4.2加入跟踪居民过滤
        if (StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)) {
@ -409,7 +409,7 @@ public class DoctorSchemeService {
                "	a.disease_condition \n" +
                "FROM\n" +
                "	base_patient a \n" +
                "	INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
                "	INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease IN ('1','2','1,2','2,1')\n" +
@ -2132,38 +2132,42 @@ public class DoctorSchemeService {
        // 高血压预警
        String sql01 = "SELECT count(DISTINCT  a.id)\n" +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease IN ('1','3') \n" +
                "AND b.doctor_id ='" + doctorId + "'";
                "and l.label_name='高血压' " +
                "AND b.doctor ='" + doctorId + "'";
        // 高血压
        String sql02 = "SELECT count(DISTINCT  a.id)\n" +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease IN ('1','3') \n" +
                "AND b.doctor_id ='" + doctorId + "'";
                "and l.label_name='高血压' " +
                "AND b.doctor ='" + doctorId + "'";
        // 糖尿病预警
        String sql03 = "SELECT count(DISTINCT  a.id)\n" +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease IN ('2','3') \n" +
                "AND b.doctor_id ='" + doctorId + "'";
                "and l.label_name='糖尿病' " +
                "AND b.doctor ='" + doctorId + "'";
        // 糖尿病
        String sql04 = "SELECT count(DISTINCT  a.id)\n" +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease IN ('2','3') \n" +
                "AND b.doctor_id ='" + doctorId + "'";
                "and l.label_name='糖尿病' " +
                "AND b.doctor ='" + doctorId + "'";
        CompletableFuture<Integer> future01 = CompletableFuture.supplyAsync(() -> {
            Integer count = jdbcTemplate.queryForObject(sql01, Integer.class);
@ -2202,18 +2206,19 @@ public class DoctorSchemeService {
     */
    public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType, 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,a.disease_condition diseaseCondition,a.photo,a.standard_status standardStatus" +
                ",a.sex,a.disease,a.disease_condition diseaseCondition,a.photo,a.standard_status standardStatus " +
                "FROM base_patient a \n" +
                "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','3') " +
                "AND b.doctor_id ='" + doctorId + "'";
                "AND b.doctor ='" + doctorId + "'";
        if (StringUtils.isNotBlank(labelType)) {
            if ("1".equals(labelType)) {
                sql += "AND a.disease IN ('1','3') \n";
                sql += "AND l.label_name='高血压' \n";
            }
            if ("2".equals(labelType)) {
                sql += "AND a.disease IN ('2','3') \n";
                sql += "AND l.label_name='糖尿病' \n";
            }
        }
        if (StringUtils.isNotBlank(searchContent)) {