trick9191 6 years ago
parent
commit
3880597f88

+ 1 - 0
svr/svr-wlyy-specialist/pom.xml

@ -13,6 +13,7 @@
    <groupId>com.yihu.specialist</groupId>
    <artifactId>svr-wlyy-specialist</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <dependencies>
        <dependency>

+ 44 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -11,6 +11,7 @@ import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.specialist.AssistantVO;
import com.yihu.jw.restmodel.specialist.PatientLabelVO;
import com.yihu.jw.restmodel.specialist.PatientRelationVO;
import com.yihu.jw.restmodel.specialist.SpecialistPatientRelationVO;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
@ -162,4 +163,47 @@ public class SpecialistController extends EnvelopRestController {
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.getPatientByLabel)
    @ApiOperation(value = "根据标签获取居民信息")
    public Envelop<PatientLabelVO>  getPatientByLabel(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                                      @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true)String labelType,
                                                      @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
        try {
            return specialistService.getPatientByLabel(doctor,labelType,labelCode,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.getLabelpatientCount)
    @ApiOperation(value = "根据标签获取居民数量")
    public Envelop<Long> getLabelpatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                              @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true)String labelType,
                                              @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode) {
        try {
            return specialistService.getLabelpatientCount(doctor,labelType,labelCode);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.getAssistantPatientCount)
    @ApiOperation(value = "根据计管获取居民数量")
    public Envelop<Long> getAssistantPatientCount(@ApiParam(name = "doctor", value = "计管师医生") @RequestParam(required = true)String doctor) {
        try {
            return specialistService.getAssistantPatientCount(doctor);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 96 - 6
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -1,10 +1,7 @@
package com.yihu.jw.service;
import com.yihu.jw.dao.*;
import com.yihu.jw.entity.specialist.SpecialistArticleDO;
import com.yihu.jw.entity.specialist.SpecialistConsultDO;
import com.yihu.jw.entity.specialist.SpecialistDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.*;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.rm.specialist.SpecialistMapping;
@ -126,7 +123,8 @@ public class SpecialistService{
                " r.patient_name AS patientName, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo, " +
                " rd.create_time AS createTime " +
                " rd.create_time AS createTime ," +
                " p.sex " +
                " FROM " +
                " wlyy_specialist_patient_relation r JOIN "+basedb+".wlyy_patient p ON p.code = r.patient  " +
                " LEFT JOIN wlyy_patient_hospital_record rd ON r.discharge_record = rd.id " +
@ -138,7 +136,7 @@ public class SpecialistService{
                "  FROM " +
                "   wlyy.wlyy_sign_patient_label_info i " +
                "  WHERE " +
                "   i.label_type = '5' AND " +
                "   i.label_type = '7' AND " +
                "   i.status = 1 " +
                " )";
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -173,4 +171,96 @@ public class SpecialistService{
        return Envelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
    }
    public Envelop<PatientLabelVO>  getPatientByLabel(String doctor,String labelType, String labelCode, Integer page, Integer size){
        String sql="SELECT " +
                " p. NAME, " +
                " p. CODE, " +
                " IFNULL( " +
                "  YEAR ( " +
                "   from_days(datediff(now(), p.birthday)) " +
                "  ), " +
                "  '未知' " +
                " ) age, " +
                " lb.labelName, " +
                " lb.labelType, " +
                " lb.label, " +
                " p.photo, " +
                " h.label_name as health, " +
                " h.label AS healthcode " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   i.label_type AS labelType, " +
                "   i.label, " +
                "   i.label_name AS labelName, " +
                "   i.patient " +
                "  FROM " +
                "   "+basedb+".wlyy_sign_patient_label_info i " +
                "  WHERE " +
                "   i.label = '"+labelCode+"' " +
                "  AND i.label_type = '"+labelType+"' " +
                "  AND i.`status` = '1' " +
                " ) lb " +
                " JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
                " LEFT JOIN ( " +
                " SELECT " +
                "  t.label, " +
                "  t.label_name, " +
                "  t.patient " +
                " FROM " +
                "  "+basedb+".wlyy_sign_patient_label_info t " +
                " WHERE " +
                "  t.label_type = '8' " +
                " AND t.`status` = '1' " +
                " ) h ON h.patient = lb.patient " +
                " WHERE s.doctor ='"+doctor+"'"+
                " LIMIT "+(page-1)*size+","+size;
        List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
        return Envelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
    }
    public Envelop<Long> getLabelpatientCount(String doctor,String label,String labelType){
        String sql = "SELECT " +
                " COUNT(1) as total " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   i.label_type AS labelType, " +
                "   i.label, " +
                "   i.label_name AS labelName, " +
                "   i.patient " +
                "  FROM " +
                "   "+basedb+".wlyy_sign_patient_label_info i " +
                "  WHERE " +
                "   i.label = '"+label+"' "+
                "  AND i.label_type = '"+labelType+"' " +
                "  AND i.`status` = '1' " +
                " ) lb " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
                " WHERE " +
                " s.doctor = '"+doctor+"' ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccess(SpecialistMapping.api_success,count);
    }
    public Envelop<Long> getAssistantPatientCount(String doctor){
        String sql = "SELECT COUNT(1) AS total FROM wlyy_specialist_patient_relation r WHERE r.health_assistant = '"+doctor+"' AND r.`status` <> '-1' ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccess(SpecialistMapping.api_success,count);
    }
}

+ 14 - 0
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -80,9 +80,23 @@ fastDFS:
---
spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.17.110.160/wlyy_specialist?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwdevtest
  datasource:
    url: jdbc:mysql://172.19.103.85/wlyy_specialist?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: linzhou
    password: linzhou
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwprod

+ 10 - 0
svr/svr-wlyy-specialist/src/main/resources/bootstrap.yml

@ -33,6 +33,16 @@ eureka:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring:
  profiles: jwdevtest
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring: