|
@ -1,16 +1,13 @@
|
|
|
package com.yihu.rehabilitation.controller;
|
|
|
|
|
|
import com.yihu.jw.exception.ApiException;
|
|
|
import com.yihu.jw.rehabilitation.RehabilitationInformationDO;
|
|
|
import com.yihu.jw.restmodel.common.Envelop;
|
|
|
import com.yihu.jw.restmodel.common.EnvelopRestController;
|
|
|
import com.yihu.jw.restmodel.rehabilitation.RehabilitationInformationVO;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
|
import com.yihu.rehabilitation.service.RehabilitationInformationService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@ -20,7 +17,7 @@ import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
|
|
|
* @author humingfen on 2018/4/25.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = RehabilitationRequestMapping.Common.information)
|
|
|
@RequestMapping(value = RehabilitationRequestMapping.Information.information)
|
|
|
@Api(tags = "就诊信息相关操作", description = "就诊信息相关操作")
|
|
|
public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
|
|
@ -29,7 +26,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
|
|
|
@GetMapping(value = RehabilitationRequestMapping.Information.findInformationPage)
|
|
|
@ApiOperation(value = "分页查找就诊信息", notes = "分页查找就诊信息")
|
|
|
public Envelop<RehabilitationInformationVO> findCompanyPage(@ApiParam(name = "hospital", value = "就诊医院名称", defaultValue = "")
|
|
|
public Envelop<RehabilitationInformationVO> findInformationPage(@ApiParam(name = "hospital", value = "就诊医院名称", defaultValue = "")
|
|
|
@RequestParam(value = "hospital", required = false) String hospital,
|
|
|
@ApiParam(name = "patientId", value = "居民id", defaultValue = "")
|
|
|
@RequestParam(value = "patientId", required = false) String patientId,
|
|
@ -57,9 +54,8 @@ public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
public Envelop<RehabilitationInformationVO> create(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
|
|
|
@RequestParam(value = "jsonData", required = true)String jsonData) {
|
|
|
try {
|
|
|
RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
|
|
|
RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_create, rehabilitationInformationService.create(informationDO));
|
|
|
RehabilitationInformationDO informationDO = toEntity(jsonData, RehabilitationInformationDO.class);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, rehabilitationInformationService.create(informationDO));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Envelop.getError(e.getMessage());
|
|
@ -68,26 +64,24 @@ public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
|
|
|
@GetMapping(value = RehabilitationRequestMapping.Information.findInformationById)
|
|
|
@ApiOperation(value = "根据id查找就诊信息", notes = "根据id查找就诊信息")
|
|
|
public Envelop<RehabilitationInformationVO> findByCode(@ApiParam(name = "id", value = "id")
|
|
|
public Envelop<RehabilitationInformationDO> findById(@ApiParam(name = "id", value = "id")
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
|
try {
|
|
|
RehabilitationInformationDO informationDO = rehabilitationInformationService.findById(id);
|
|
|
RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find, informationVO);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, informationDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Envelop.getError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = RehabilitationRequestMapping.Information.findInformationById)
|
|
|
@GetMapping(value = RehabilitationRequestMapping.Information.findInformationByPatientId)
|
|
|
@ApiOperation(value = "根据patientId查找就诊信息", notes = "根据patientId查找就诊信息")
|
|
|
public Envelop<RehabilitationInformationVO> findByPatientId(@ApiParam(name = "patientId", value = "patientId")
|
|
|
public Envelop<RehabilitationInformationDO> findByPatientId(@ApiParam(name = "patientId", value = "patientId")
|
|
|
@RequestParam(value = "patientId", required = true) String patientId) {
|
|
|
try {
|
|
|
RehabilitationInformationDO informationDO = rehabilitationInformationService.findByPatientId(patientId);
|
|
|
RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find, informationVO);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, informationDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Envelop.getError(e.getMessage());
|
|
@ -95,14 +89,13 @@ public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = RehabilitationRequestMapping.Information.api_update)
|
|
|
@ApiOperation(value = "修改就诊信息", notes = "修改就诊信息")
|
|
|
public Envelop<RehabilitationInformationVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
|
|
|
@ApiOperation(value = "修改就诊信息", notes = "修改就诊信息(记得传入修改id)")
|
|
|
public Envelop<RehabilitationInformationVO> updateInformation(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
|
|
|
@RequestParam(value = "jsonData", required = true)String jsonData) {
|
|
|
try {
|
|
|
RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
|
|
|
RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
|
|
|
RehabilitationInformationDO informationDO = toEntity(jsonData, RehabilitationInformationDO.class);
|
|
|
rehabilitationInformationService.update(informationDO);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_update);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Envelop.getError(e.getMessage());
|
|
@ -110,12 +103,12 @@ public class RehabilitationInformationController extends EnvelopRestController {
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = RehabilitationRequestMapping.Information.api_delete)
|
|
|
@ApiOperation(value = "删除企业", notes = "删除企业")
|
|
|
public Envelop<RehabilitationInformationVO> delCompany(@ApiParam(name = "id", value = "id")
|
|
|
@ApiOperation(value = "删除就诊信息", notes = "删除就诊信息")
|
|
|
public Envelop<RehabilitationInformationVO> delInformation(@ApiParam(name = "id", value = "id")
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
|
try {
|
|
|
rehabilitationInformationService.delete(id);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find);
|
|
|
return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_delete);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Envelop.getError(e.getMessage());
|