瀏覽代碼

Merge branch 'dev' of trick9191/jw2.0 into dev

chenweida 6 年之前
父節點
當前提交
10a16bf265

+ 23 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java

@ -39,8 +39,11 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    @Column(name = "health_assistant_name")
    private String healthAssistantName;//计管师
    @Column(name = "sign_status")
    private String signStatus;//居民与专科医生签约状态: -2 医生拒绝,-1 已经取消,0待审核,1同意',
    @Column(name = "status")
    private String status;//1.已经分配,0,待分配
    private String status;//1.已经分配,0,待分配,-1失效
    @Column(name = "pk_code")
    private String pkCode; //服务包code
@ -64,10 +67,12 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    private String signYear;//签约年度
    @Column(name = "team_code")
    private Integer teamCode;//签约团队
    private Integer teamCode;//专科医生签约团队',
    @Column(name = "sign_date")
    private Date signDate;//签约日期
    @Column(name = "remark")
    private String remark;//记录专科医生审核原因等
    public String getSaasId() {
@ -215,4 +220,20 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    public void setPkCode(String pkCode) {
        this.pkCode = pkCode;
    }
    public String getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(String signStatus) {
        this.signStatus = signStatus;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 12 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java

@ -8,6 +8,8 @@ public class SpecialistMapping {
    public static final String api_specialist_common = "svr-specialist";
    public static final Integer api_specialist_fail = -1;
    public static final String api_success ="succes";
    public static final String doctor_exist ="doctor_exist";
    public static final String team_exist ="team_exist";
    public static class specialist{
@ -25,5 +27,15 @@ public class SpecialistMapping {
        public static final String getAssistantPatientCount ="/getAssistantPatientCount";
        public static final String getDoctorPatientByName ="/getDoctorPatientByName";
        public static final String findPatientNoAssistant ="/findPatientNoAssistant";
        public static final String signSpecialistTeam ="/signSpecialistTeam";
        public static final String agreeSpecialistTeam ="/agreeSpecialistTeam";
        public static final String findPatientSigninfo ="/findPatientSigninfo";
        public static final String findPatientTeamList ="/findPatientTeamList";
        public static final String findPatientSignSpecialist ="/findPatientSignSpecialist";
    }
}

+ 34 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/AdminTeamMemberVO.java

@ -0,0 +1,34 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "专科医生团队成员", description = "专科医生团队成员")
public class AdminTeamMemberVO {
    @ApiModelProperty("医生code")
    private String doctorCode;
    @ApiModelProperty("医生姓名")
    private String doctorName;
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

+ 20 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientLabelVO.java

@ -27,6 +27,10 @@ public class PatientLabelVO {
    private String healthcode;
    @ApiModelProperty("性别")
    private String sex;
    @ApiModelProperty("计管师")
    private String healthAssistant;
    @ApiModelProperty("计管师姓名")
    private String healthAssistantName;
    public String getCode() {
        return code;
@ -107,4 +111,20 @@ public class PatientLabelVO {
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getHealthAssistant() {
        return healthAssistant;
    }
    public void setHealthAssistant(String healthAssistant) {
        this.healthAssistant = healthAssistant;
    }
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
    public void setHealthAssistantName(String healthAssistantName) {
        this.healthAssistantName = healthAssistantName;
    }
}

+ 166 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java

@ -0,0 +1,166 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民专病签约信息", description = "居民专病签约信息")
public class PatientSignInfoVO {
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民")
    private String patientName;
    @ApiModelProperty("医生code")
    private String doctor;
    @ApiModelProperty("医生")
    private String doctorName;
    @ApiModelProperty("社区")
    private String hospital;
    @ApiModelProperty("社区名称")
    private String hospitalName;
    @ApiModelProperty("头像")
    private String photo;
    @ApiModelProperty("科室code")
    private String dept;
    @ApiModelProperty("科室")
    private String deptName;
    @ApiModelProperty("团队")
    private String teamName;
    @ApiModelProperty("团队code")
    private Long teamCode;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("签约状态")
    private String signStatus;
    @ApiModelProperty("记录状态")
    private String status;
    @ApiModelProperty("医生角色")
    private String level;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getTeamName() {
        return teamName;
    }
    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }
    public Long getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Long teamCode) {
        this.teamCode = teamCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(String signStatus) {
        this.signStatus = signStatus;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getLevel() {
        return level;
    }
    public void setLevel(String level) {
        this.level = level;
    }
}

+ 148 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java

@ -0,0 +1,148 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "专科医生团队与居民匹配关系", description = "专科医生团队与居民匹配关系")
public class SpecialistTeamVO {
    @ApiModelProperty("签约code")
    private String relationCode;
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("团队id")
    private Long teamCode;
    @ApiModelProperty("团队名称")
    private String name;
    @ApiModelProperty("医生头像")
    private String photo;
    @ApiModelProperty("医生code")
    private String doctor;
    @ApiModelProperty("医生")
    private String doctorName;
    @ApiModelProperty("科室code")
    private String dept;
    @ApiModelProperty("科室")
    private String deptName;
    @ApiModelProperty("社区code")
    private String hospital;
    @ApiModelProperty("社区")
    private String hospitalName;
    @ApiModelProperty("医生团队成员")
    private List<AdminTeamMemberVO> members;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Long getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Long teamCode) {
        this.teamCode = teamCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public List<AdminTeamMemberVO> getMembers() {
        return members;
    }
    public void setMembers(List<AdminTeamMemberVO> members) {
        this.members = members;
    }
}

+ 0 - 10
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -75,9 +75,6 @@ spring:
      password: # Login password.
      proxy.port:  # Proxy port the HTTP client should use.
      proxy.host:  # Proxy host the HTTP client should use.
  redis:
      host: 172.19.103.88 # Redis server host.
      port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
@ -106,9 +103,6 @@ spring:
      password: # Login password.
      proxy.port:  # Proxy port the HTTP client should use.
      proxy.host:  # Proxy host the HTTP client should use.
  redis:
      host: 172.19.103.88 # Redis server host.
      port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
@ -134,10 +128,6 @@ spring:
  #     uris: [图片]http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  redis:
       host: 59.61.92.90 # Redis server host.
       port: 9054  # Redis server port.
       password: jkzlehr
  #      username: # Login user.
  #      password: # Login password.
  #      proxy.port:  # Proxy port the HTTP client should use.

+ 74 - 8
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -7,10 +7,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
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.restmodel.specialist.*;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.service.SpecialistService;
@ -106,11 +103,12 @@ public class SpecialistController extends EnvelopRestController {
    @GetMapping(value = SpecialistMapping.specialist.findPatientRelatioByAssistant)
    @ApiOperation(value = "根据计管师获取居民信息")
    public Envelop<PatientRelationVO> findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true)String assistant,
    public Envelop<PatientRelationVO> findPatientRelatioByAssistant(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                                                    @ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true)String assistant,
                                                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                                                    @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
        try {
            return specialistService.findPatientRelatioByAssistant(assistant,page,size);
            return specialistService.findPatientRelatioByAssistant(doctor,assistant,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -151,9 +149,10 @@ public class SpecialistController extends EnvelopRestController {
    @GetMapping(value = SpecialistMapping.specialist.getAssistantPatientCount)
    @ApiOperation(value = "根据计管获取居民数量")
    public Envelop<Long> getAssistantPatientCount(@ApiParam(name = "doctor", value = "计管师医生") @RequestParam(required = true)String doctor) {
    public Envelop<Long> getAssistantPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                                  @ApiParam(name = "assistant", value = "计管师医生") @RequestParam(required = true)String assistant) {
        try {
            return specialistService.getAssistantPatientCount(doctor);
            return specialistService.getAssistantPatientCount(doctor,assistant);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -190,6 +189,73 @@ public class SpecialistController extends EnvelopRestController {
        }
    }
    @PostMapping(value = SpecialistMapping.specialist.signSpecialistTeam)
    @ApiOperation(value = "提交专科医生签约")
    public Envelop<SpecialistTeamVO> signSpecialistTeam(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient,
                                                        @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(required = true)String patientName,
                                                        @ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                                        @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(required = true)String doctorName,
                                                        @ApiParam(name = "teamCode", value = "团队code") @RequestParam(required = true)Long teamCode) {
        try {
            return specialistService.signSpecialistTeam( patient,  patientName,  doctor,  doctorName,  teamCode);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = SpecialistMapping.specialist.agreeSpecialistTeam)
    @ApiOperation(value = "专科医生审核")
    public Envelop<Boolean> agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true)String state,
                                                @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true)String relationCode,
                                                @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false)String remark) {
        try {
            return specialistService.agreeSpecialistTeam(state,relationCode,remark);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.findPatientSigninfo)
    @ApiOperation(value = "获取签约信息")
    public Envelop<PatientSignInfoVO> findPatientSigninfo(String code){
        try {
            return specialistService.findPatientSigninfo(code);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.findPatientTeamList)
    @ApiOperation(value = "获取居民所有有效签约团队信息")
    public Envelop<SpecialistTeamVO> findPatientTeamList(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient){
        try {
            return specialistService.findPatientTeamList(patient);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.specialist.findPatientSignSpecialist)
    @ApiOperation(value = "获取居民所有有效签约医生信息")
    public Envelop findPatientSignSpecialist(String patient){
        try {
            return specialistService.findPatientSignSpecialist(patient);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
//    @PostMapping(value = SpecialistMapping.specialist.createArticle)

+ 225 - 15
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -63,14 +64,14 @@ public class SpecialistService{
                "FROM " +
                " wlyy_specialist_patient_relation r " +
                "WHERE " +
                " r.doctor = '"+doctor+"' ORDER BY r.create_time DESC LIMIT "+(page-1)*size+","+size;
                " r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 ORDER BY r.create_time DESC LIMIT "+(page-1)*size+","+size;
        List<SpecialistPatientRelationVO> specialistPatientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationVO.class));
        String sqlcount = "SELECT count(1) AS total " +
                "FROM " +
                " wlyy_specialist_patient_relation r " +
                "WHERE " +
                " r.doctor = '"+doctor+"';";
                " r.doctor = '"+doctor+"'  AND r.status >=0  AND r.sign_status >0 ;";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
@ -94,7 +95,7 @@ public class SpecialistService{
                " "+basedb+".wlyy_sign_patient_label_info i " +
                " WHERE " +
                " i.label_type = '7' AND " +
                " i.status = 1 " +
                " i.status = 1 AND r.status >=0  AND r.sign_status >0" +
                " )";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
@ -116,7 +117,7 @@ public class SpecialistService{
                " 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 " +
                " WHERE " +
                " r.doctor = '"+doctor+"'" +
                " r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0" +
                " AND r.patient " +
                " NOT IN ( " +
                "  SELECT " +
@ -144,7 +145,7 @@ public class SpecialistService{
        return Envelop.getSuccess(SpecialistMapping.api_success,true);
    }
    public Envelop<PatientRelationVO> findPatientRelatioByAssistant(String assistant,Integer page,Integer size){
    public Envelop<PatientRelationVO> findPatientRelatioByAssistant(String doctor ,String assistant,Integer page,Integer size){
        String sql ="SELECT " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
@ -167,7 +168,8 @@ public class SpecialistService{
                " AND t.`status` = '1' " +
                " ) h ON h.patient = r.patient " +
                " WHERE " +
                " r.health_assistant = '"+assistant+"' LIMIT "+(page-1)*size+","+size;
                "  r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 "+
                " AND r.health_assistant = '"+assistant+"' LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -191,7 +193,9 @@ public class SpecialistService{
                " lb.label, " +
                " p.photo, " +
                " h.label_name as health, " +
                " h.label AS healthcode " +
                " h.label AS healthcode ," +
                " s.health_assistant AS healthAssistant," +
                " s.health_assistant_name AS healthAssistantName" +
                " FROM " +
                " ( " +
                "  SELECT " +
@ -219,7 +223,7 @@ public class SpecialistService{
                "  t.label_type = '8' " +
                " AND t.`status` = '1' " +
                " ) h ON h.patient = lb.patient " +
                " WHERE s.doctor ='"+doctor+"'"+
                " WHERE s.doctor ='"+doctor+"' AND s.status >=0  AND s.sign_status >0"+
                " LIMIT "+(page-1)*size+","+size;
        List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
@ -246,7 +250,7 @@ public class SpecialistService{
                " ) lb " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
                " WHERE " +
                " s.doctor = '"+doctor+"' ";
                " s.doctor = '"+doctor+"' AND s.status >=0  AND s.sign_status >0";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
@ -255,9 +259,9 @@ public class SpecialistService{
        return Envelop.getSuccess(SpecialistMapping.api_success,count);
    }
    public Envelop<Long> getAssistantPatientCount(String doctor){
    public Envelop<Long> getAssistantPatientCount(String doctor,String assistant){
        String sql = "SELECT COUNT(1) AS total FROM wlyy_specialist_patient_relation r WHERE r.health_assistant = '"+doctor+"' AND r.`status` <> '-1' ";
        String sql = "SELECT COUNT(1) AS total FROM wlyy_specialist_patient_relation r WHERE r.doctor ='"+doctor+"'  AND r.health_assistant = '"+assistant+"' AND r.status >=0  AND r.sign_status >0";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
@ -292,7 +296,7 @@ public class SpecialistService{
                " ) h ON h.patient = r.patient " +
                " WHERE " +
                " r.doctor='"+doctor+"' " +
                " AND r.`status`<>'-1'" +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND r.patient_name LIKE '%"+nameKey+"%' "+
                " LIMIT "+(page-1)*size+","+size;
@ -308,9 +312,20 @@ public class SpecialistService{
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_patient p ON r.patient = p.`code` " +
                " 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 = r.patient " +
                " WHERE " +
                " r.doctor='"+doctor+"' " +
                " AND r.`status`<>'-1'" +
                " AND r.status >=0  AND r.sign_status >0" +
                " AND r.health_assistant IS NULL ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sqlTotal);
        Long total = 0L;
@ -329,7 +344,7 @@ public class SpecialistService{
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_patient p ON r.patient = p.`code` " +
                " LEFT JOIN ( " +
                " JOIN ( " +
                " SELECT " +
                "  t.label, " +
                "  t.label_name, " +
@ -342,7 +357,7 @@ public class SpecialistService{
                " ) h ON h.patient = r.patient " +
                " WHERE " +
                " r.doctor='"+doctor+"' " +
                " AND r.`status`<>'-1'" +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND r.health_assistant IS NULL "+
                " LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -351,6 +366,201 @@ public class SpecialistService{
    }
    public Envelop<SpecialistTeamVO> signSpecialistTeam(String patient,String patientName,String doctor,String doctorName,Long teamCode){
        //1.查询该居民是否已经与该专科医生签约
        String checkDoctorSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " t.`name`, " +
                " d.photo ," +
                " d.code AS doctor," +
                " d.name AS doctorName" +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN "+basedb+".wlyy_doctor d ON d. CODE = r.doctor " +
                " WHERE " +
                " r.patient = '"+patient+"' " +
                " AND r.doctor = '"+doctor+"' " +
                " AND r.`status` >= 0 " +
                " AND r.sign_status >=0 " +
                " AND t.available = '1' ";
        List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(checkDoctorSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            return Envelop.getSuccess(SpecialistMapping.doctor_exist,specialistTeamVOs.get(0));
        }
        //验证团队是否已经签约
        String checkTeamSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " t.`name`, " +
                " d.photo " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN "+basedb+".wlyy_doctor d ON d. CODE = r.doctor " +
                " WHERE " +
                " r.patient = '"+patient+"' " +
                " AND r.team_code = " +teamCode+
                " AND r.`status` >=0 " +
                " AND r.sign_status >=0 " +
                " AND t.available = '1' ";
        List<SpecialistTeamVO> teamVOs = jdbcTemplate.query(checkTeamSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(teamVOs!=null&&teamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:teamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            return Envelop.getSuccess(SpecialistMapping.team_exist,teamVOs.get(0));
        }
        //存储签约关系
        SpecialistPatientRelationDO relation = new SpecialistPatientRelationDO();
        relation.setDoctor(doctor);
        relation.setDoctorName(doctorName);
        relation.setPatient(patient);
        relation.setPatientName(patientName);
        relation.setTeamCode(teamCode.intValue());
        relation.setStatus("0");
        relation.setSignStatus("0");
        relation.setCreateTime(new Date());
        SpecialistPatientRelationDO relationDO = specialistPatientRelationDao.save(relation);
        return Envelop.getSuccess(SpecialistMapping.api_success,relationDO.getId());
    }
    public Envelop<Boolean> agreeSpecialistTeam(String state,String relationCode,String remark){
        SpecialistPatientRelationDO relation = specialistPatientRelationDao.findOne(relationCode);
        if("0".equals(state)){
            relation.setSignStatus("-2");
            relation.setRemark(remark);
            specialistPatientRelationDao.save(relation);
        }else{
            relation.setSignStatus("1");
            specialistPatientRelationDao.save(relation);
        }
        return Envelop.getSuccess(SpecialistMapping.api_success,relation);
    }
    public Envelop<PatientSignInfoVO> findPatientSigninfo(String code){
        String sql = "SELECT " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.doctor, " +
                " r.doctor_name AS doctorName, " +
                " d.hospital, " +
                " d.hospital_name AS hospitalName, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
                " t.`name` AS teamName, " +
                " t.id As teamCode, " +
                " r.create_time AS createTime," +
                " r.status," +
                " r.sign_status AS signStatus  " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_doctor d ON r.doctor = d.code " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " WHERE " +
                " r.id = '"+code+"'";
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
        return Envelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs.get(0));
    }
    public Envelop<SpecialistTeamVO> findPatientTeamList(String patient){
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.team_code, " +
                " t.`name` AS name," +
                " d.photo" +
                " FROM " +
                " wlyy_specialist_patient_relation r  " +
                " JOIN wlyy.wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN wlyy.wlyy_doctor d ON t.leader_code = d.`code` " +
                " WHERE " +
                " r.patient = '"+patient+"' " +
                " AND r.`status` >=0  " +
                " AND r.sign_status >0";
        List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
        }
        return Envelop.getSuccess(SpecialistMapping.api_success,specialistTeamVOs);
    }
    public Envelop findPatientSignSpecialist(String patient){
        String sql = "SELECT " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " d.name AS doctorName, " +
                " d.code AS doctor, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
                " d.hospital, " +
                " d.hospital_name AS hospital_name, " +
                " d.`level` " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                "  JOIN wlyy.wlyy_doctor d ON r.doctor = d.`code` " +
                " WHERE  " +
                " r.patient ='"+patient+"' " +
                " AND r.`status`>=0 " +
                " AND r.sign_status >0";
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
        return Envelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs);
    }
//    public Envelop<Boolean> createSpecialists(List<SpecialistDO> info){
//        specialistDao.save(info);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);

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

@ -3,6 +3,8 @@ server:
  port: 10051
spring:
  jmx:
    default-domain: jkzl_specialist
  application:
    name:  svr-wlyy-specialist-lyx  #注册到发现服务的id 如果id一样 eurika会自动做负载