Your Name 4 år sedan
förälder
incheckning
8137db11e1

+ 18
- 21
src/main/java/com/yunzhi/demo/controller/TaMedicalLogController.java Visa fil

@@ -8,6 +8,8 @@ import com.yunzhi.demo.common.Constants;
8 8
 import com.yunzhi.demo.common.ResponseBean;
9 9
 import com.yunzhi.demo.common.StringUtils;
10 10
 import com.yunzhi.demo.entity.TaPerson;
11
+import com.yunzhi.demo.entity.TaStudent;
12
+import com.yunzhi.demo.service.ITaStudentService;
11 13
 import io.swagger.annotations.Api;
12 14
 import io.swagger.annotations.ApiOperation;
13 15
 import io.swagger.annotations.ApiParam;
@@ -37,15 +39,19 @@ public class TaMedicalLogController extends BaseController {
37 39
     @Autowired
38 40
     public ITaMedicalLogService iTaMedicalLogService;
39 41
 
42
+    @Autowired
43
+    public ITaStudentService iTaStudentService;
44
+
40 45
     @GetMapping("/ma/medical-log")
41 46
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
42 47
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
43 48
                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
44 49
         TaPerson taPerson = getCurrentPerson();
50
+        TaStudent taStudent = iTaStudentService.getByPersonId(taPerson.getPersonId());
45 51
 
46 52
         IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
47 53
         QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
48
-        queryWrapper.eq("person_id", taPerson.getPersonId());
54
+        queryWrapper.eq("student_id", taStudent.getStudentId());
49 55
         queryWrapper.eq("status", Constants.STATUS_NORMAL);
50 56
         queryWrapper.orderByDesc("create_date");
51 57
 
@@ -54,25 +60,6 @@ public class TaMedicalLogController extends BaseController {
54 60
     }
55 61
 
56 62
 
57
-    /**
58
-     * 分页查询列表
59
-     * @param pageNum
60
-     * @param pageSize
61
-     * @return
62
-     */
63
-    @RequestMapping(value="/taMedicalLog",method= RequestMethod.GET)
64
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
65
-    public ResponseBean taMedicalLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
66
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
67
-
68
-		    IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
69
-            QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
70
-            queryWrapper.orderByDesc("create_date");
71
-
72
-            IPage<TaMedicalLog> result = iTaMedicalLogService.page(pg, queryWrapper);
73
-            return ResponseBean.success(result);
74
-    }
75
-
76 63
     /**
77 64
      * 分页查询列表
78 65
      * @param pageNum
@@ -99,7 +86,17 @@ public class TaMedicalLogController extends BaseController {
99 86
      */
100 87
     @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
101 88
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
102
-    public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception{
89
+    public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception {
90
+
91
+        String schoolId = taMedicalLog.getSchoolId();
92
+        String studentNo = taMedicalLog.getStudentNo();
93
+
94
+        if (StringUtils.isEmpty(schoolId) || StringUtils.isEmpty(studentNo)) {
95
+            throw new Exception("学生信息不完整");
96
+        }
97
+
98
+        TaStudent taStudent = iTaStudentService.getByStudentNo(schoolId, studentNo);
99
+
103 100
 
104 101
         if (iTaMedicalLogService.save(taMedicalLog)){
105 102
             return ResponseBean.success(taMedicalLog);

+ 4
- 3
src/main/java/com/yunzhi/demo/controller/TaStudentController.java Visa fil

@@ -86,7 +86,7 @@ public class TaStudentController extends BaseController {
86 86
         }
87 87
 
88 88
         if (!StringUtils.isEmpty(taStudent.getStudentNo())) {
89
-            TaStudent stu = iTaStudentService.getByStudentNo(taStudent.getStudentNo());
89
+            TaStudent stu = iTaStudentService.getByStudentNo(taStudent.getSchoolId(), taStudent.getStudentNo());
90 90
             if (null != stu && !StringUtils.isEmpty(taStudent.getStudentId()) && stu.getStudentId().equals(taStudent.getStudentId())) {
91 91
                 throw new Exception("学号信息重复");
92 92
             }
@@ -128,8 +128,9 @@ public class TaStudentController extends BaseController {
128 128
      */
129 129
     @RequestMapping(value="/admin/student-no/{id}",method= RequestMethod.GET)
130 130
     @ApiOperation(value="学生详情", notes = "查询人员详细信息", httpMethod = "GET", response = TaPerson.class)
131
-    public ResponseBean studentGet(@ApiParam("学生学号") @PathVariable String id) throws Exception{
132
-        TaStudent taStudent = iTaStudentService.getByStudentNo(id);
131
+    public ResponseBean studentGet(@ApiParam("学生学号") @PathVariable String id,
132
+                                   @ApiParam("学校ID") @RequestParam String schoolId) throws Exception{
133
+        TaStudent taStudent = iTaStudentService.getByStudentNo(schoolId, id);
133 134
         if (null == taStudent || Constants.STATUS_DELETED.equals(taStudent.getStatus())) {
134 135
             throw new Exception("验证人员信息失败, 请退出重试");
135 136
         }

+ 1
- 1
src/main/java/com/yunzhi/demo/service/ITaStudentService.java Visa fil

@@ -20,7 +20,7 @@ public interface ITaStudentService extends IService<TaStudent> {
20 20
 
21 21
     IPage<TaStudent> getStudentInfoPagedBy(IPage<TaStudent> pg, String name, String schoolId, String specialtyId, String phone, String studentNo);
22 22
 
23
-    TaStudent getByStudentNo(String studentNo);
23
+    TaStudent getByStudentNo(String schoolId, String studentNo);
24 24
 
25 25
     TaStudent getByPersonId(String personId);
26 26
 

+ 2
- 1
src/main/java/com/yunzhi/demo/service/impl/TaStudentServiceImpl.java Visa fil

@@ -47,8 +47,9 @@ public class TaStudentServiceImpl extends ServiceImpl<TaStudentMapper, TaStudent
47 47
     }
48 48
 
49 49
     @Override
50
-    public TaStudent getByStudentNo(String studentNo) {
50
+    public TaStudent getByStudentNo(String schoolId, String studentNo) {
51 51
         QueryWrapper<TaStudent> queryWrapper = new QueryWrapper<TaStudent>()
52
+                .eq("school_id", schoolId)
52 53
                 .eq("student_no", studentNo)
53 54
                 .gt("status", Constants.STATUS_DELETED);
54 55
         return getOne(queryWrapper);

+ 1
- 1
src/main/resources/mapper/TaMedicalLogMapper.xml Visa fil

@@ -15,7 +15,7 @@
15 15
             e.user_name as doctor_name
16 16
         FROM
17 17
         ta_medical_log a
18
-        LEFT JOIN ta_student b on a.person_id = b.person_id
18
+        LEFT JOIN ta_student b on a.student_id = b.student_id
19 19
         LEFT JOIN td_school c on b.school_id = c.school_id
20 20
         LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
21 21
         LEFT JOIN sys_user e on a.doctor_id = e.user_id