| 
					
				 | 
			
			
				@@ -0,0 +1,190 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.fs.app.controller.medical; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.app.annotation.Login; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.app.controller.AppBaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.annotation.RepeatSubmit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.medical.domain.ReportIndicatorResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.medical.param.ReportIndicatorResultQueryDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.medical.service.ReportIndicatorResultService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.github.pagehelper.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 报告指标检查Controller 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @author fs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @date 2024 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Api("报告指标检查") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RequestMapping("/app/medical/result") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class ReportIndicatorResultController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final Logger logger = LoggerFactory.getLogger(this.getClass()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ReportIndicatorResultService reportIndicatorResultService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 根据报告ID查询所有指标结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("根据报告ID查询所有指标结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/listByReport/{reportId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R listByReportId(@PathVariable("reportId") Long reportId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ReportIndicatorResult> list = reportIndicatorResultService.listByReportId(reportId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.ok().put("data",list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("根据报告ID查询指标结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 分页查询报告指标检查结果列表(带筛选) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("分页查询报告指标检查结果列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/page") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R page(ReportIndicatorResultQueryDto queryDto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ReportIndicatorResult> list = reportIndicatorResultService.selectPageList(queryDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PageInfo<ReportIndicatorResult> pageInfo = new PageInfo<>(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.ok().put("data", pageInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("分页查询报告指标检查结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 根据指标ID查询所有结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("根据指标ID查询所有结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/listByIndicator/{indicatorId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R listByIndicatorId(@PathVariable("indicatorId") Long indicatorId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ReportIndicatorResult> list = reportIndicatorResultService.listByIndicatorId(indicatorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.ok().put("data",list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("根据指标ID查询结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 根据ID查询检查结果详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("查询检查结果详情") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/{resultId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getById(@PathVariable("resultId") Long resultId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ReportIndicatorResult result = reportIndicatorResultService.getById(resultId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.ok().put("data",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("查询检查结果详情失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 新增检查结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RepeatSubmit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("新增检查结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/add") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R add(@RequestBody ReportIndicatorResult result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            boolean success = reportIndicatorResultService.save(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (success) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.ok("新增成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error("新增失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("新增检查结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("新增失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 批量新增检查结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RepeatSubmit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("批量新增检查结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/batchAdd") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R batchAdd(@RequestBody List<ReportIndicatorResult> results) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int successCount = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (ReportIndicatorResult result : results) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (reportIndicatorResultService.save(result)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    successCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (successCount == results.size()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.ok("批量新增成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.ok("部分新增成功,成功" + successCount + "条"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("批量新增检查结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("批量新增失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 更新检查结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RepeatSubmit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("更新检查结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PutMapping("/update") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R update(@RequestBody ReportIndicatorResult result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            boolean success = reportIndicatorResultService.update(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (success) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.ok("更新成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error("更新失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("更新检查结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("更新失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 删除检查结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("删除检查结果") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @DeleteMapping("/{resultId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R delete(@PathVariable("resultId") Long resultId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            boolean success = reportIndicatorResultService.deleteById(resultId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (success) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.ok("删除成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error("删除失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.error("删除检查结果失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("删除失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |