|  | @ -0,0 +1,80 @@
 | 
												
													
														
															|  | 
 |  | package com.yihu.wlyy.web.doctor.followup;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.service.app.followup.PhthisisFollowupService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.web.BaseController;
 | 
												
													
														
															|  | 
 |  | import io.swagger.annotations.Api;
 | 
												
													
														
															|  | 
 |  | import io.swagger.annotations.ApiOperation;
 | 
												
													
														
															|  | 
 |  | import io.swagger.annotations.ApiParam;
 | 
												
													
														
															|  | 
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | 
 |  | import org.springframework.http.MediaType;
 | 
												
													
														
															|  | 
 |  | import org.springframework.web.bind.annotation.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | /**
 | 
												
													
														
															|  | 
 |  |  * 医生端:肺结核随访服务控制器
 | 
												
													
														
															|  | 
 |  |  *
 | 
												
													
														
															|  | 
 |  |  * @author lith on 2019-05-05
 | 
												
													
														
															|  | 
 |  |  */
 | 
												
													
														
															|  | 
 |  | @RestController
 | 
												
													
														
															|  | 
 |  | @RequestMapping(value = "/doctor/phthisis", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
												
													
														
															|  | 
 |  | @Api(value = "医生端-肺结核随访记录服务")
 | 
												
													
														
															|  | 
 |  | public class DoctorPhthisisFollowupController extends BaseController {
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private PhthisisFollowupService phthisisFollowupService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/saveFirst")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = "保存第一次肺结核随访数据")
 | 
												
													
														
															|  | 
 |  |     public String saveFirstFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
 | 
												
													
														
															|  | 
 |  |         StringBuilder errMsg = new StringBuilder();
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             if(!phthisisFollowupService.saveFirstFollowup(jsonData,errMsg)){
 | 
												
													
														
															|  | 
 |  |                 return error( -1, "保存第一次肺结核随访数据失败," + errMsg);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             return errorResult(e);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return write(200, "保存第一次肺结核随访数据成功!");
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/saveNTimes")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation("保存第n次肺结核随访数据")
 | 
												
													
														
															|  | 
 |  |     public String saveNTimesFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
 | 
												
													
														
															|  | 
 |  |         StringBuilder errMsg = new StringBuilder();
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             if(!phthisisFollowupService.saveNTimesFollowup(jsonData,errMsg)){
 | 
												
													
														
															|  | 
 |  |                 return error( -1, "保存第n次肺结核随访数据失败," + errMsg);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             error(e);
 | 
												
													
														
															|  | 
 |  |             return error(-1, "保存第n次肺结核随访数据失败," + e.getMessage());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return write(200, "保存第n次肺结核随访数据成功!");
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @GetMapping(value = "/getFirst")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation("查询第一次肺结核随访数据详情")
 | 
												
													
														
															|  | 
 |  |     public String queryFirst(@ApiParam(name = "followupId", value = "随访记录ID")
 | 
												
													
														
															|  | 
 |  |                                          @RequestParam(value = "followupId", required = true) String followupId) {
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             JSONObject firstFollowupES = phthisisFollowupService.queryFirstByFollowupId(followupId);
 | 
												
													
														
															|  | 
 |  |             return write(200, "查询成功!", "data", firstFollowupES);
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             return invalidUserException(e, -1, "查询失败!" + e.getMessage());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @GetMapping(value = "/getNTimes")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation("查询第n次肺结核随访数据详情")
 | 
												
													
														
															|  | 
 |  |     public String queryNTimes(@ApiParam(name = "followupId", value = "随访记录ID")
 | 
												
													
														
															|  | 
 |  |                                          @RequestParam(value = "followupId", required = true) String followupId) {
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             List<JSONObject> ntimesFollowups = phthisisFollowupService.queryNTimesByFollowupId(followupId);
 | 
												
													
														
															|  | 
 |  |             return write(200, "查询成功!", "data", ntimesFollowups);
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             return invalidUserException(e, -1, "查询失败!" + e.getMessage());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | }
 |