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 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 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)); } } @Test 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); } }