Browse Source

三院需求

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
a5ebf07326

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/team/BaseTeamRelationDao.java

@ -16,6 +16,9 @@ public interface BaseTeamRelationDao extends JpaRepository<BaseTeamRelationDO, S
    @Query(value = "select t from BaseTeamRelationDO t where t.teamId=?1 and t.adminTeamId=?2")
    List<BaseTeamRelationDO> findAdminTeamById(String teamId, Integer adminTeamId);
    @Query(value = "select t from BaseTeamRelationDO t where t.adminTeamId=?1")
    List<BaseTeamRelationDO> findAdminTeamById(Integer adminTeamId);
    @Modifying
    @Query(value = "delete from BaseTeamRelationDO  where teamId=?1 and adminTeamId=?2")
    void delTeam(String teamId,Integer adminTeamId);

+ 98 - 2
business/base-service/src/main/java/com/yihu/jw/team/service/TeamService.java

@ -9,10 +9,12 @@ import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.base.team.BaseTeamRelationDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.team.BaseDoctorTeamDao;
import com.yihu.jw.team.BaseDoctorTeamMemberDao;
import com.yihu.jw.team.BaseTeamRelationDao;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -45,6 +47,56 @@ public class TeamService {
    private BaseTeamRelationDao teamRelationDao;
    @Autowired
    private AsynchService asynchService;
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    private static final String TONGAN_TOWN = "350212";
    //居民是否签约(签约详情)
    public Envelop isSign(String idCard,String info){
        JSONObject re = wlyyBusinessService.isSign(idCard);
        if(re!=null){
            JSONObject data = re.getJSONObject("obj");
            JSONObject json = new JSONObject();
            Integer adminTeamId = 0;
            if(data==null){
                //0未签约 1已签约不是同安社区 2已签约同安社区未关联专科团队 3已签约同安社区已关联专科团队
                json.put("status","0");
            }else{
                String hospital = data.getString("hospital");
                adminTeamId = data.getInteger("adminTeamId");
                if(hospital.startsWith(TONGAN_TOWN)){
                    List<BaseTeamRelationDO> list =  teamRelationDao.findAdminTeamById(adminTeamId);
                    if(list.size()>0){
                        json.put("status","3");
                    }else {
                        json.put("status","2");
                    }
                }else {
                    json.put("status","1");
                }
                if(StringUtils.isNotBlank(info)){
                    //返回详情
                    json.put("hospital",hospital);
                    json.put("hospitalName",data.getString("hospitalName"));
                    json.put("doctorName",data.getString("doctorName"));
//                    json.put("doctorHealthName",data.getString("doctorHealthName"));
                    json.put("jobName",data.getString("jobName"));
                }
            }
            if(StringUtils.isNotBlank(info)){
                String sql = " SELECT t.id,t.dept_name deptName,t.recommend_doctor recommendDoctor,t.recommend_doctor_name recommendDoctorName,d.photo,d.job_title_name jobTitleName\n" +
                        " from base_team t LEFT JOIN base_team_relation r on t.id = r.team_id and r.admin_team_id= " + adminTeamId+
                        " LEFT JOIN base_doctor d on t.recommend_doctor = t.id " +
                        " WHERE t.del=1 and t.recommend='1' ORDER BY r.id desc LIMIT 3";
                List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
                json.put("doctorList",mapList);
            }
            return ObjEnvelop.getSuccess("获取成功",json);
        }else {
            return Envelop.getError("获取签约信息失败",-1);
        }
    }
    //删除团队成员
    public void delTeamMember(String id){
@ -73,8 +125,39 @@ public class TeamService {
        return teamDao.findById(id).orElse(null);
    }
    //获取团队详情
    public Envelop teamDetail(String id){
        JSONObject json = new JSONObject();
        BaseTeamDO teamDO = findTeamById(id);
        List<Map<String,Object>> doctorList = new ArrayList<>();
        if(teamDO!=null){
            String recommendDoctor = teamDO.getRecommendDoctor();
            String sql = "SELECT d.id,d.name,d.photo,d.introduce,d.job_title_name jobTitleName,'0' recommend ,GROUP_CONCAT(h.dept_name) deptName " +
                    "from base_team_member m,base_doctor d LEFT JOIN base_doctor_hospital h on d.id = h.doctor_code and h.del='1' " +
                    "WHERE m.team_code='"+id+"' and m.del='1' and m.doctor_code=d.id ";
            if(StringUtils.isNotBlank(recommendDoctor)){
                sql += " and d.id <> '"+recommendDoctor+"'";
                String recSql = " SELECT d.id,d.name,d.photo,d.introduce,d.job_title_name jobTitleName,'1' recommend ,GROUP_CONCAT(h.dept_name) deptName " +
                        "from base_doctor d LEFT JOIN base_doctor_hospital h on d.id = h.doctor_code and h.del='1' " +
                        "WHERE d.id='"+recommendDoctor+"'  GROUP BY d.id,d.name,d.photo,d.introduce,d.job_title_name";
                List<Map<String,Object>> recList = jdbcTemplate.queryForList(recSql);
                if(recList.size()>0){
                    doctorList.add(recList.get(0));
                }
            }
            sql += " GROUP BY d.id,d.name,d.photo,d.introduce,d.job_title_name";
            List<Map<String,Object>> docList = jdbcTemplate.queryForList(sql);
            if(docList.size()>0){
                doctorList.addAll(docList);
            }
        }
        json.put("teamDO",teamDO);
        json.put("doctorList",doctorList);
        return ObjEnvelop.getSuccess("获取成功",json);
    }
    //获取专科团队列表
    public Envelop getTeamList(Integer adminTeamId,String teamName, String dept, Integer page, Integer pageSize, String hospital,String recommend, String recommendDoctorName) {
    public Envelop getTeamList(String type,Integer adminTeamId,String teamName, String dept, Integer page, Integer pageSize, String hospital,String recommend, String recommendDoctorName) {
        String countSql = " select count(t.id) ";
        String sql = "SELECT t.id,t.`name`,t.org_code orgCode,t.org_name orgName,t.dept,t.dept_name deptName,t.recommend_doctor recommendDoctor," +
                "t.recommend_doctor_name recommendDoctorName,DATE_FORMAT(t.create_time,'%Y-%m-%d %H:%i:%S') createTime,t.intro,t.recommend ";
@ -104,9 +187,22 @@ public class TeamService {
        if(page==null||page<=0){
            page = 1;
        }
        String orderBy = " order by t.id limit "+(page-1)*pageSize+","+pageSize;
        String orderBy = "";
        if("1".equals(type)){
            orderBy = " order by t.recommend desc limit "+(page-1)*pageSize+","+pageSize;
        }else {
            orderBy = " order by t.id limit "+(page-1)*pageSize+","+pageSize;
        }
        Long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filter+orderBy);
        for (Map<String,Object> map:list){
            String id = map.get("id")+"";
            //获取团队成员
            String doctorSql = "SELECT d.id,d.name,d.photo from base_team_member m,base_doctor d " +
                    " WHERE m.team_code='"+id+"' and m.del='1' and m.doctor_code=d.id and d.del='1' ";
            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            map.put("doctorList",mapList);
        }
        return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,count);
    }

+ 1 - 15
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/team/DoctorTeamEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.team;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.team.service.TeamService;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
@ -29,21 +30,6 @@ public class DoctorTeamEndpoint extends EnvelopRestEndpoint {
    private BasePatientDao patientDao;
    private static final String TONGAN_TOWN = "350212";
    @GetMapping(value = "isSign")
    @ApiOperation(value = "居民是否签约")
    public String isSign(@RequestParam(required = true) String id) {
        try {
            BasePatientDO patientDO = patientDao.findById(id).orElse(null);
            if(patientDO==null){
                return error(-1,"居民不存在");
            }
            return wlyyBusinessService.isSign(patientDO.getIdcard()).toJSONString();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @GetMapping(value = "doctorInfo")
    @ApiOperation(value = "获取社区医生信息")
    public String doctorInfo(@RequestParam(required = true) String code) {

+ 51 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/team/SpecialistTeamEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.endpoint.team;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -27,18 +28,60 @@ public class SpecialistTeamEndpoint extends EnvelopRestEndpoint {
    private BasePatientDao patientDao;
    private static final String TONGAN_TOWN = "350212";
    @GetMapping(value = "isSign")
    @ApiOperation(value = "居民是否签约")
    public Envelop isSign(@RequestParam(required = true) String id) {
        try {
            BasePatientDO patientDO = patientDao.findById(id).orElse(null);
            if(patientDO==null){
                return Envelop.getError("居民不存在",-1);
            }
            return teamService.isSign(patientDO.getIdcard(),null);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败",-1);
        }
    }
    @GetMapping(value = "signInfo")
    @ApiOperation(value = "居民签约详情")
    public Envelop signInfo(@RequestParam(required = true) String id) {
        try {
            BasePatientDO patientDO = patientDao.findById(id).orElse(null);
            if(patientDO==null){
                return Envelop.getError("居民不存在",-1);
            }
            return teamService.isSign(patientDO.getIdcard(),"1");
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败",-1);
        }
    }
    @GetMapping(value = "teamDetail")
    @ApiOperation(value = "获取团队详情")
    public Envelop teamDetail(@RequestParam(required = true) String id) {
        try {
            return teamService.teamDetail(id);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败",-1);
        }
    }
    @GetMapping(value = "getTeamList")
    @ApiOperation(value = "获取专科团队列表")
    public Envelop getTeamList(@RequestParam(required = false) String teamName,
                                   @RequestParam(required = false) String dept,
                                   @RequestParam(required = false) String recommend,
                                   @RequestParam(required = false) Integer adminTeamId,
                                   @RequestParam(required = false) String hospital,
                                   @RequestParam(required = false) String recommendDoctorName,
                                   @RequestParam(required = false) Integer page,
                                   @RequestParam(required = false) Integer pageSize) {
                               @RequestParam(required = false) String dept,
                               @RequestParam(required = false) String recommend,
                               @RequestParam(required = false) String type,
                               @RequestParam(required = false) Integer adminTeamId,
                               @RequestParam(required = false) String hospital,
                               @RequestParam(required = false) String recommendDoctorName,
                               @RequestParam(required = false) Integer page,
                               @RequestParam(required = false) Integer pageSize) {
        try {
            return teamService.getTeamList(adminTeamId,teamName,dept,page,pageSize,hospital,recommend,recommendDoctorName);
            return teamService.getTeamList(type,adminTeamId,teamName,dept,page,pageSize,hospital,recommend,recommendDoctorName);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败",-1);