From 003513b047fcae16e2125ff7a59e6d46ad048ce4 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 16 十月 2025 18:03:36 +0800
Subject: [PATCH] 代码提交
---
jh-module-ecg/jh-module-ecg-biz/src/test/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImplTest.java | 236 +++++++++++++++-------------------------------------------
1 files changed, 62 insertions(+), 174 deletions(-)
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 1aa3885..9d7a7e9 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,40 +1,31 @@
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 cn.lihu.jh.module.ecg.feign.ExmRequest;
+import cn.lihu.jh.module.ecg.feign.HisFeeConfirmReqBody;
+import cn.lihu.jh.module.ecg.feign.Item;
+import cn.lihu.jh.module.ecg.feign.MsgHeader;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.junit.Test;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
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.*;
-
+import javax.annotation.Resource;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* {@link AppointmentServiceImpl} 鐨勫崟鍏冩祴璇曠被
*
* @author 椹墤娉�
*/
-@Import(AppointmentServiceImpl.class)
-public class AppointmentServiceImplTest extends BaseDbUnitTest {
+@SpringBootTest
+public class AppointmentServiceImplTest {
@Resource
private AppointmentServiceImpl appointmentService;
@@ -43,160 +34,57 @@
private AppointmentMapper appointmentMapper;
@Test
- public void testCreateAppointment_success() {
- // 鍑嗗鍙傛暟
- AppointmentSaveReqVO createReqVO = randomPojo(AppointmentSaveReqVO.class).setId(null);
+ public void test() {
+ String regex = "(\\d+)[:锛歖(\\d+)";
+ String input = "08锛�00";
- // 璋冪敤
- Integer appointmentId = appointmentService.createAppointment(createReqVO);
- // 鏂█
- assertNotNull(appointmentId);
- // 鏍¢獙璁板綍鐨勫睘鎬ф槸鍚︽纭�
- AppointmentDO appointment = appointmentMapper.selectById(appointmentId);
- assertPojoEquals(createReqVO, appointment, "id");
+ 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));
+ }
}
@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);
+ public void test2() throws JsonProcessingException {
+ HisFeeConfirmReqBody hisFeeConfirmReqBody = new HisFeeConfirmReqBody();
+ MsgHeader msgHeader = new MsgHeader();
+ msgHeader.setMsgType("ODS_2212");
+ msgHeader.setMsgVersion("3.0");
+ msgHeader.setSender("ECG");
+ hisFeeConfirmReqBody.setMsgHeader(msgHeader);
+ Item item = new Item();
+ item.setItemCode("559542128");
+ item.setItemStatus("5");
+ item.setExeOrganization("47162057-2");
+ item.setExeDeptName("蹇冪數绉�");
+ item.setExeDept("蹇冪數绉�");
+ item.setExeDoctor("0457");
+ item.setExeDoctorName("寰愬皬鑻�");
+ item.setExeDateTime("2024-11-21 16:28:28");
+ ExmRequest exmRequest = new ExmRequest();
+ exmRequest.setAuthorOrganization("47162057-2");
+ exmRequest.setRequestId("815769404");
+ exmRequest.setPatientType("01");
+ exmRequest.setItem(item);
+ hisFeeConfirmReqBody.setExmRequest(exmRequest);
+ XmlMapper xmlMapper = new XmlMapper();
+ String xml = xmlMapper.writeValueAsString(hisFeeConfirmReqBody);
+ System.out.println(xml);
}
-
- @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
--
Gitblit v1.9.3