diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/IEmpiAppService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/IEmpiAppService.java index 6ffc99cb1..59a9118f5 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/IEmpiAppService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/IEmpiAppService.java @@ -15,4 +15,5 @@ public interface IEmpiAppService { List findLinkedPatients(String globalId); List findLinkedPatientsByIdCard(String idCardNo); List listPersons(String name, String idCardNo); + void splitPatients(Long primaryId, List secondaryIds); } \ No newline at end of file diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/impl/EmpiAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/impl/EmpiAppServiceImpl.java index 7f165320e..eb0e255a3 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/impl/EmpiAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/appservice/impl/EmpiAppServiceImpl.java @@ -126,4 +126,25 @@ public class EmpiAppServiceImpl implements IEmpiAppService { wrapper.orderByDesc(EmpiPerson::getId); return personService.list(wrapper); } + + @Override + public void splitPatients(Long primaryId, List secondaryIds) { + EmpiPerson primary = personService.getById(primaryId); + if (primary == null) throw new RuntimeException("主患者不存在"); + for (Long secId : secondaryIds) { + EmpiPerson sec = personService.getById(secId); + if (sec == null || !"MERGED".equals(sec.getMergeStatus())) continue; + sec.setMergeStatus("ACTIVE"); + personService.updateById(sec); + EmpiMergeLog logRecord = new EmpiMergeLog(); + logRecord.setSourcePatientId(primaryId); + logRecord.setTargetPatientId(secId); + logRecord.setMergeType("SPLIT"); + logRecord.setMergeReason("EMPI拆分"); + logRecord.setMergeBy("system"); + logRecord.setMergeTime(new Date()); + logRecord.setStatus("SPLIT"); + mergeLogService.save(logRecord); + } + } } \ No newline at end of file diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/controller/EmpiController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/controller/EmpiController.java index 0011b0a08..8d00c7501 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/controller/EmpiController.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/empi/controller/EmpiController.java @@ -6,6 +6,7 @@ import com.healthlink.his.web.empi.appservice.IEmpiAppService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -25,11 +26,20 @@ public class EmpiController { @Operation(summary = "合并患者") @PostMapping("/merge") + @PreAuthorize("infection:empi:edit") public AjaxResult merge(@RequestParam Long primaryId, @RequestParam List secondaryIds) { empiAppService.mergePersons(primaryId, secondaryIds); return AjaxResult.success(); } + @Operation(summary = "拆分患者") + @PostMapping("/split") + @PreAuthorize("infection:empi:edit") + public AjaxResult split(@RequestParam Long primaryId, @RequestParam List secondaryIds) { + empiAppService.splitPatients(primaryId, secondaryIds); + return AjaxResult.success(); + } + @Operation(summary = "按全局ID查询EMPI") @GetMapping("/person/global/{globalId}") public AjaxResult findByGlobalId(@PathVariable String globalId) { diff --git a/healthlink-his-ui/src/views/empienhanced/api.js b/healthlink-his-ui/src/views/empienhanced/api.js index 633b17181..e17951259 100644 --- a/healthlink-his-ui/src/views/empienhanced/api.js +++ b/healthlink-his-ui/src/views/empienhanced/api.js @@ -3,6 +3,7 @@ import request from '@/utils/request' // EMPI基础操作 export function registerPerson(data) { return request({ url: '/api/v1/empi/person', method: 'post', data }) } export function mergePersons(primaryId, secondaryIds) { return request({ url: '/api/v1/empi/merge', method: 'post', params: { primaryId, secondaryIds: secondaryIds.join(',') } }) } +export function splitPersons(primaryId, secondaryIds) { return request({ url: '/api/v1/empi/split', method: 'post', params: { primaryId, secondaryIds: secondaryIds.join(',') } }) } export function findByGlobalId(globalId) { return request({ url: '/api/v1/empi/person/global/' + globalId, method: 'get' }) } export function findByIdCard(idCardNo) { return request({ url: '/api/v1/empi/person/idcard/' + idCardNo, method: 'get' }) } export function getMappings(globalId) { return request({ url: '/api/v1/empi/mappings/' + globalId, method: 'get' }) } diff --git a/healthlink-his-ui/src/views/empienhanced/index.vue b/healthlink-his-ui/src/views/empienhanced/index.vue index 0f178b7a8..e3df294b5 100644 --- a/healthlink-his-ui/src/views/empienhanced/index.vue +++ b/healthlink-his-ui/src/views/empienhanced/index.vue @@ -136,12 +136,127 @@ :type="row.status==='MERGED'?'success':'info'" size="small" > - {{ row.status==='MERGED'?'已合并':'已撤回' }} + {{ row.status==='MERGED'?'已合并':row.status==='SPLIT'?'已拆分':'已撤回' }} + + + 选择一个已合并的患者作为"来源患者",再勾选要拆分的患者,点击"拆分选中患者" + + + + + + + + 查询 + + + + + + + + + + + + + + + + + + + +
+ + 拆分选中患者 ({{ splitSelectedRows.length }}) + +
+
@@ -149,7 +264,7 @@