liusheng
2025-02-27 e00ef99886b9ab84f39c81432f8c7640e93026f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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;
    }
 
 
}