Your Name 4 years ago
parent
commit
8137db11e1

+ 18
- 21
src/main/java/com/yunzhi/demo/controller/TaMedicalLogController.java View File

8
 import com.yunzhi.demo.common.ResponseBean;
8
 import com.yunzhi.demo.common.ResponseBean;
9
 import com.yunzhi.demo.common.StringUtils;
9
 import com.yunzhi.demo.common.StringUtils;
10
 import com.yunzhi.demo.entity.TaPerson;
10
 import com.yunzhi.demo.entity.TaPerson;
11
+import com.yunzhi.demo.entity.TaStudent;
12
+import com.yunzhi.demo.service.ITaStudentService;
11
 import io.swagger.annotations.Api;
13
 import io.swagger.annotations.Api;
12
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiOperation;
13
 import io.swagger.annotations.ApiParam;
15
 import io.swagger.annotations.ApiParam;
37
     @Autowired
39
     @Autowired
38
     public ITaMedicalLogService iTaMedicalLogService;
40
     public ITaMedicalLogService iTaMedicalLogService;
39
 
41
 
42
+    @Autowired
43
+    public ITaStudentService iTaStudentService;
44
+
40
     @GetMapping("/ma/medical-log")
45
     @GetMapping("/ma/medical-log")
41
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
46
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
42
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
43
                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
48
                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
44
         TaPerson taPerson = getCurrentPerson();
49
         TaPerson taPerson = getCurrentPerson();
50
+        TaStudent taStudent = iTaStudentService.getByPersonId(taPerson.getPersonId());
45
 
51
 
46
         IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
52
         IPage<TaMedicalLog> pg = new Page<>(pageNum, pageSize);
47
         QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
53
         QueryWrapper<TaMedicalLog> queryWrapper = new QueryWrapper<>();
48
-        queryWrapper.eq("person_id", taPerson.getPersonId());
54
+        queryWrapper.eq("student_id", taStudent.getStudentId());
49
         queryWrapper.eq("status", Constants.STATUS_NORMAL);
55
         queryWrapper.eq("status", Constants.STATUS_NORMAL);
50
         queryWrapper.orderByDesc("create_date");
56
         queryWrapper.orderByDesc("create_date");
51
 
57
 
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
      * @param pageNum
65
      * @param pageNum
99
      */
86
      */
100
     @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
87
     @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
101
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
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
         if (iTaMedicalLogService.save(taMedicalLog)){
101
         if (iTaMedicalLogService.save(taMedicalLog)){
105
             return ResponseBean.success(taMedicalLog);
102
             return ResponseBean.success(taMedicalLog);

+ 4
- 3
src/main/java/com/yunzhi/demo/controller/TaStudentController.java View File

86
         }
86
         }
87
 
87
 
88
         if (!StringUtils.isEmpty(taStudent.getStudentNo())) {
88
         if (!StringUtils.isEmpty(taStudent.getStudentNo())) {
89
-            TaStudent stu = iTaStudentService.getByStudentNo(taStudent.getStudentNo());
89
+            TaStudent stu = iTaStudentService.getByStudentNo(taStudent.getSchoolId(), taStudent.getStudentNo());
90
             if (null != stu && !StringUtils.isEmpty(taStudent.getStudentId()) && stu.getStudentId().equals(taStudent.getStudentId())) {
90
             if (null != stu && !StringUtils.isEmpty(taStudent.getStudentId()) && stu.getStudentId().equals(taStudent.getStudentId())) {
91
                 throw new Exception("学号信息重复");
91
                 throw new Exception("学号信息重复");
92
             }
92
             }
128
      */
128
      */
129
     @RequestMapping(value="/admin/student-no/{id}",method= RequestMethod.GET)
129
     @RequestMapping(value="/admin/student-no/{id}",method= RequestMethod.GET)
130
     @ApiOperation(value="学生详情", notes = "查询人员详细信息", httpMethod = "GET", response = TaPerson.class)
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
         if (null == taStudent || Constants.STATUS_DELETED.equals(taStudent.getStatus())) {
134
         if (null == taStudent || Constants.STATUS_DELETED.equals(taStudent.getStatus())) {
134
             throw new Exception("验证人员信息失败, 请退出重试");
135
             throw new Exception("验证人员信息失败, 请退出重试");
135
         }
136
         }

+ 1
- 1
src/main/java/com/yunzhi/demo/service/ITaStudentService.java View File

20
 
20
 
21
     IPage<TaStudent> getStudentInfoPagedBy(IPage<TaStudent> pg, String name, String schoolId, String specialtyId, String phone, String studentNo);
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
     TaStudent getByPersonId(String personId);
25
     TaStudent getByPersonId(String personId);
26
 
26
 

+ 2
- 1
src/main/java/com/yunzhi/demo/service/impl/TaStudentServiceImpl.java View File

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

+ 1
- 1
src/main/resources/mapper/TaMedicalLogMapper.xml View File

15
             e.user_name as doctor_name
15
             e.user_name as doctor_name
16
         FROM
16
         FROM
17
         ta_medical_log a
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
         LEFT JOIN td_school c on b.school_id = c.school_id
19
         LEFT JOIN td_school c on b.school_id = c.school_id
20
         LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
20
         LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
21
         LEFT JOIN sys_user e on a.doctor_id = e.user_id
21
         LEFT JOIN sys_user e on a.doctor_id = e.user_id