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));
|
}
|
}
|