|
|
@@ -1,181 +0,0 @@
|
|
|
-package com.fs.course.controller;
|
|
|
-
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fs.FSApplication;
|
|
|
-import com.fs.common.annotation.DataSource;
|
|
|
-import com.fs.his.domain.FsPrescribe;
|
|
|
-import com.fs.his.domain.FsPrescribeDrug;
|
|
|
-import com.fs.his.domain.FsStoreOrder;
|
|
|
-import com.fs.his.dto.FsPrescribeUsageDTO;
|
|
|
-import com.fs.his.mapper.FsInquiryOrderMapper;
|
|
|
-import com.fs.his.mapper.FsPrescribeDrugMapper;
|
|
|
-import com.fs.his.mapper.FsPrescribeMapper;
|
|
|
-import com.fs.his.param.PrescribeXyImgParam;
|
|
|
-import com.fs.his.service.IFsStoreOrderService;
|
|
|
-import com.fs.his.service.PrescriptionImageService;
|
|
|
-import com.fs.his.vo.FsInquiryOrderVO;
|
|
|
-import com.fs.his.vo.FsPrescribeVO;
|
|
|
-import com.fs.im.dto.OpenImMsgDTO;
|
|
|
-import com.fs.im.dto.OpenImResponseDTO;
|
|
|
-import com.fs.im.service.OpenIMService;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.junit.Test;
|
|
|
-import org.junit.runner.RunWith;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-import org.springframework.boot.test.mock.mockito.MockBean;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
-import org.springframework.test.context.ActiveProfiles;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import static org.junit.Assert.assertNotNull;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-@ActiveProfiles("druid-syysy-test")
|
|
|
-@RunWith(org.springframework.test.context.junit4.SpringRunner.class)
|
|
|
-@SpringBootTest(classes = FSApplication.class)
|
|
|
-public class OpenIMServiceTest {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private OpenIMService openIMService;
|
|
|
- @Autowired
|
|
|
- private PrescriptionImageService prescriptionImageService;
|
|
|
- @Autowired
|
|
|
- private FsPrescribeMapper fsPrescribeMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IFsStoreOrderService storeOrderService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private FsInquiryOrderMapper fsInquiryOrderMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private FsPrescribeDrugMapper fsPrescribeDrugMapper;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void generateImg() {
|
|
|
- FsPrescribeVO f = fsPrescribeMapper.selectFsPrescribeByPrescribeIdVO(11L);
|
|
|
-
|
|
|
- FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderId(f.getStoreOrderId());
|
|
|
- FsInquiryOrderVO order = fsInquiryOrderMapper.selectFsInquiryOrderVOByOrderId(f.getInquiryOrderId());
|
|
|
- FsPrescribeDrug d = new FsPrescribeDrug();
|
|
|
- d.setPrescribeId(f.getPrescribeId());
|
|
|
- List<FsPrescribeDrug> list = fsPrescribeDrugMapper.selectFsPrescribeDrugList(d);
|
|
|
- PrescribeXyImgParam o = new PrescribeXyImgParam();
|
|
|
- o.setTotalPrice(fsStoreOrder.getPayPrice());
|
|
|
- o.setTime(f.getCreateTime());
|
|
|
- o.setPrescribeId(f.getPrescribeCode());
|
|
|
- o.setPatientName(f.getPatientName());
|
|
|
- o.setPatientGender(f.getPatientGender());
|
|
|
- o.setPatientAge(f.getPatientAge());
|
|
|
- o.setOutpatientId(f.getPrescribeCode());
|
|
|
- o.setUrl(f.getPrescribeDoctorSignUrl());
|
|
|
- o.setDrugDoctorUrl(f.getDrugDoctorSignUrl());
|
|
|
- if (order != null) {
|
|
|
- o.setBedId(order.getDeptName());
|
|
|
- } else {
|
|
|
- o.setBedId("中医科");
|
|
|
- }
|
|
|
- String remark = "";
|
|
|
- if (f.getUsageJson() != null) {
|
|
|
- FsPrescribeUsageDTO usage = JSONUtil.toBean(f.getUsageJson(), FsPrescribeUsageDTO.class);
|
|
|
- remark = usage.getRemark();
|
|
|
- }
|
|
|
- if (remark != null && remark != "") {
|
|
|
- o.setRemark(remark);
|
|
|
- } else {
|
|
|
- o.setRemark("请按照用药说明书服用药品,如有不适,请及时就医!");
|
|
|
- }
|
|
|
- o.setHistoryAllergic(f.getHistoryAllergic());
|
|
|
- o.setDiagnose("慢性咽炎。");
|
|
|
- o.setPrescribeDrug(list); // 在这里添加处方药品列表的值
|
|
|
- o.setDoctorName(f.getDoctorName());
|
|
|
- o.setAuditDoctor(f.getDoctorDrugName());
|
|
|
- o.setDispatcher("");
|
|
|
- o.setCheckDoctor("");
|
|
|
- o.setDoctorName(f.getDoctorName());
|
|
|
- o.setTelPhone("15560889998");
|
|
|
- o.setDoctorTitle("砖家");
|
|
|
- o.setDoctorNo("155608608433128");
|
|
|
- String s = prescriptionImageService.generatePrescriptionImage(o);
|
|
|
- log.info(s);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void openIMSendMsg() {
|
|
|
- OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
- openImMsgDTO.setSendID("fbyC8584");
|
|
|
- openImMsgDTO.setRecvID("fbyU1077739");
|
|
|
-// openImMsgDTO.setGroupID("group789");
|
|
|
- openImMsgDTO.setSenderNickname("测试用户");
|
|
|
- openImMsgDTO.setSenderFaceURL("https://example.com/avatar.jpg");
|
|
|
- openImMsgDTO.setSenderPlatformID(1);
|
|
|
- openImMsgDTO.setContentType(101);
|
|
|
- openImMsgDTO.setSessionType(1);
|
|
|
- openImMsgDTO.setOnlineOnly(false);
|
|
|
- openImMsgDTO.setNotOfflinePush(false);
|
|
|
- openImMsgDTO.setSendTime(System.currentTimeMillis());
|
|
|
- openImMsgDTO.setEx("额外信息");
|
|
|
-
|
|
|
- // Content
|
|
|
- OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
- content.setContent("Hello World");
|
|
|
- content.setData("test data");
|
|
|
- content.setDescription("测试消息");
|
|
|
- content.setExtension("ext");
|
|
|
- openImMsgDTO.setContent(content);
|
|
|
-
|
|
|
- // OfflinePushInfo
|
|
|
- OpenImMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImMsgDTO.OfflinePushInfo();
|
|
|
- offlinePushInfo.setTitle("新消息");
|
|
|
- offlinePushInfo.setDesc("您收到一条新消息");
|
|
|
- offlinePushInfo.setEx("push ex");
|
|
|
- offlinePushInfo.setIOSPushSound("default");
|
|
|
- offlinePushInfo.setIOSBadgeCount(true);
|
|
|
- openImMsgDTO.setOfflinePushInfo(offlinePushInfo);
|
|
|
-
|
|
|
- // 调用方法
|
|
|
- OpenImResponseDTO result = openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
-
|
|
|
- // 断言
|
|
|
- assertNotNull(result);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void aiAutoReply() {
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void sendUtil() {
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void sendUtilUserToDoctor() {
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void editConversation() {
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void sendCourse() throws JsonProcessingException {
|
|
|
- Long userId = 1077739L;
|
|
|
- Long companyUserId = 8584L;
|
|
|
- String url = "https://example.com/course/123";
|
|
|
- String title = "Java编程基础课程";
|
|
|
- String linkImageUrl = "https://example.com/images/course-cover.jpg";
|
|
|
- String cropId = "crop_123456";
|
|
|
-
|
|
|
- OpenImResponseDTO actualResponse = openIMService.sendCourse(
|
|
|
- userId, companyUserId, url, title, linkImageUrl, cropId
|
|
|
- );
|
|
|
- log.info("返回结果: {}", actualResponse);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void sendPackageUtil() {
|
|
|
- }
|
|
|
-}
|