From 916ef47a95bb8515f90b407dc80a96a804cc3a5e Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 01 四月 2025 14:11:49 +0800
Subject: [PATCH] just comment
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java | 43 +++++++++++++++++++++++++++++++------------
1 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
index ce7d60c..254ea8e 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -5,6 +5,7 @@
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
import cn.lihu.jh.module.ecg.dal.dataobject.patient.PatDetails;
+import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.module.ecg.feign.RemoteDataService;
import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo;
import cn.lihu.jh.module.ecg.feign.RestApiResult;
@@ -35,6 +36,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
@@ -71,7 +73,6 @@
AppointmentDO appointment = BeanUtils.toBean(createReqVO, AppointmentDO.class);
appointment.setBookTime( LocalDateTime.now() );
- appointment.setBookSrc( 1 );
try {
appointmentMapper.insert(appointment);
@@ -111,11 +112,10 @@
return appointmentMapper.selectById(id);
}
- // TODO 灏氫笉鏀寔, 涓�浣嶆偅鑰呭綋澶╀袱绉嶆鏌ラ」鐩殑鎯呭喌
@Override
- public AppointmentDO getCurAppointmentByPatId(String patId) {
- List<AppointmentDO> appointmentDOList = appointmentMapper.getCurrentPatId( patId );
- return 0 == appointmentDOList.size() ? null : appointmentDOList.get(0);
+ public AppointmentDO getCurAppointmentByPatIdAndCheckType(String patId, Integer checkType) {
+ AppointmentDO appointmentDO = appointmentMapper.getByPatAndCheckTypeAndBookDate( patId, checkType, LocalDate.now() );
+ return appointmentDO;
}
/**
@@ -124,7 +124,7 @@
*/
@Override
public List<AppointmentDO> queryAndCreateAppointmentByPatId(String patCode) {
- // 鍏堜粠鍖婚櫌骞冲彴鏌ヨ
+ // 浠庡尰闄㈠钩鍙版煡璇�
List<AppointmentDO> appointmentExtermalList = getAppointmentExtermal( patCode );
for ( int appointmentIndex = 0; appointmentIndex < appointmentExtermalList.size(); appointmentIndex++ ) {
@@ -132,12 +132,27 @@
if (null == appointmentExtermal )
continue;
- // 浠嶥B鏌ュ埌棰勭害锛屾槸鍚﹀凡缁忓瓨鍦�
- AppointmentDO appointmentDO = appointmentMapper.getByPatAndCheckTypeAndBookDate(appointmentExtermal.getPatId(), appointmentExtermal.getBookCheckType(), appointmentExtermal.getBookDate());
+ // 浠嶥B鏌ヨ棰勭害锛屾槸鍚﹀凡缁忓瓨鍦�
+ AppointmentDO appointmentDO = appointmentMapper.getByEpisodeIdAndApplyNo(appointmentExtermal.getEpisodeId(), appointmentExtermal.getApplyNo());
if (null == appointmentDO) {
appointmentMapper.insert(appointmentExtermal);
} else {
- appointmentExtermal.setId( appointmentDO.getId() ); // 纭繚 杩斿洖鍊间繚鎶� appointment id
+ appointmentExtermal.setId( appointmentDO.getId() ); // 纭繚 杩斿洖鍊煎寘鍚� appointment id
+
+ // 澶勭悊绗竴娆$‘璁ゆ椂杩樻病鏈夐绾︽椂闂达紝鍐嶆潵纭鏃跺凡鏈夐绾︽椂闂寸殑鎯呭喌
+ if (appointmentDO.getBookDate() != appointmentExtermal.getBookDate()) {
+ appointmentMapper.updateById( appointmentExtermal );
+ }
+ }
+ }
+
+ // 鏌ヨ[queue琛╙琛ュ厖 book_seq_num 鍒拌繑鍥炲�间腑
+ if (!appointmentExtermalList.isEmpty()) {
+ List<Long> appointIdlist = appointmentExtermalList.stream().map(appointmentDO -> appointmentDO.getId()).toList();
+ List<QueueDO> simpleQueueDOList = queueService.selectBookSeqNumByAppointIdList(appointIdlist);
+ if (!simpleQueueDOList.isEmpty()) {
+ Map<Long, Integer> mapAppointIdVsBookSeqNo = simpleQueueDOList.stream().collect(Collectors.toMap(QueueDO::getAppointId, QueueDO::getBookSeqNum));
+ appointmentExtermalList.forEach(appointmentExterma -> appointmentExterma.setBookSeqNum(mapAppointIdVsBookSeqNo.get(appointmentExterma.getId())));
}
}
@@ -175,6 +190,7 @@
AppointmentDO appointmentDO = BeanUtils.toBean(appointmentExternal, AppointmentDO.class);
appointmentDO.setApplyNo( appointmentExternal.getReqIdeApplyno() );
+ appointmentDO.setEpisodeId( appointmentExternal.getEpisodeID() );
appointmentDO.setPatSrc( getCorrespondingPatientSource(appointmentExternal.getAdmTypeCode()) );
appointmentDO.setPatId(appointmentExternal.getPatientID()); // 鍐呭涓� 韬唤璇佸彿 鎴� 闂ㄨ瘖浣忛櫌鍙�
appointmentDO.setPatName(appointmentExternal.getPatName());
@@ -188,9 +204,9 @@
appointmentDO.setPatWardDesc(appointmentExternal.getPatLocWardDesc());
appointmentDO.setPatMobile(appointmentExternal.getPhone());
appointmentDO.setPatBedNo(appointmentExternal.getEnBedno());
- appointmentDO.setBookId(appointmentExternal.getReqIdeApplyno());
appointmentDO.setBookCheckType(getCorrespondingCheckType(appointmentExternal.getPlanDefItemList().getPlanDefItem().getPlanDefItemcode()));
appointmentDO.setBookTime(DateUtils.ofUTC(appointmentExternal.getReqAuthoredOn())); // 寮�鍗曟椂闂�
+ appointmentDO.setBookSrc( 0 );
// 鍏夊紑鍗曠殑鎯呭喌锛屾病鏈夐绾︽椂闂�
if (null != appointmentExternal.getReqExtBooktime() ) {
@@ -200,8 +216,7 @@
appointmentDO.setBookTimeslot((bookStartTime.getHour() * 100 + bookStartTime.getMinute()) * 10000 + bookEndTime.getHour() * 100 + bookEndTime.getMinute());
}
- appointmentDO.setBookSrc(0);
- appointmentDO.setPaid(1);
+ appointmentDO.setPaid( 0 );
curAppointDOList.add( appointmentDO );
}
@@ -234,6 +249,9 @@
try {
QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO();
+ queueSaveReqVO.setApplyNo( appointment.getApplyNo() );
+ queueSaveReqVO.setEpisodeId( appointment.getEpisodeId() );
+ queueSaveReqVO.setAppointId(appointment.getId());
queueSaveReqVO.setPatId(appointment.getPatId());
queueSaveReqVO.setPatName(appointment.getPatName());
queueSaveReqVO.setPatGender(appointment.getPatGender());
@@ -311,6 +329,7 @@
patDetails.setWardCode( appointment.getPatWardCode() );
patDetails.setWardDesc( appointment.getPatWardDesc() );
patDetails.setBedNo( appointment.getPatBedNo() );
+ patDetails.setSource( appointment.getPatSrc() );
return patDetails;
}
}
--
Gitblit v1.9.3