PatientArchivesController.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.yihu.jw.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.yihu.jw.entity.archives.PatientArchives;
  4. import com.yihu.jw.entity.archives.PatientArchivesInfo;
  5. import com.yihu.jw.iot.device.IotDeviceQualityInspectionPlanDO;
  6. import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
  7. import com.yihu.jw.restmodel.archives.PatientArchivesVO;
  8. import com.yihu.jw.restmodel.archives.Test;
  9. import com.yihu.jw.restmodel.common.Envelop;
  10. import com.yihu.jw.restmodel.common.EnvelopRestController;
  11. import com.yihu.jw.rm.archives.PatientArchivesMapping;
  12. import com.yihu.jw.rm.iot.IotRequestMapping;
  13. import com.yihu.jw.service.PatientArchivesSevice;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import io.swagger.annotations.ApiParam;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.GetMapping;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RequestParam;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.ArrayList;
  23. import java.util.List;
  24. /**
  25. * Created by Trick on 2018/2/7.
  26. */
  27. @RestController
  28. @RequestMapping(PatientArchivesMapping.api_archives_common)
  29. @Api(tags = "居民建档相关操作", description = "居民建档相关操作")
  30. public class PatientArchivesController extends EnvelopRestController {
  31. @Autowired
  32. private PatientArchivesSevice patientArchivesSevice;
  33. @GetMapping(value = "test")
  34. @ApiOperation(value = "测试")
  35. public Test test(){
  36. Test t = new Test();
  37. t.setFileName("11");
  38. t.setFileType("1");
  39. return t;
  40. }
  41. @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchives)
  42. @ApiOperation(value = "查询健康信息列表")
  43. public Envelop<PatientArchivesVO> findPatientArchives(@ApiParam(name = "name", value = "姓名(模糊匹配)")
  44. @RequestParam(value = "name", required = false)String name,
  45. @ApiParam(name = "status", value = "档案状态")
  46. @RequestParam(value = "status", required = false)String status,
  47. @ApiParam(name = "cancelReseanType", value = "注销状态")
  48. @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
  49. @ApiParam(name = "page", value = "分页") @RequestParam(value = "page", required = false)Integer page,
  50. @ApiParam(name = "size", value = "每一页大小")@RequestParam(value = "size", required = false )Integer size){
  51. try {
  52. return patientArchivesSevice.queryPatientArchivesPage(page,size,status, cancelReseanType ,name);
  53. }catch (Exception e){
  54. e.printStackTrace();
  55. return Envelop.getError(e.getMessage());
  56. }
  57. }
  58. @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchivesInfos)
  59. @ApiOperation(value = "查询健康信息详情列表")
  60. public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@ApiParam(name = "code", value = "档案编号")
  61. @RequestParam(value = "code", required = false)String code){
  62. try {
  63. return patientArchivesSevice.queryPatientArchivesInfoPage(code);
  64. }catch (Exception e){
  65. e.printStackTrace();
  66. return Envelop.getError(e.getMessage());
  67. }
  68. }
  69. @GetMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
  70. @ApiOperation(value = "创建健康信息详情列表")
  71. public Envelop<Boolean> createPatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
  72. @RequestParam(value = "patientArchives", required = true)String patientArchives,
  73. @ApiParam(name = "list", value = "建档详情")
  74. @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
  75. try {
  76. PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
  77. List<PatientArchivesInfo> infos = new ArrayList<>();
  78. convertToModels(list,infos,PatientArchivesInfo.class);
  79. return patientArchivesSevice.createPatientArchives(ps,infos);
  80. }catch (Exception e){
  81. e.printStackTrace();
  82. return Envelop.getError(e.getMessage());
  83. }
  84. }
  85. @GetMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
  86. @ApiOperation(value = "更新健康信息详情列表")
  87. public Envelop<Boolean> updatePatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
  88. @RequestParam(value = "patientArchives", required = true)String patientArchives,
  89. @ApiParam(name = "list", value = "建档详情")
  90. @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
  91. try {
  92. PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
  93. List<PatientArchivesInfo> infos = new ArrayList<>();
  94. convertToModels(list,infos,PatientArchivesInfo.class);
  95. return patientArchivesSevice.updatePatientArchives(ps,infos);
  96. }catch (Exception e){
  97. e.printStackTrace();
  98. return Envelop.getError(e.getMessage());
  99. }
  100. }
  101. }