zlisen 4 年前
父节点
当前提交
95ff1d04fe

+ 32
- 7
src/main/java/com/yunzhi/demo/controller/TaMedicalLogController.java 查看文件

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.demo.common.BaseController;
7 7
 import com.yunzhi.demo.common.Constants;
8 8
 import com.yunzhi.demo.common.ResponseBean;
9
+import com.yunzhi.demo.common.StringUtils;
9 10
 import com.yunzhi.demo.entity.TaPerson;
10 11
 import io.swagger.annotations.Api;
11 12
 import io.swagger.annotations.ApiOperation;
@@ -81,14 +82,38 @@ public class TaMedicalLogController extends BaseController {
81 82
     @RequestMapping(value="/admin/medicalLog",method= RequestMethod.GET)
82 83
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
83 84
     public ResponseBean medicalLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
84
-                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
85
+                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
86
+                                       @ApiParam("学校ID") @RequestParam(value ="schoolId", required = false) String schoolId,
87
+                                       @ApiParam("专业ID") @RequestParam(value ="specialtyId", required = false) String specialtyId,
88
+                                       @ApiParam("学号") @RequestParam(value ="studentId", required = false) String studentId) throws Exception{
85 89
 
86
-        IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
87
-        QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
88
-        queryWrapper.orderByDesc("create_date");
89
-
90
-        IPage<TaMedicalLog> result = iTaMedicalLogService.page(pg, queryWrapper);
91
-        return ResponseBean.success(result);
90
+		    IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
91
+//            QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
92
+//            queryWrapper.orderByDesc("create_date");
93
+
94
+//            IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
95
+//            QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
96
+//                    .gt("status", Constants.STATUS_DELETED)
97
+//                    .eq(!StringUtils.isEmpty(schoolId), "school_id", schoolId)
98
+//                    .eq(!StringUtils.isEmpty(specialtyId), "specialty_id", specialtyId)
99
+//                    .like(!StringUtils.isEmpty(studentId), "student_id", "%"+studentId+"%");
100
+
101
+//        IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
102
+//        QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
103
+//                .gt("student_id", "")
104
+//                .gt("status", Constants.STATUS_DELETED)
105
+//                .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
106
+//                .eq(!StringUtils.isEmpty(schoolId), "school_id", schoolId)
107
+//                .eq(!StringUtils.isEmpty(specialtyId), "specialty_id", specialtyId)
108
+//                .like(!StringUtils.isEmpty(phone), "phone", "%"+phone+"%")
109
+//                .like(!StringUtils.isEmpty(studentId), "student_id", "%"+studentId+"%")
110
+//                .orderByDesc("create_date");
111
+//
112
+        IPage<TaMedicalLog> result = iTaMedicalLogService.getMedicalLogPagedBy(pg, schoolId, specialtyId, studentId);
113
+//        return ResponseBean.success(result);
114
+
115
+//            IPage<TaMedicalLog> result = iTaMedicalLogService.page(pg, queryWrapper);
116
+            return ResponseBean.success(result);
92 117
     }
93 118
 
94 119
     /**

+ 1
- 1
src/main/java/com/yunzhi/demo/controller/TdSpecialtyController.java 查看文件

@@ -82,7 +82,7 @@ public class TdSpecialtyController extends BaseController {
82 82
 
83 83
         IPage<TdSpecialty> pg = new Page<>(pageNum, pageSize);
84 84
         QueryWrapper<TdSpecialty> queryWrapper = new QueryWrapper<TdSpecialty>()
85
-                .eq(!StringUtils.isEmpty(schoolId),"schoolId", schoolId)
85
+                .eq(!StringUtils.isEmpty(schoolId),"school_id", schoolId)
86 86
                 .like(!StringUtils.isEmpty(name), "name", "%"+name+"%")
87 87
                 .eq("status", Constants.STATUS_NORMAL)
88 88
                 .orderByAsc("sort_no")

+ 35
- 0
src/main/java/com/yunzhi/demo/entity/TaMedicalLog.java 查看文件

@@ -1,6 +1,7 @@
1 1
 package com.yunzhi.demo.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import java.time.LocalDateTime;
6 7
 import java.io.Serializable;
@@ -50,4 +51,38 @@ public class TaMedicalLog implements Serializable {
50 51
 
51 52
     @ApiModelProperty(value = "医生ID")
52 53
     private String doctorId;
54
+
55
+    @ApiModelProperty(value = "姓名")
56
+    @TableField(exist = false)
57
+    private String name;
58
+
59
+    @ApiModelProperty(value = "性别")
60
+    @TableField(exist = false)
61
+    private String sex;
62
+
63
+    @ApiModelProperty(value = "学校ID")
64
+    @TableField(exist = false)
65
+    private String schoolId;
66
+
67
+    @ApiModelProperty(value = "学校名称")
68
+    @TableField(exist = false)
69
+    private String schoolName;
70
+
71
+    @ApiModelProperty(value = "专业ID")
72
+    @TableField(exist = false)
73
+    private String specialtyId;
74
+
75
+    @ApiModelProperty(value = "专业名称")
76
+    @TableField(exist = false)
77
+    private String specialtyName;
78
+
79
+    @ApiModelProperty(value = "医生")
80
+    @TableField(exist = false)
81
+    private String doctorName;
82
+
83
+    @ApiModelProperty(value = "学号")
84
+    @TableField(exist = false)
85
+    private String studentId;
86
+
87
+
53 88
 }

+ 7
- 0
src/main/java/com/yunzhi/demo/mapper/TaMedicalLogMapper.java 查看文件

@@ -1,8 +1,11 @@
1 1
 package com.yunzhi.demo.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaMedicalLog;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.demo.entity.TaPerson;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface TaMedicalLogMapper extends BaseMapper<TaMedicalLog> {
17 20
 
21
+    IPage<TaMedicalLog> getMedicalLogPagedBy(IPage<TaMedicalLog> pg,
22
+                                          @Param("schoolId") String schoolId,
23
+                                          @Param("specialtyId") String specialtyId,
24
+                                          @Param("studentId") String studentId);
18 25
 }

+ 3
- 0
src/main/java/com/yunzhi/demo/service/ITaMedicalLogService.java 查看文件

@@ -1,7 +1,9 @@
1 1
 package com.yunzhi.demo.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaMedicalLog;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.yunzhi.demo.entity.TaPerson;
5 7
 
6 8
 /**
7 9
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 15
  */
14 16
 public interface ITaMedicalLogService extends IService<TaMedicalLog> {
15 17
 
18
+    IPage<TaMedicalLog> getMedicalLogPagedBy(IPage<TaMedicalLog> pg, String schoolId, String specialtyId, String studentId);
16 19
 }

+ 12
- 1
src/main/java/com/yunzhi/demo/service/impl/TaMedicalLogServiceImpl.java 查看文件

@@ -1,9 +1,13 @@
1 1
 package com.yunzhi.demo.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.demo.entity.TaMedicalLog;
5
+import com.yunzhi.demo.entity.TaPerson;
4 6
 import com.yunzhi.demo.mapper.TaMedicalLogMapper;
7
+import com.yunzhi.demo.mapper.TaPersonMapper;
5 8
 import com.yunzhi.demo.service.ITaMedicalLogService;
6 9
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
+import org.springframework.beans.factory.annotation.Autowired;
7 11
 import org.springframework.stereotype.Service;
8 12
 
9 13
 /**
@@ -17,4 +21,11 @@ import org.springframework.stereotype.Service;
17 21
 @Service
18 22
 public class TaMedicalLogServiceImpl extends ServiceImpl<TaMedicalLogMapper, TaMedicalLog> implements ITaMedicalLogService {
19 23
 
20
-}
24
+    @Autowired
25
+    TaMedicalLogMapper taMedicalLogMapper;
26
+
27
+    @Override
28
+    public IPage<TaMedicalLog> getMedicalLogPagedBy(IPage<TaMedicalLog> pg, String schoolId, String specialtyId, String studentId) {
29
+        return taMedicalLogMapper.getMedicalLogPagedBy(pg, schoolId, specialtyId, studentId);
30
+    }
31
+}

+ 48
- 0
src/main/resources/mapper/TaMedicalLogMapper.xml 查看文件

@@ -2,4 +2,52 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.demo.mapper.TaMedicalLogMapper">
4 4
 
5
+<!--    SELECT-->
6
+<!--    a.*,-->
7
+<!--    b.`name`,-->
8
+<!--    b.sex,-->
9
+<!--    b.school_id,-->
10
+<!--    b.student_id,-->
11
+<!--    c.`name` as school_name,-->
12
+<!--    d.`name` as specialty_name,-->
13
+<!--    e.user_name as doctor_name-->
14
+<!--    FROM-->
15
+<!--    ta_medical_log a-->
16
+<!--    LEFT JOIN ta_person b on a.person_id = b.person_id-->
17
+<!--    LEFT JOIN td_school c on b.school_id = c.school_id-->
18
+<!--    LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id-->
19
+<!--    LEFT JOIN sys_user e on a.doctor_id = e.user_id-->
20
+<!--    WHERE-->
21
+
22
+    <select id="getMedicalLogPagedBy" resultType="com.yunzhi.demo.entity.TaMedicalLog">
23
+        SELECT
24
+        a.*,
25
+        b.`name`,
26
+        b.sex,
27
+        b.school_id,
28
+        b.specialty_id,
29
+        b.student_id,
30
+        c.`name` as school_name,
31
+        d.`name` as specialty_name,
32
+        e.user_name as doctor_name
33
+        FROM
34
+        ta_medical_log a
35
+        LEFT JOIN ta_person b on a.person_id = b.person_id
36
+        LEFT JOIN td_school c on b.school_id = c.school_id
37
+        LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
38
+        LEFT JOIN sys_user e on a.doctor_id = e.user_id
39
+        WHERE
40
+        a.`status` > - 1
41
+        <if test="studentId != null and studentId != ''">
42
+            AND b.student_id LIKE CONCAT( '%', #{studentId}, '%' )
43
+        </if>
44
+        <if test="schoolId != null and schoolId != ''">
45
+            AND b.school_id = #{schoolId}
46
+        </if>
47
+        <if test="specialtyId != null and specialtyId != ''">
48
+            AND b.specialty_id = #{specialtyId}
49
+        </if>
50
+        ORDER BY
51
+        a.create_date DESC
52
+    </select>
5 53
 </mapper>