Commit 455bbc81d6b71efbe4565bbcbe376289428af2f0

Authored by changpengfei
1 parent abae917fa3
Exists in master and in 1 other branch dev

医生统计,码表转换等

Showing 5 changed files with 67 additions and 3 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java View file @ 455bbc8
... ... @@ -2,11 +2,11 @@
2 2  
3 3 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
4 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5 +import com.lyms.talkonlineweb.domain.LymsDict;
5 6 import com.lyms.talkonlineweb.domain.LymsDoctor;
6 7 import com.lyms.talkonlineweb.domain.LymsHdepart;
7 8 import com.lyms.talkonlineweb.result.BaseResponse;
8   -import com.lyms.talkonlineweb.service.LymsDoctorService;
9   -import com.lyms.talkonlineweb.service.LymsHdepartService;
  9 +import com.lyms.talkonlineweb.service.*;
10 10 import com.lyms.talkonlineweb.util.Constant;
11 11 import com.lyms.talkonlineweb.util.JwtUtils;
12 12 import org.springframework.beans.factory.annotation.Autowired;
13 13  
... ... @@ -29,7 +29,14 @@
29 29 @Autowired
30 30 private LymsDoctorService lymsDoctorService;
31 31  
  32 + @Autowired
  33 + private LymsHdepartService lymsHdepartService;
  34 + @Autowired
  35 + private LymsHospitalService lymsHospitalService;
  36 + @Autowired
  37 + private LymsDictService lymsDictService;
32 38  
  39 +
33 40 /**
34 41 * 获取医生列表
35 42 * @param doctor
36 43  
... ... @@ -42,12 +49,32 @@
42 49 BaseResponse baseResponse=new BaseResponse();
43 50 Page<LymsDoctor> page=new Page<>(current,size);
44 51 Page<LymsDoctor> doctorPagePage=lymsDoctorService.page(page, Wrappers.query(doctor).orderByDesc("updated_time","createdtime"));
45   -
  52 + conDocCode(doctorPagePage);
46 53 baseResponse.setObject(doctorPagePage);
47 54  
48 55 return baseResponse;
49 56 }
50 57  
  58 + public void conDocCode(Page<LymsDoctor> doctorPagePage){
  59 + Map param=new HashMap();
  60 + param.put("vtype",4);
  61 + List<LymsDict> dLst=lymsDictService.listByMap(param);
  62 + doctorPagePage.getRecords().forEach(d->{
  63 + param.clear();
  64 + param.put("did",d.getDpid());
  65 + List<LymsHdepart> departLst=lymsHdepartService.listByMap(param);
  66 + if(departLst.size()>0){
  67 + LymsHdepart depart=departLst.get(0);
  68 + d.setHname(depart.getHname());
  69 + d.setDdname(depart.getDname());
  70 + dLst.forEach(dd->{
  71 + if(dd.getCode()==d.getLvl()){
  72 + d.setLname(dd.getValue());
  73 + }
  74 + });
  75 + }
  76 + });
  77 + }
51 78  
52 79  
53 80 /**
... ... @@ -123,5 +150,16 @@
123 150 return baseResponse;
124 151 }
125 152  
  153 + /**
  154 + * 统计医生信息
  155 + * @return
  156 + */
  157 + @GetMapping("statDoctor")
  158 + public BaseResponse statDoctor(){
  159 + BaseResponse baseResponse=new BaseResponse();
  160 + Map<String,Object> stat=lymsDoctorService.statDoctor();
  161 + baseResponse.setObject(stat);
  162 + return baseResponse;
  163 + }
126 164 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java View file @ 455bbc8
... ... @@ -120,6 +120,14 @@
120 120 @TableField(exist = false)
121 121 private static final long serialVersionUID = 1L;
122 122  
  123 +
  124 + @TableField(exist = false)
  125 + private String hname;//医院名称
  126 + @TableField(exist = false)
  127 + private String ddname;//科室名称
  128 + @TableField(exist = false)
  129 + private String lname;//职位
  130 +
123 131 @Override
124 132 public boolean equals(Object that) {
125 133 if (this == that) {
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorMapper.java View file @ 455bbc8
... ... @@ -2,11 +2,16 @@
2 2  
3 3 import com.lyms.talkonlineweb.domain.LymsDoctor;
4 4 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +import org.apache.ibatis.annotations.Select;
5 6  
  7 +import java.util.Map;
  8 +
6 9 /**
7 10 * @Entity com.lyms.talkonlineweb.domain.LymsDoctor
8 11 */
9 12 public interface LymsDoctorMapper extends BaseMapper<LymsDoctor> {
10 13  
  14 + @Select("SELECT COUNT(1) dall,SUM(d.`stat`) dsum,(COUNT(1)-SUM(d.`stat`)) rcnt FROM lyms_doctor d ")
  15 + Map<String, Object> statDoctor();
11 16 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java View file @ 455bbc8
... ... @@ -3,10 +3,13 @@
3 3 import com.lyms.talkonlineweb.domain.LymsDoctor;
4 4 import com.baomidou.mybatisplus.extension.service.IService;
5 5  
  6 +import java.util.Map;
  7 +
6 8 /**
7 9 *
8 10 */
9 11 public interface LymsDoctorService extends IService<LymsDoctor> {
10 12  
  13 + Map<String, Object> statDoctor();
11 14 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java View file @ 455bbc8
... ... @@ -4,8 +4,11 @@
4 4 import com.lyms.talkonlineweb.domain.LymsDoctor;
5 5 import com.lyms.talkonlineweb.service.LymsDoctorService;
6 6 import com.lyms.talkonlineweb.mapper.LymsDoctorMapper;
  7 +import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.stereotype.Service;
8 9  
  10 +import java.util.Map;
  11 +
9 12 /**
10 13 *
11 14 */
... ... @@ -13,5 +16,12 @@
13 16 public class LymsDoctorServiceImpl extends ServiceImpl<LymsDoctorMapper, LymsDoctor>
14 17 implements LymsDoctorService{
15 18  
  19 + @Autowired
  20 + private LymsDoctorMapper lymsDoctorMapper;
  21 +
  22 + @Override
  23 + public Map<String, Object> statDoctor() {
  24 + return lymsDoctorMapper.statDoctor();
  25 + }
16 26 }