39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package com.openhis.web.outpatient.controller;
|
||
|
||
import com.openhis.web.outpatient.service.CheckRequestService;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.web.bind.annotation.*;
|
||
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* 检查申请接口
|
||
*
|
||
* 修复 Bug #550:
|
||
* 1. 前端已改为手动控制勾选,后端需要确保一次只能提交同一检查项目的唯一记录。
|
||
* 2. 防止重复提交导致明细耦合,新增校验逻辑。
|
||
*/
|
||
@RestController
|
||
@RequestMapping("/outpatient/check-requests")
|
||
public class CheckRequestController {
|
||
|
||
@Autowired
|
||
private CheckRequestService checkRequestService;
|
||
|
||
@GetMapping
|
||
public List<Map<String, Object>> list() {
|
||
return checkRequestService.listPendingRequests();
|
||
}
|
||
|
||
@PostMapping("/submit")
|
||
public Map<String, Object> submit(@RequestBody List<Map<String, Object>> selected) {
|
||
try {
|
||
checkRequestService.validateAndSubmit(selected);
|
||
return Map.of("code", 200, "msg", "提交成功");
|
||
} catch (IllegalArgumentException e) {
|
||
return Map.of("code", 400, "msg", e.getMessage());
|
||
}
|
||
}
|
||
}
|