|
@@ -9,6 +9,7 @@ import com.yunzhi.demo.common.ResponseBean;
|
9
|
9
|
import com.yunzhi.demo.common.StringUtils;
|
10
|
10
|
import com.yunzhi.demo.entity.TaPerson;
|
11
|
11
|
import com.yunzhi.demo.entity.TaStudent;
|
|
12
|
+import com.yunzhi.demo.service.ITaPersonService;
|
12
|
13
|
import com.yunzhi.demo.service.ITaStudentService;
|
13
|
14
|
import io.swagger.annotations.Api;
|
14
|
15
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -42,6 +43,9 @@ public class TaMedicalLogController extends BaseController {
|
42
|
43
|
@Autowired
|
43
|
44
|
public ITaStudentService iTaStudentService;
|
44
|
45
|
|
|
46
|
+ @Autowired
|
|
47
|
+ public ITaPersonService iTaPersonService;
|
|
48
|
+
|
45
|
49
|
@GetMapping("/ma/medical-log")
|
46
|
50
|
@ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
|
47
|
51
|
public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
@@ -84,7 +88,7 @@ public class TaMedicalLogController extends BaseController {
|
84
|
88
|
* @param taMedicalLog 实体对象
|
85
|
89
|
* @return
|
86
|
90
|
*/
|
87
|
|
- @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
|
|
91
|
+ @RequestMapping(value="/admin/medicalLog",method= RequestMethod.POST)
|
88
|
92
|
@ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
89
|
93
|
public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception {
|
90
|
94
|
|
|
@@ -96,23 +100,24 @@ public class TaMedicalLogController extends BaseController {
|
96
|
100
|
}
|
97
|
101
|
|
98
|
102
|
TaStudent taStudent = iTaStudentService.getByStudentNo(schoolId, studentNo);
|
99
|
|
-
|
100
|
|
-
|
101
|
|
- if (iTaMedicalLogService.save(taMedicalLog)){
|
102
|
|
- return ResponseBean.success(taMedicalLog);
|
103
|
|
- }else {
|
104
|
|
- return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
103
|
+ if (null == taStudent) {
|
|
104
|
+ taStudent = new TaStudent();
|
|
105
|
+ taStudent.setStudentNo(studentNo);
|
|
106
|
+ taStudent.setSchoolId(schoolId);
|
|
107
|
+ taStudent.setSpecialtyId(taMedicalLog.getSpecialtyId());
|
|
108
|
+ taStudent.setName(taMedicalLog.getName());
|
|
109
|
+ taStudent.setSex(taMedicalLog.getSex());
|
|
110
|
+ taStudent.setPhone(taMedicalLog.getPhone());
|
|
111
|
+ // 映射人员
|
|
112
|
+ TaPerson taPerson = iTaPersonService.getByPhone(taStudent.getPhone());
|
|
113
|
+ if (null != taPerson) {
|
|
114
|
+ taStudent.setPersonId(taPerson.getPersonId());
|
|
115
|
+ }
|
|
116
|
+
|
|
117
|
+ iTaStudentService.save(taStudent);
|
105
|
118
|
}
|
106
|
|
- }
|
107
|
119
|
|
108
|
|
- /**
|
109
|
|
- * 保存对象
|
110
|
|
- * @param taMedicalLog 实体对象
|
111
|
|
- * @return
|
112
|
|
- */
|
113
|
|
- @RequestMapping(value="/admin/medicalLog",method= RequestMethod.POST)
|
114
|
|
- @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
115
|
|
- public ResponseBean medicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception{
|
|
120
|
+ taMedicalLog.setStudentId(taStudent.getStudentId());
|
116
|
121
|
|
117
|
122
|
if (iTaMedicalLogService.save(taMedicalLog)){
|
118
|
123
|
return ResponseBean.success(taMedicalLog);
|
|
@@ -121,38 +126,6 @@ public class TaMedicalLogController extends BaseController {
|
121
|
126
|
}
|
122
|
127
|
}
|
123
|
128
|
|
124
|
|
- /**
|
125
|
|
- * 根据id删除对象
|
126
|
|
- * @param id 实体ID
|
127
|
|
- */
|
128
|
|
- @RequestMapping(value="/taMedicalLog/{id}", method= RequestMethod.DELETE)
|
129
|
|
- @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
130
|
|
- public ResponseBean taMedicalLogDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
131
|
|
- if(iTaMedicalLogService.removeById(id)){
|
132
|
|
- return ResponseBean.success("success");
|
133
|
|
- }else {
|
134
|
|
- return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
135
|
|
- }
|
136
|
|
- }
|
137
|
|
-
|
138
|
|
- /**
|
139
|
|
- * 修改对象
|
140
|
|
- * @param id 实体ID
|
141
|
|
- * @param taMedicalLog 实体对象
|
142
|
|
- * @return
|
143
|
|
- */
|
144
|
|
- @RequestMapping(value="/taMedicalLog/{id}",method= RequestMethod.PUT)
|
145
|
|
- @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
146
|
|
- public ResponseBean taMedicalLogUpdate(@ApiParam("对象ID") @PathVariable Integer id,
|
147
|
|
- @ApiParam("更新内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception{
|
148
|
|
-
|
149
|
|
- if (iTaMedicalLogService.updateById(taMedicalLog)){
|
150
|
|
- return ResponseBean.success(iTaMedicalLogService.getById(id));
|
151
|
|
- }else {
|
152
|
|
- return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
153
|
|
- }
|
154
|
|
- }
|
155
|
|
-
|
156
|
129
|
/**
|
157
|
130
|
* 根据id查询对象
|
158
|
131
|
* @param id 实体ID
|