|
@@ -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);
|