package com.smartor.service.impl;
|
|
import com.github.pagehelper.util.StringUtil;
|
import com.ruoyi.common.enums.FollowUpEnum;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.smartor.domain.ServiceThirdData;
|
import com.smartor.mapper.ServiceThirdDataMapper;
|
import com.smartor.service.RemoteDataSaveService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.applet.AppletContext;
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
|
/**
|
* 【请填写功能名称】Service业务层处理
|
*
|
* @author ruoyi
|
* @date 2023-05-25
|
*/
|
@Service
|
public class RemoteDataSaveServiceImpl implements RemoteDataSaveService {
|
|
/**
|
* 数据处理
|
*
|
* @param map
|
*/
|
@Override
|
public void dealData(Map<String, List> map, String dataInfo) {
|
if (CollectionUtils.isEmpty(map)) {
|
return;
|
}
|
|
//根据文档得知,第8个(从0开始)就是数据类型
|
List msh = map.get("MSH");
|
String result = msh.get(8).toString();
|
|
//获取到最后一个“ ^ ”的位置,方便下面截取数据类型(就是发过来的内容是啥)
|
int endIndex = result.lastIndexOf("^");
|
String dataType = result.substring(0, endIndex);
|
System.out.println("dataType : " + dataType);
|
ServiceThirdData serviceThirdData = new ServiceThirdData();
|
serviceThirdData.setDataType(dataType);
|
serviceThirdData.setDataTypeExplain(FollowUpEnum.getDescByCode(dataType));
|
//此处不能用map的数据,因为有的数据的KEY可能是一样的,所以用string里的数据
|
serviceThirdData.setDataInfo(dataInfo);
|
serviceThirdData.setFactory("联众");
|
serviceThirdData.setIsDeal(0);
|
serviceThirdData.setCreateTime(new Date());
|
|
//此处引不到sping中的mapper,只能通过上下文,去获取mapper对象
|
ServiceThirdDataMapper serviceThirdDataMapper = SpringUtils.getBean(ServiceThirdDataMapper.class);
|
try {
|
if (dataType.equals("RGV^O15")) {
|
//直接插到"执行医嘱计划表"
|
int i1 = serviceThirdDataMapper.insertThirdDataZxyzjh(serviceThirdData);
|
} else if (dataType.equals("OMP^O09")) {
|
//处方新增申请
|
int i2 = serviceThirdDataMapper.insertThirdDataCfxzsq(serviceThirdData);
|
} else {
|
int i3 = serviceThirdDataMapper.insertThirdData(serviceThirdData);
|
}
|
} catch (Exception e) {
|
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
|
String date = simpleDateFormat1.format(new Date());
|
System.out.println(date + " 报错时间,未插入的数据 : " + dataInfo);
|
e.getMessage();
|
}
|
|
}
|
|
/**
|
* 患者基本信息
|
*
|
* @param map
|
* @return
|
*/
|
@Override
|
public Boolean patientInfo(Map<String, List> map) {
|
System.out.println("patientInfo患者基本信息 : " + map);
|
return null;
|
}
|
|
/**
|
* 患者诊断信息修改
|
*
|
* @param map
|
* @return
|
*/
|
@Override
|
public Boolean patientInfoEdit(Map<String, List> map) {
|
System.out.println("patientInfoEdit患者诊断信息修改 : " + map);
|
|
return null;
|
}
|
|
/**
|
* 患者入院
|
*
|
* @param map
|
* @return
|
*/
|
@Override
|
public Boolean patientHospitalized(Map<String, List> map) {
|
System.out.println("patientHospitalized患者入院 : " + map);
|
|
return null;
|
}
|
|
|
}
|