Browse Source

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 4 years ago
parent
commit
0b2a0a8fa1

+ 65 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/label/PatientLabelEndpoint.java

@ -0,0 +1,65 @@
package com.yihu.jw.care.endpoint.label;
import com.yihu.jw.care.service.label.PatientLableService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/4/8.
 */
@RestController
@RequestMapping(value = "patientLable")
@Api(value = "居民标签", description = "居民标签", tags = {"医生端-居民标签"})
public class PatientLabelEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientLableService patientLableService;
    @GetMapping(value = "findSignPatientLabelNumByTeamCode")
    @ApiOperation(value = "按团队查找签约居民的标签统计")
    public ListEnvelop findSignPatientLabelNumByTeamCode (
            @ApiParam(name = "teamCode", value = "团队code", required = true)
            @RequestParam(value = "teamCode",required = true) String teamCode) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",patientLableService.findSignPatientLabelNumByTeamCode(teamCode));
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findSignPatientLabelListByTeamCode")
    @ApiOperation(value = "按团队和标签查找签约居民")
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode (
            @ApiParam(name = "teamCode", value = "团队code", required = true)
            @RequestParam(value = "teamCode",required = true) String teamCode,
            @ApiParam(name = "labelCode", value = "标签", required = true)
            @RequestParam(value = "labelCode",required = true) String labelCode,
            @ApiParam(name = "name", value = "姓名或身份证", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            return patientLableService.findSignPatientLabelListByTeamCode(teamCode, labelCode, name, page, size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 6 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/common/DictService.java

@ -49,6 +49,12 @@ public class DictService {
        return value;
    }
    //查字典
    public List<Map<String,Object>> findDictsByName(String dictName){
        String  sql = "select t.dict_code code,t.dict_value name from wlyy_hospital_sys_dict t where t.dict_name = '"+dictName+"'";
        return jdbcTemplate.queryForList(sql);
    }
    //查字典
    public MixEnvelop findDictsByNameCode(String modelName,String name,String code,String value,Integer page ,Integer pageSize){
        String  sql = "select t.id as \"id\"," +

+ 83 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java

@ -0,0 +1,83 @@
package com.yihu.jw.care.service.label;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/4/8.
 */
@Service
public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, WlyyPatientLabelDao> {
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private DictService dictService;
    /**
     * 按团队查找签约居民的标签统计
     * @param teamCode
     * @return
     */
    public List<Map<String,Object>> findSignPatientLabelNumByTeamCode(String teamCode){
        String sql = "SELECT COUNT(a.id) num,dict.dict_code labelCode,dict.dict_value labelName " +
                " from wlyy_hospital_sys_dict dict " +
                "LEFT JOIN (SELECT DISTINCT l.id,l.label_code  " +
                "from base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_patient p,wlyy_patient_label l " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
                "                and i.del = 1 and i.team_code = '"+teamCode+"' " +
                "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1) " +
                "a on dict.dict_code = a.label_code  " +
                "where dict.dict_name = '"+ConstantUtil.DICT_SERVICE_TYPE+"'  " +
                "GROUP BY labelCode,labelName ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:list){
            if(map.get("labelCode")==null){
                list.remove(map);
                break;
            }
        }
        return list;
    }
    /**
     * 按团队和标签查找签约居民
     * @param teamCode
     * @return
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode(String teamCode, String labelCode, String name, int page, int size){
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex " ;
        String countSql = "SELECT count(p.id) ";
        String filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_patient p,wlyy_patient_label l " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
                "                and i.del = 1 and i.team_code =  '"+teamCode+"' " +
                "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1 and l.label_code =  '"+labelCode+"' ";
        if(StringUtils.isNotBlank(name)){
            filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
        }
        String orderBy = " ORDER BY sr.create_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map : list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -67,7 +67,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        String filters = " from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_patient p " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and p.id = sr.patient " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' ";

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -87,7 +87,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
                "base_capacity_assessment_record ar, " +
                "base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_team_member m  " +
                "                WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id  " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
                "                and i.del = 1 and m.team_code = i.team_code and ar.patient = sr.patient " +
                "                and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 " +
                "GROUP BY ar.level_conclusion" ;
@ -100,7 +100,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        String sql2 = "SELECT COUNT(DISTINCT ar.id) from base_patient ar, " +
                "base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_team_member m  " +
                "                WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id  " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
                "                and i.del = 1 and m.team_code = i.team_code and ar.id = sr.patient and ar.archive_type = 2 " +
                "                and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1";
        Integer count = jdbcTemplate.queryForObject(sql2,Integer.class);

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -78,7 +78,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                " base_service_package_item i, " +
                " base_org o " +
                "WHERE " +
                " sr.id = r.sign_id and sr.patient = '"+patient+"'" +
                " sr.id = r.sign_id and sr.status=1 and sr.patient = '"+patient+"'" +
                "AND r.service_package_id = i.service_package_id " +
                "AND i.del = 1 " +
                "and i.org_code = o.code " +
@ -126,7 +126,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
     */
    public List<Map<String,Object>> fingServiceItemsByPatientId(String patientId){
        String sql = "SELECT DISTINCT i.code,i.name from base_service_package_sign_record sr,base_service_package_record r, " +
                " base_service_package_item i  where  sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                " base_service_package_item i  where  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "  and i.del = 1 and sr.`status`=1 and  sr.patient  = '"+patientId+"' ";
        return jdbcTemplate.queryForList(sql);
    }
@ -138,7 +138,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
     */
    public List<String> fingServiceItemsCodeByPatientId(String patientId){
        String sql = "SELECT DISTINCT i.code from base_service_package_sign_record sr,base_service_package_record r, " +
                " base_service_package_item i  where  sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                " base_service_package_item i  where  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "  and i.del = 1 and sr.`status`=1 and  sr.patient  = '"+patientId+"' ";
        return jdbcTemplate.queryForList(sql,String.class);
    }
@ -169,7 +169,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
        String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_doctor d " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code " +
                "and m.del = '1' and d.level = " + level+
                " and sr.id = '"+signId+"' ";
@ -216,7 +216,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        String filters = " from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_patient p " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and p.id = sr.patient " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 ";
@ -248,7 +248,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    public int getSignTotal(String doctorId){
        String sql = "SELECT COUNT(DISTINCT sr.patient) from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 ";

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/ConstantUtil.java

@ -24,6 +24,7 @@ public class ConstantUtil {
     patient_label 居民标签
     service_type 服务类型
     label_type 标签类型
     level_conclusion 评估结果
     */
    public static final String DICT_ARCHIVETYPE = "archiveType";
    public static final String DICT_ARCHIVESTATUS = "archiveStatus";
@ -35,6 +36,7 @@ public class ConstantUtil {
    public static final String DICT_PATIENT_LABEL = "patient_label";
    public static final String DICT_SERVICE_TYPE = "service_type";
    public static final String DICT_LABEL_TYPE = "label_type";
    public static final String DICT_LEVEL_CONCLUSION = "level_conclusion";
}