Bladeren bron

fix: 接诊人数

matianxiang 3 maanden geleden
bovenliggende
commit
3cd5fb2402

+ 9 - 1
eitc-patient-base/src/main/java/com/eitc/patient/service/IDoctorService.java

@@ -4,7 +4,6 @@ import com.eitc.patient.vo.DoctorVO;
4 4
 import org.springframework.stereotype.Service;
5 5
 
6 6
 import java.text.ParseException;
7
-import java.util.Date;
8 7
 import java.util.List;
9 8
 
10 9
 /**
@@ -23,4 +22,13 @@ public interface IDoctorService {
23 22
      * @date: 2024/6/13 15:01
24 23
      */
25 24
     List<DoctorVO> list(String selectDateStr) throws ParseException;
25
+
26
+    /**
27
+     * 根据医生id查询医生信息
28
+     * @param doctorId 医生id
29
+     * @return 返回结果
30
+     * @author mtx
31
+     * @date: 2024/6/13 15:01
32
+     */
33
+    DoctorVO getById(Long doctorId);
26 34
 }

+ 30 - 10
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DoctorServiceImpl.java

@@ -45,7 +45,6 @@ public class DoctorServiceImpl implements IDoctorService {
45 45
      */
46 46
     @Override
47 47
     public List<DoctorVO> list(String selectDateStr) throws ParseException {
48
-        Date date = new Date();
49 48
         // 获取医生列表
50 49
         List<SysUser> sysUsers = sysUserMapper.selectUserList(new SysUser());
51 50
         List<DoctorVO> list = new ArrayList<>();
@@ -64,17 +63,38 @@ public class DoctorServiceImpl implements IDoctorService {
64 63
             if (!PatientUtil.checkDoctorWorkStatus(String.valueOf(sysUser.getUserId()), selectDate)) {
65 64
                 continue;
66 65
             }
67
-            DoctorVO vo = new DoctorVO();
68
-            BeanUtils.copyProperties(sysUser, vo);
69
-            long count = patientAppointmentService.count(Wrappers.<PatientAppointment>lambdaQuery()
70
-                    .lt(PatientAppointment::getAppointmentStartTime, date)
71
-                    .gt(PatientAppointment::getAppointmentEndTime, date)
72
-                    .eq(PatientAppointment::getAttendingDoctorId, sysUser.getUserId()));
73
-
74
-            vo.setIsFree(count > 0 ? 1 : 0);
75
-            vo.setDeptName(UserCacheUtil.getSysDeptById(sysUser.getDeptId()).getDeptName());
66
+            DoctorVO vo = getDoctorVO(sysUser);
76 67
             list.add(vo);
77 68
         }
78 69
         return list;
79 70
     }
71
+
72
+    private DoctorVO getDoctorVO(SysUser sysUser) {
73
+        Date date = new Date();
74
+        DoctorVO vo = new DoctorVO();
75
+        BeanUtils.copyProperties(sysUser, vo);
76
+        long count = patientAppointmentService.count(Wrappers.<PatientAppointment>lambdaQuery()
77
+                .lt(PatientAppointment::getAppointmentStartTime, date)
78
+                .gt(PatientAppointment::getAppointmentEndTime, date)
79
+                .eq(PatientAppointment::getAttendingDoctorId, sysUser.getUserId()));
80
+
81
+        vo.setIsFree(count > 0 ? 1 : 0);
82
+        vo.setDeptName(UserCacheUtil.getSysDeptById(sysUser.getDeptId()).getDeptName());
83
+        vo.setReceivePatientNum(patientAppointmentService.count(Wrappers.<PatientAppointment>lambdaQuery()
84
+                .eq(PatientAppointment::getAttendingDoctorId, sysUser.getUserId())));
85
+        return vo;
86
+    }
87
+
88
+    /**
89
+     * 根据医生id查询医生信息
90
+     * @param doctorId 医生id
91
+     * @return 返回结果
92
+     * @author mtx
93
+     * @date: 2024/6/13 15:01
94
+     */
95
+    @Override
96
+    public DoctorVO getById(Long doctorId) {
97
+        SysUser sysUser = sysUserMapper.selectUserById(doctorId);
98
+        return getDoctorVO(sysUser);
99
+    }
80 100
 }

+ 1 - 1
eitc-patient-base/src/main/java/com/eitc/patient/vo/DoctorVO.java

@@ -22,5 +22,5 @@ public class DoctorVO extends SysUser {
22 22
     @ApiModelProperty(value = "是否空闲(0未收藏,1收藏)")
23 23
     private Integer isCollection;
24 24
     @ApiModelProperty(value = "接诊人数")
25
-    private Integer receivePatientNum;
25
+    private Long receivePatientNum;
26 26
 }