|
@@ -1,26 +1,51 @@
|
|
|
package com.tuoren.web.layer.service.impl;
|
|
package com.tuoren.web.layer.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.tuoren.common.utils.ConstastUtils;
|
|
|
|
|
+import com.tuoren.common.utils.enums.LogType;
|
|
|
|
|
+import com.tuoren.web.layer.d0.PatientDTO;
|
|
|
|
|
+import com.tuoren.web.layer.entity.BusAnalgesicScoreEntity;
|
|
|
|
|
+import com.tuoren.web.layer.entity.SysBreathEntity;
|
|
|
import com.tuoren.web.layer.vo.PatientParam;
|
|
import com.tuoren.web.layer.vo.PatientParam;
|
|
|
import com.tuoren.web.layer.entity.BusPatientEntity;
|
|
import com.tuoren.web.layer.entity.BusPatientEntity;
|
|
|
import com.tuoren.web.layer.mapper.BusPatientMapper;
|
|
import com.tuoren.web.layer.mapper.BusPatientMapper;
|
|
|
import com.tuoren.web.layer.service.IBusPatientService;
|
|
import com.tuoren.web.layer.service.IBusPatientService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.tuoren.web.utils.ConverterUtils;
|
|
|
|
|
+import com.tuoren.web.utils.DataUtils;
|
|
|
|
|
+import com.tuoren.web.utils.LogUtils;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.amqp.rabbit.connection.CorrelationData;
|
|
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
|
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
* </p>
|
|
|
*
|
|
*
|
|
|
* @author fanfan
|
|
* @author fanfan
|
|
|
* @since 2020-07-03
|
|
* @since 2020-07-03
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
|
|
+@Slf4j
|
|
|
public class BusPatientServiceImpl extends ServiceImpl<BusPatientMapper, BusPatientEntity> implements IBusPatientService {
|
|
public class BusPatientServiceImpl extends ServiceImpl<BusPatientMapper, BusPatientEntity> implements IBusPatientService {
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RabbitTemplate rabbitTemplate;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<BusPatientEntity> queryFuzzyPatient(PatientParam patientParam) {
|
|
public IPage<BusPatientEntity> queryFuzzyPatient(PatientParam patientParam) {
|
|
|
IPage<BusPatientEntity> iPage = new Page<>(patientParam.getPageNo(), patientParam.getPageSize());
|
|
IPage<BusPatientEntity> iPage = new Page<>(patientParam.getPageNo(), patientParam.getPageSize());
|
|
@@ -37,4 +62,71 @@ public class BusPatientServiceImpl extends ServiceImpl<BusPatientMapper, BusPati
|
|
|
iPage.setRecords(list);
|
|
iPage.setRecords(list);
|
|
|
return iPage;
|
|
return iPage;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @description: 下发用户信息到上位机
|
|
|
|
|
+ * @author wangzl
|
|
|
|
|
+ * @date 2025/6/17
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void sendPatientInfoToPump(String id) {
|
|
|
|
|
+ BusPatientEntity busPatientEntity = baseMapper.selectById(id);
|
|
|
|
|
+ if (busPatientEntity != null) {
|
|
|
|
|
+ //TODO: 下发用户信息到上位机
|
|
|
|
|
+ // 自定义属性映射规则
|
|
|
|
|
+
|
|
|
|
|
+ PatientDTO data = new PatientDTO();
|
|
|
|
|
+ data.setSysHospital_ID(busPatientEntity.getHospitalCode());
|
|
|
|
|
+ data.setPatientCode(busPatientEntity.getPatientCode());
|
|
|
|
|
+ data.setPumpCode(busPatientEntity.getPumpCode());
|
|
|
|
|
+ data.setName(busPatientEntity.getName());
|
|
|
|
|
+ data.setSex(busPatientEntity.getSex());
|
|
|
|
|
+ data.setHeight(busPatientEntity.getHeight());
|
|
|
|
|
+ data.setWeight(busPatientEntity.getWeight());
|
|
|
|
|
+ data.setAge(busPatientEntity.getAge());
|
|
|
|
|
+ data.setWard(busPatientEntity.getWardCode());
|
|
|
|
|
+ data.setBedNo(busPatientEntity.getBedCode());
|
|
|
|
|
+ data.setOperation(busPatientEntity.getOperationName());
|
|
|
|
|
+ data.setSurgeon(busPatientEntity.getOperationDoctor());
|
|
|
|
|
+ data.setASA(busPatientEntity.getAsa());
|
|
|
|
|
+ data.setEaseMode(busPatientEntity.getEasyMode());
|
|
|
|
|
+ data.setDoctor(busPatientEntity.getAnesthesiaDoctor1());
|
|
|
|
|
+ data.setDoctorTwo(busPatientEntity.getAnesthesiaDoctor2());
|
|
|
|
|
+ data.setAnesthesiaMode(busPatientEntity.getAnesthesiaMode());
|
|
|
|
|
+ data.setConfigPerson(busPatientEntity.getConfigPerson());
|
|
|
|
|
+ data.setFormula(busPatientEntity.getFormula());
|
|
|
|
|
+ data.setUndoPerson(busPatientEntity.getUndoPerson());
|
|
|
|
|
+ data.setDestroyPerson(busPatientEntity.getDestoryPerson());
|
|
|
|
|
+ data.setWitnessPerson(busPatientEntity.getWitnessPerson());
|
|
|
|
|
+ if (!Objects.isNull(busPatientEntity.getUndoTime())) {
|
|
|
|
|
+ Date undoTime = new Date(busPatientEntity.getUndoTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
|
|
|
|
+ data.setUndoTime(DateUtil.format(undoTime, "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data.setUndoTime(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setSalt(busPatientEntity.getSalt());
|
|
|
|
|
+ data.setBalance(busPatientEntity.getRemain());
|
|
|
|
|
+ data.setRemark(busPatientEntity.getRemark());
|
|
|
|
|
+ data.setIsDelete(busPatientEntity.getIsDelete());
|
|
|
|
|
+ if (!Objects.isNull(busPatientEntity.getGmtCreate())) {
|
|
|
|
|
+ Date gmtDate = new Date(busPatientEntity.getGmtCreate().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
|
|
|
|
+ data.setCreateTime(DateUtil.format(gmtDate, "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data.setCreateTime(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setBMI(busPatientEntity.getBmi());
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> pump = new HashMap<>();
|
|
|
|
|
+ pump.put("operation", 1);
|
|
|
|
|
+ pump.put("tableName", "PatientInfo");
|
|
|
|
|
+ pump.put("data", data);
|
|
|
|
|
+ log.info("下发用户信息到上位机内容:{}", JSONUtil.toJsonStr(pump));
|
|
|
|
|
+ System.out.println(JSONUtil.toJsonStr(pump));
|
|
|
|
|
+ //发送到队列
|
|
|
|
|
+ rabbitTemplate.convertAndSend(ConstastUtils.ROUTING_KEY+busPatientEntity.getHospitalCode(),JSONUtil.toJsonStr(pump));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|