From 4ec8c306229e53951c7cb445f027d3b37f47f742 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 22 八月 2024 14:32:25 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java | 5
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java | 11
jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java | 258 +++++++-------------------------
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/DynamicSchedulingConfig.java | 43 +++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java | 7
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java | 28 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java | 25 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java | 5
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java | 30 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java | 4
jh-module-ecg/jh-module-ecg-biz/pom.xml | 10 +
11 files changed, 209 insertions(+), 217 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/pom.xml b/jh-module-ecg/jh-module-ecg-biz/pom.xml
index 42a4ca9..bb42c4b 100644
--- a/jh-module-ecg/jh-module-ecg-biz/pom.xml
+++ b/jh-module-ecg/jh-module-ecg-biz/pom.xml
@@ -130,6 +130,16 @@
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${openfeign.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java
new file mode 100644
index 0000000..b127159
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java
@@ -0,0 +1,5 @@
+package cn.lihu.jh.module.ecg;
+
+public interface Constants {
+ static final String ECG_OPENING_TIME_KEY = "ecg.openingtime";
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java
new file mode 100644
index 0000000..57a0132
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java
@@ -0,0 +1,30 @@
+package cn.lihu.jh.module.ecg;
+
+import jodd.typeconverter.impl.LocalTimeConverter;
+
+import java.time.LocalTime;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Utils {
+ public static LocalTime parseOpeningTime(String strOpeningTime) {
+ String regex = "(\\d+)[:锛歖(\\d+)";
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(strOpeningTime);
+
+ if (!matcher.find())
+ return null;
+
+ // 鑾峰彇鏁翠釜鍖归厤鐨勫瓧绗︿覆
+ String fullMatch = matcher.group();
+
+ // 鑾峰彇绗竴涓崟鑾风粍锛堝皬鏃讹級
+ String strHour = matcher.group(1);
+
+ // 鑾峰彇绗簩涓崟鑾风粍锛堝垎閽燂級
+ String strMinute = matcher.group(2);
+
+ LocalTime localTime = LocalTime.of(Integer.valueOf(strHour), Integer.valueOf(strMinute));
+ return localTime;
+ }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/DynamicSchedulingConfig.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/DynamicSchedulingConfig.java
new file mode 100644
index 0000000..6b2108d
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/DynamicSchedulingConfig.java
@@ -0,0 +1,43 @@
+package cn.lihu.jh.module.ecg.config;
+
+import cn.lihu.jh.module.ecg.Utils;
+import cn.lihu.jh.module.ecg.service.queue.QueueService;
+import cn.lihu.jh.module.infra.api.config.ConfigApi;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+
+import javax.annotation.Resource;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.concurrent.Executors;
+
+import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY;
+
+@Configuration
+@EnableScheduling
+public class DynamicSchedulingConfig implements SchedulingConfigurer {
+
+ @Resource
+ private ConfigApi configApi;
+
+ @Resource
+ private QueueService queueService;
+
+ @Override
+ public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
+ taskRegistrar.setScheduler(Executors.newScheduledThreadPool(1));
+
+ String strOpeningTime = configApi.getConfigValueByKey(ECG_OPENING_TIME_KEY);
+ LocalTime openingTime = Utils.parseOpeningTime(strOpeningTime);
+ String cronExpression = String.format("0 %d %d * * ?", openingTime.getMinute(), openingTime.getHour());
+ System.out.println(cronExpression);
+
+ taskRegistrar.addCronTask(() -> {
+ System.out.println("Dynamic Task executed at: " + System.currentTimeMillis());
+ queueService.startBiz();
+ }, cronExpression);
+ }
+
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
index 8db650a..ed203d6 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -1,6 +1,8 @@
package cn.lihu.jh.module.ecg.controller.admin.appointment;
import cn.hutool.core.bean.BeanUtil;
+import cn.lihu.jh.framework.common.exception.ErrorCode;
+import cn.lihu.jh.framework.common.util.date.DateUtils;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
import cn.lihu.jh.module.ecg.feign.RemoteDataService;
import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo;
@@ -27,6 +29,8 @@
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
+
+import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
import cn.lihu.jh.framework.excel.core.util.ExcelUtils;
@@ -180,6 +184,9 @@
//TODO 鍏堜粠棰勭害琛ㄥ彇鏁版嵁锛屽悗缁鎺ユ暟鎹钩鍙版煡棰勭害鏁版嵁
AppointmentDO appointment = appointmentService.getAppointment(confirmReqVO.getId());
+ if ( !DateUtils.isToday(appointment.getBookDate()) )
+ return error( new ErrorCode(101, "涓嶆槸浠婂ぉ鐨勯绾︾敤鎴�"));
+
QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO();
queueSaveReqVO.setPatId( appointment.getPatId());
queueSaveReqVO.setPatName( appointment.getPatName() );
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
index 88f81ef..12c988c 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
@@ -96,16 +96,17 @@
@Operation(summary = "寮�璇婅缃�")
@PreAuthorize("@ss.hasPermission('ecg:queue:setting')")
public CommonResult<Integer> openingSetting() {
+ // 浠嶥B鍚屾宸ヤ綅鐨勬偅鑰呴槦鍒楁暟鎹埌 宸ヤ綅浼樺厛闃熷垪, 鍙兘鏈夋柊寮�宸ヤ綅
queueService.initQueue();
return success(0);
}
- @GetMapping("/reorder")
- @Operation(summary = "寮�璇婂墠涓�鍒伙紝瀵瑰氨璇婂噯澶囩殑浜哄憳閲嶆柊鎺掑簭")
+ @GetMapping("/startbiz")
+ @Operation(summary = "鎵嬪姩寮�璇�")
@PreAuthorize("@ss.hasPermission('ecg:queue:setting')")
- public CommonResult<Integer> queueReorder() {
- queueService.reorderQueue();
+ public CommonResult<Integer> startBiz() {
+ queueService.startBiz();
return success(0);
}
-}
\ No newline at end of file
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
index ae75e8f..aef75c0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
@@ -5,6 +5,7 @@
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
+import java.time.LocalDateTime;
@Schema(description = "绠$悊鍚庡彴 - 鎺掗槦鏂板/淇敼 Request VO")
@@ -25,6 +26,10 @@
@Schema(description = "鎮h�呮�у埆")
private Byte patGender;
+ @Schema(description = "棰勭害鏃ユ湡", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "棰勭害鏃ユ湡涓嶈兘涓虹┖")
+ private LocalDateTime bookDate;
+
@Schema(description = "棰勭害鏃堕棿娈�", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "棰勭害鏃堕棿娈典笉鑳戒负绌�")
private Integer bookTimeslot;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java
index c0acc02..0a00279 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java
@@ -1,22 +1,46 @@
package cn.lihu.jh.module.ecg.listener;
+import cn.lihu.jh.module.ecg.Utils;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
+import cn.lihu.jh.module.infra.api.config.ConfigApi;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+
+import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY;
@Component
public class MySpringEventListener {
+
+ @Resource
+ private ConfigApi configApi;
@Resource
private QueueService queueService;
@EventListener
public void onApplicationEvent(ApplicationStartedEvent event) {
- System.out.println("搴旂敤鍚姩瀹屾垚锛岄�氱煡鐩戝惉鍣ㄦ墽琛岀紦瀛橀鍔犺浇鎿嶄綔");
+ System.out.println("搴旂敤鍚姩瀹屾垚锛岀郴缁熷垵濮嬨�傘�傘��");
+
queueService.initQueue();
- queueService.hurryup();
+
+ String strOpeningTime = configApi.getConfigValueByKey(ECG_OPENING_TIME_KEY);
+ LocalTime openingTime = Utils.parseOpeningTime(strOpeningTime);
+
+ // 鑾峰彇褰撳墠鏃堕棿
+ LocalTime currentTime = LocalTime.now();
+
+ // 姣旇緝鏃堕棿
+ if (currentTime.isBefore(openingTime)) {
+ // NO OP
+ } else if (currentTime.isAfter(openingTime)) {
+ queueService.startBiz();
+ } else {
+ queueService.startBiz();
+ }
}
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
index bbb31e8..e1f1b63 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
@@ -14,6 +14,8 @@
*/
public interface QueueService {
+ void startBiz();
+
/**
* 鍒涘缓鎺掗槦
*
@@ -59,7 +61,7 @@
void queue(QueueSaveReqVO queueSaveReqVO);
/**
- *
+ * 绯荤粺閲嶅惎鏃讹紝浠嶥B鍚屾宸ヤ綅鐨勬偅鑰呴槦鍒楁暟鎹埌 宸ヤ綅浼樺厛闃熷垪
*/
void initQueue();
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
index b280271..b961cb3 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
@@ -35,6 +35,14 @@
final static Integer MAX_QUEUE_NUM = 3;
+ @Resource
+ private queueMapper queueMapper;
+
+ @Resource
+ private RoomMapper roomMapper;
+
+ AtomicInteger openingFlag = new AtomicInteger(0);
+
AtomicInteger curSeqNum = new AtomicInteger(0);
PriorityBlockingQueue<BedQueueBO> priorityQueue = new PriorityBlockingQueue<>();
@@ -42,11 +50,6 @@
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
- @Resource
- private queueMapper queueMapper;
-
- @Resource
- private RoomMapper roomMapper;
@Override
public Integer createqueue(QueueSaveReqVO createReqVO) {
@@ -91,7 +94,7 @@
}
/**
- * 绯荤粺閲嶅惎鏃讹紝浠嶥B鍚屾闃熷垪鏁版嵁鍒� 宸ヤ綅浼樺厛闃熷垪
+ * 绯荤粺閲嶅惎鏃讹紝浠嶥B鍚屾宸ヤ綅鐨勬偅鑰呴槦鍒楁暟鎹埌 宸ヤ綅浼樺厛闃熷垪
*/
public void initQueue() {
priorityQueue.clear();
@@ -145,7 +148,7 @@
* 绛夊埌鍙栦笅涓�涓� 鎺掗槦涓汉鍛� 鐨勯�昏緫瀹屾垚鍚庯紝鍐嶅洖鏉ヤ笉閿�
*/
public void hurryup() {
- while (true) {
+ while (1 == openingFlag.get()) {
BedQueueBO bedQueueBO = priorityQueue.peek();
if (null == bedQueueBO)
return;
@@ -190,6 +193,9 @@
queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus()); //鎺掗槦涓�
QueueDO queue = BeanUtils.toBean(queueSaveReqVO, QueueDO.class);
queueMapper.insert(queue);
+
+ if (0 == openingFlag.get())
+ return;
singleThreadExecutor.execute( () -> {
hurryup();
@@ -259,4 +265,9 @@
return patientStatisticVO;
}
+ public void startBiz() {
+ openingFlag.set(1);
+ hurryup();
+ }
+
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java b/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
index 6343c89..456246d 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java
@@ -1,202 +1,56 @@
-//package cn.lihu.jh.module.ecg.service.appointment;
-//
-//import org.junit.jupiter.api.Disabled;
-//import org.junit.jupiter.api.Test;
-//import org.springframework.boot.test.mock.mockito.MockBean;
-//
-//import jakarta.annotation.Resource;
-//
-//import cn.lihu.jh.framework.test.core.ut.BaseDbUnitTest;
-//
-//import cn.lihu.jh.module.ecg.controller.admin.appointment.vo.*;
-//import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO;
-//import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
-//import cn.lihu.jh.framework.common.pojo.PageResult;
-//
-//import jakarta.annotation.Resource;
-//import org.springframework.context.annotation.Import;
-//import java.util.*;
-//import java.time.LocalDateTime;
-//
-//import static cn.hutool.core.util.RandomUtil.*;
-//import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
-//import static cn.lihu.jh.framework.test.core.util.AssertUtils.*;
-//import static cn.lihu.jh.framework.test.core.util.RandomUtils.*;
-//import static cn.lihu.jh.framework.common.util.date.LocalDateTimeUtils.*;
-//import static cn.lihu.jh.framework.common.util.object.ObjectUtils.*;
-//import static cn.lihu.jh.framework.common.util.date.DateUtils.*;
-//import static org.junit.jupiter.api.Assertions.*;
-//import static org.mockito.Mockito.*;
-//
-///**
-// * {@link AppointmentServiceImpl} 鐨勫崟鍏冩祴璇曠被
-// *
-// * @author 椹墤娉�
-// */
-//@Import(AppointmentServiceImpl.class)
-//public class AppointmentServiceImplTest extends BaseDbUnitTest {
-//
-// @Resource
-// private AppointmentServiceImpl appointmentService;
-//
-// @Resource
-// private AppointmentMapper appointmentMapper;
-//
-// @Test
-// public void testCreateAppointment_success() {
-// // 鍑嗗鍙傛暟
-// AppointmentSaveReqVO createReqVO = randomPojo(AppointmentSaveReqVO.class).setId(null);
-//
-// // 璋冪敤
-// Integer appointmentId = appointmentService.createAppointment(createReqVO);
-// // 鏂█
-// assertNotNull(appointmentId);
-// // 鏍¢獙璁板綍鐨勫睘鎬ф槸鍚︽纭�
-// AppointmentDO appointment = appointmentMapper.selectById(appointmentId);
-// assertPojoEquals(createReqVO, appointment, "id");
-// }
-//
-// @Test
-// public void testUpdateAppointment_success() {
-// // mock 鏁版嵁
-// AppointmentDO dbAppointment = randomPojo(AppointmentDO.class);
-// appointmentMapper.insert(dbAppointment);// @Sql: 鍏堟彃鍏ュ嚭涓�鏉″瓨鍦ㄧ殑鏁版嵁
-// // 鍑嗗鍙傛暟
-// AppointmentSaveReqVO updateReqVO = randomPojo(AppointmentSaveReqVO.class, o -> {
-// o.setId(dbAppointment.getId()); // 璁剧疆鏇存柊鐨� ID
-// });
-//
-// // 璋冪敤
-// appointmentService.updateAppointment(updateReqVO);
-// // 鏍¢獙鏄惁鏇存柊姝g‘
-// AppointmentDO appointment = appointmentMapper.selectById(updateReqVO.getId()); // 鑾峰彇鏈�鏂扮殑
-// assertPojoEquals(updateReqVO, appointment);
-// }
-//
-// @Test
-// public void testUpdateAppointment_notExists() {
-// // 鍑嗗鍙傛暟
-// AppointmentSaveReqVO updateReqVO = randomPojo(AppointmentSaveReqVO.class);
-//
-// // 璋冪敤, 骞舵柇瑷�寮傚父
-// assertServiceException(() -> appointmentService.updateAppointment(updateReqVO), APPOINTMENT_NOT_EXISTS);
-// }
-//
-// @Test
-// public void testDeleteAppointment_success() {
-// // mock 鏁版嵁
-// AppointmentDO dbAppointment = randomPojo(AppointmentDO.class);
-// appointmentMapper.insert(dbAppointment);// @Sql: 鍏堟彃鍏ュ嚭涓�鏉″瓨鍦ㄧ殑鏁版嵁
-// // 鍑嗗鍙傛暟
-// Integer id = dbAppointment.getId();
-//
-// // 璋冪敤
-// appointmentService.deleteAppointment(id);
-// // 鏍¢獙鏁版嵁涓嶅瓨鍦ㄤ簡
-// assertNull(appointmentMapper.selectById(id));
-// }
-//
-// @Test
-// public void testDeleteAppointment_notExists() {
-// // 鍑嗗鍙傛暟
-// Integer id = randomIntegerId();
-//
-// // 璋冪敤, 骞舵柇瑷�寮傚父
-// assertServiceException(() -> appointmentService.deleteAppointment(id), APPOINTMENT_NOT_EXISTS);
-// }
-//
-// @Test
-// @Disabled // TODO 璇蜂慨鏀� null 涓洪渶瑕佺殑鍊硷紝鐒跺悗鍒犻櫎 @Disabled 娉ㄨВ
-// public void testGetAppointmentPage() {
-// // mock 鏁版嵁
-// AppointmentDO dbAppointment = randomPojo(AppointmentDO.class, o -> { // 绛変細鏌ヨ鍒�
-// o.setPatId(null);
-// o.setPatName(null);
-// o.setPatGender(null);
-// o.setPatBirthday(null);
-// o.setPatMobile(null);
-// o.setPatPhone(null);
-// o.setPatIdentityId(null);
-// o.setPatAddr(null);
-// o.setPatDeptCode(null);
-// o.setPatDeptDesc(null);
-// o.setPatWardCode(null);
-// o.setPatWardDesc(null);
-// o.setPatBedNo(null);
-// o.setBookId(null);
-// o.setBookPeriodStart(null);
-// o.setBookPeriodEnd(null);
-// o.setBookTime(null);
-// o.setBookCheckType(null);
-// o.setBookSrc(null);
-// });
-// appointmentMapper.insert(dbAppointment);
-// // 娴嬭瘯 patId 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatId(null)));
-// // 娴嬭瘯 patName 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatName(null)));
-// // 娴嬭瘯 patGender 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatGender(null)));
-// // 娴嬭瘯 patBirthday 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatBirthday(null)));
-// // 娴嬭瘯 patMobile 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatMobile(null)));
-// // 娴嬭瘯 patPhone 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatPhone(null)));
-// // 娴嬭瘯 patIdentityId 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatIdentityId(null)));
-// // 娴嬭瘯 patAddr 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatAddr(null)));
-// // 娴嬭瘯 patDeptCode 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatDeptCode(null)));
-// // 娴嬭瘯 patDeptDesc 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatDeptDesc(null)));
-// // 娴嬭瘯 patWardCode 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatWardCode(null)));
-// // 娴嬭瘯 patWardDesc 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatWardDesc(null)));
-// // 娴嬭瘯 patBedNo 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setPatBedNo(null)));
-// // 娴嬭瘯 bookId 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookId(null)));
-// // 娴嬭瘯 bookPeriodStart 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookPeriodStart(null)));
-// // 娴嬭瘯 bookPeriodEnd 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookPeriodEnd(null)));
-// // 娴嬭瘯 bookTime 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookTime(null)));
-// // 娴嬭瘯 bookCheckType 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookCheckType(null)));
-// // 娴嬭瘯 bookSrc 涓嶅尮閰�
-// appointmentMapper.insert(cloneIgnoreId(dbAppointment, o -> o.setBookSrc(null)));
-// // 鍑嗗鍙傛暟
-// AppointmentPageReqVO reqVO = new AppointmentPageReqVO();
-// reqVO.setPatId(null);
-// reqVO.setPatName(null);
-// reqVO.setPatGender(null);
-// reqVO.setPatBirthday(null);
-// reqVO.setPatMobile(null);
-// reqVO.setPatPhone(null);
-// reqVO.setPatIdentityId(null);
-// reqVO.setPatAddr(null);
-// reqVO.setPatDeptCode(null);
-// reqVO.setPatDeptDesc(null);
-// reqVO.setPatWardCode(null);
-// reqVO.setPatWardDesc(null);
-// reqVO.setPatBedNo(null);
-// reqVO.setBookId(null);
-// reqVO.setBookPeriodStart(null);
-// reqVO.setBookPeriodEnd(null);
-// reqVO.setBookTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-// reqVO.setBookCheckType(null);
-// reqVO.setBookSrc(null);
-//
-// // 璋冪敤
-// PageResult<AppointmentDO> pageResult = appointmentService.getAppointmentPage(reqVO);
-// // 鏂█
-// assertEquals(1, pageResult.getTotal());
-// assertEquals(1, pageResult.getList().size());
-// assertPojoEquals(dbAppointment, pageResult.getList().get(0));
-// }
-//
-//}
\ No newline at end of file
+package cn.lihu.jh.module.ecg.service.appointment;
+
+import cn.lihu.jh.module.ecg.controller.admin.appointment.vo.*;
+import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO;
+import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
+import cn.lihu.jh.framework.common.pojo.PageResult;
+
+import org.junit.Test;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
+
+import javax.annotation.Resource;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+/**
+ * {@link AppointmentServiceImpl} 鐨勫崟鍏冩祴璇曠被
+ *
+ * @author 椹墤娉�
+ */
+@SpringBootTest
+public class AppointmentServiceImplTest {
+
+ @Resource
+ private AppointmentServiceImpl appointmentService;
+
+ @Resource
+ private AppointmentMapper appointmentMapper;
+
+ @Test
+ public void test() {
+ String regex = "(\\d+)[:锛歖(\\d+)";
+ String input = "08锛�00";
+
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(input);
+
+ if (matcher.find()) {
+ // 鑾峰彇鏁翠釜鍖归厤鐨勫瓧绗︿覆
+ String fullMatch = matcher.group();
+ System.out.println("Full match: " + fullMatch);
+
+
+ // 鑾峰彇绗竴涓崟鑾风粍锛堢敤鎴峰悕锛�
+ String username = matcher.group(1);
+ System.out.println("Username: " + username);
+ System.out.println("Username: " + Integer.valueOf(username));
+
+
+ // 鑾峰彇绗簩涓崟鑾风粍锛堝煙鍚嶏級
+ String domain = matcher.group(2);
+ System.out.println("Domain: " + domain);
+ System.out.println("Domain: " + Integer.valueOf(domain));
+ }
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3