eight
2024-08-22 4ec8c306229e53951c7cb445f027d3b37f47f742
update
已添加3个文件
已修改8个文件
426 ■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/pom.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/DynamicSchedulingConfig.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/listener/MySpringEventListener.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java 258 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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";
}
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;
    }
}
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);
    }
}
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() );
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() {
        // ä»ŽDB同步工位的患者队列数据到 å·¥ä½ä¼˜å…ˆé˜Ÿåˆ—, å¯èƒ½æœ‰æ–°å¼€å·¥ä½
        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);
    }
}
}
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 = "患者性别")
    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;
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();
        }
    }
}
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);
    /**
     *
     * ç³»ç»Ÿé‡å¯æ—¶ï¼Œä»ŽDB同步工位的患者队列数据到 å·¥ä½ä¼˜å…ˆé˜Ÿåˆ—
     */
    void initQueue();
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 @@
    }
    /**
     * ç³»ç»Ÿé‡å¯æ—¶ï¼Œä»ŽDB同步队列数据到 å·¥ä½ä¼˜å…ˆé˜Ÿåˆ—
     * ç³»ç»Ÿé‡å¯æ—¶ï¼Œä»ŽDB同步工位的患者队列数据到 å·¥ä½ä¼˜å…ˆé˜Ÿåˆ—
     */
    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();
    }
}
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);
//        // æ ¡éªŒæ˜¯å¦æ›´æ–°æ­£ç¡®
//        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));
//    }
//
//}
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));
        }
    }
}