|
@@ -1,15 +1,20 @@
|
|
|
package com.fs.company.controller.store;
|
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.enums.ImTypeEnum;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.security.SecurityUtils;
|
|
|
import com.fs.his.domain.FsExportTask;
|
|
|
import com.fs.his.domain.FsPrescribe;
|
|
|
+import com.fs.his.dto.PayloadDTO;
|
|
|
import com.fs.his.param.FsPrescribeParam;
|
|
|
import com.fs.his.service.IFsExportTaskService;
|
|
|
import com.fs.his.service.IFsPrescribeService;
|
|
@@ -17,6 +22,11 @@ import com.fs.his.vo.FsMessageFeedbackExportListVO;
|
|
|
import com.fs.his.vo.FsPrescribeExcelListVO;
|
|
|
import com.fs.his.vo.FsPrescribeListVO;
|
|
|
import com.fs.his.vo.FsPrescribeVO;
|
|
|
+import com.fs.im.config.ImTypeConfig;
|
|
|
+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.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -31,6 +41,7 @@ import java.util.List;
|
|
|
* @author fs
|
|
|
* @date 2023-06-13
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/store/prescribe")
|
|
|
public class FsPrescribeController extends BaseController
|
|
@@ -39,6 +50,8 @@ public class FsPrescribeController extends BaseController
|
|
|
private IFsPrescribeService fsPrescribeService;
|
|
|
@Autowired
|
|
|
private IFsExportTaskService exportTaskService;
|
|
|
+ @Autowired
|
|
|
+ private OpenIMService openIMService;
|
|
|
/**
|
|
|
* 查询处方列表
|
|
|
*/
|
|
@@ -72,6 +85,64 @@ public class FsPrescribeController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/myImList")
|
|
|
+ public TableDataInfo myImList(FsPrescribeParam fsPrescribe)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ //fsPrescribe.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ List<FsPrescribeListVO> list = fsPrescribeService.selectFsPrescribeListVO(fsPrescribe);
|
|
|
+ for (FsPrescribeListVO vo : list) {
|
|
|
+ if (vo.getPatientTel()!=null){
|
|
|
+ vo.setPatientTel(vo.getPatientTel().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/sendPrescribe")
|
|
|
+ public AjaxResult sendPrescribe(@RequestBody FsPrescribeParam fsPrescribe) throws JsonProcessingException {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ if(ImTypeConfig.IMTYPE== ImTypeEnum.OPENIM){
|
|
|
+ log.info("拼接消息体");
|
|
|
+ //部署到正式环境以后下面这段代码要注释,使用定时任务执行auditPrescribe审核处方以后发送消息
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("C"+loginUser.getUser().getUserId());
|
|
|
+ openImMsgDTO.setRecvID("U"+fsPrescribe.getUserId());
|
|
|
+ openImMsgDTO.setContentType(110);
|
|
|
+ openImMsgDTO.setSenderPlatformID(5);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
+ //content.setContent(ext);
|
|
|
+ PayloadDTO payload = new PayloadDTO();
|
|
|
+ payload.setData("prescribe");
|
|
|
+ PayloadDTO.Extension extension = new PayloadDTO.Extension();
|
|
|
+ extension.setDiagnose(fsPrescribe.getDiagnose());
|
|
|
+ extension.setPrescribeId(fsPrescribe.getPrescribeId().toString());
|
|
|
+ payload.setExtension(extension);
|
|
|
+ extension.setStatus(fsPrescribe.getStatus());
|
|
|
+ OpenImMsgDTO.ImData imData = new OpenImMsgDTO.ImData();
|
|
|
+
|
|
|
+ imData.setPayload(payload);
|
|
|
+
|
|
|
+ String imJson = objectMapper.writeValueAsString(imData);
|
|
|
+ content.setData(imJson);
|
|
|
+ openImMsgDTO.setContent(content);
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject(openImMsgDTO);
|
|
|
+ log.info("开始发送消息");
|
|
|
+// OpenImMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImMsgDTO.OfflinePushInfo();
|
|
|
+// offlinePushInfo.setDesc("处方单");
|
|
|
+// offlinePushInfo.setTitle(doctor.getDoctorName());
|
|
|
+// offlinePushInfo.setIOSBadgeCount(true);
|
|
|
+// offlinePushInfo.setIOSPushSound("");
|
|
|
+// openImMsgDTO.setOfflinePushInfo(offlinePushInfo);
|
|
|
+ OpenImResponseDTO openImResponseDTO = openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
+ return AjaxResult.success(openImResponseDTO);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 导出处方列表
|