刘光辉
117 分钟以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package jnpf.elnController;
 
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.elnEntity.runtime.ElnRecordForms;
import jnpf.elnEntity.runtime.ElnRecordVos;
import jnpf.elnService.ElnRecordBatchCreationService;
import jnpf.elnService.ElnRecordCreationService;
import jnpf.elnService.ElnRecordRecalculationService;
import jnpf.elnService.ElnRecordSharedFillService;
import jnpf.elnService.ElnRecordSourceSyncService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@Tag(name = "ELN电子记录")
@RestController
@RequestMapping("/records")
@RequiredArgsConstructor
public class ElnRecordController {
 
    private final ElnRecordCreationService recordCreationService;
    private final ElnRecordBatchCreationService recordBatchCreationService;
    private final ElnRecordRecalculationService recalculationService;
    private final ElnRecordSourceSyncService sourceSyncService;
    private final ElnRecordSharedFillService sharedFillService;
 
    @Operation(summary = "创建或获取检验项电子记录")
    @PostMapping
    public ActionResult<ElnRecordVos.Created> create(@RequestBody(required = false) ElnRecordForms.Create form) {
        return ActionResult.success(recordCreationService.create(form));
    }
 
    @Operation(summary = "批量创建或获取检验项电子记录")
    @PostMapping("/batch")
    public ActionResult<ElnRecordVos.BatchCreated> createBatch(
            @RequestBody(required = false) ElnRecordForms.BatchCreate form) {
        return ActionResult.success(recordBatchCreationService.create(form));
    }
 
    @Operation(summary = "预览多批次共享填写")
    @PostMapping("/sharedFill/preview")
    public ActionResult<ElnRecordVos.SharedFillPreview> previewSharedFill(
            @RequestBody(required = false) ElnRecordForms.SharedFillPreview form) {
        return ActionResult.success(sharedFillService.preview(form));
    }
 
    @Operation(summary = "提交多批次共享填写")
    @PostMapping("/sharedFill/execute")
    public ActionResult<ElnRecordVos.SharedFilled> executeSharedFill(
            @RequestBody(required = false) ElnRecordForms.SharedFillExecute form) {
        return ActionResult.success(sharedFillService.execute(form));
    }
 
    @Operation(summary = "权威重算当前电子记录的全部公式")
    @PostMapping("/{recordId}/formulas/recalculate")
    public ActionResult<ElnRecordVos.Recalculated> recalculateAll(
            @PathVariable("recordId") String recordId,
            @RequestBody(required = false) ElnRecordForms.Recalculate form) {
        return ActionResult.success(recalculationService.recalculateAll(recordId, form));
    }
 
    @Operation(summary = "预览当前电子记录的 LIMS 任务快照差异")
    @PostMapping("/{recordId}/sourceSync/preview")
    public ActionResult<ElnRecordVos.SourceSyncPreview> previewSourceSync(
            @PathVariable("recordId") String recordId) {
        return ActionResult.success(sourceSyncService.preview(recordId));
    }
 
    @Operation(summary = "确认重新同步当前电子记录的 LIMS 任务快照")
    @PostMapping("/{recordId}/sourceSync")
    public ActionResult<ElnRecordVos.SourceSynchronized> synchronizeSource(
            @PathVariable("recordId") String recordId,
            @RequestBody(required = false) ElnRecordForms.SourceSync form) {
        return ActionResult.success(sourceSyncService.synchronize(recordId, form));
    }
}