suxiaoyang 6 роки тому
батько
коміт
f5cbff5ebc

+ 2 - 0
readme.md

@ -0,0 +1,2 @@
此微服务主要依据EHR平台资源的规范开发,涉及到大量的EHR_XXXXXX可根据数据库表rs_metadata进行字段翻译,
一般情况下此表的数据只增不改,可确保取值后期版本变更没有问题。

+ 8 - 0
src/main/java/com/yihu/ehr/profile/controller/profile/ProfileInspectionEndPoint.java

@ -44,6 +44,14 @@ public class ProfileInspectionEndPoint extends EnvelopRestEndPoint {
        return profileInspectionService.inspectionRecords(demographic_id, filter, date, searchParam);
    }
    /**
     * 检验有子项结果,不能在此接口直接返回
     * 故需要调用其他接口获取统计数据
     * @param demographic_id
     * @param table
     * @return
     * @throws Exception
     */
    @ApiOperation("检查检验记录统计 - 档案浏览器")
    @RequestMapping(value = ServiceApi.Profiles.InspectionStatistics, method = RequestMethod.GET)
    public List<InspectionInfo> inspectionStatistics(

+ 2 - 1
src/main/java/com/yihu/ehr/profile/controller/profile/ProfileMedicationEndPoint.java

@ -22,7 +22,8 @@ import java.util.Map;
/**
 * EndPoint - 用药记录
 * Created by progr1mmer on 2018/3/13.
 * @author progr1mmer
 * @date Created on 2018/3/13.
 */
@RestController
@RequestMapping(value = ApiVersion.Version1_0, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)

+ 2 - 1
src/main/java/com/yihu/ehr/profile/service/ProfileBasicService.java

@ -10,7 +10,8 @@ import org.springframework.util.StringUtils;
import java.util.*;
/**
 * Created by progr1mmer on 2018/5/31.
 * @author progr1mmer
 * @date Created on 2018/5/31.
 */
public abstract class ProfileBasicService {

+ 19 - 10
src/main/java/com/yihu/ehr/profile/service/ProfileCDAService.java

@ -27,7 +27,7 @@ public class ProfileCDAService extends ProfileBasicService {
    /**
     * 根据ProfileId查询CDA分类
     *
     * 因为数据格式的问题,请注意次接口的注意事项
     * 因为数据格式的问题,请注意此接口的注意事项
     * 1.没有子项目的模板用 multi = false,详细数据存放在在data字段,如门诊摘要、住院摘要之类的
     * 2.有子项目的模板用 multi = true,详细数据用列表的形式存放在records字段,如检查报告、检验报告,并用mark字段提供关联的主键信息
     * @param profileId
@ -46,7 +46,8 @@ public class ProfileCDAService extends ProfileBasicService {
        List<Map<String, Object>> result = new ArrayList<>();
        if (dataList.size() > 0) {
            Map<String, Object> event = dataList.get(0);
            if (event.get(ResourceCells.PROFILE_TYPE).equals("0") || event.get(ResourceCells.PROFILE_TYPE).equals("1")) { //profileType = 0 为之前数据存储错误的问题,已更改过来
            //profileType = 0 为之前数据存储错误的问题,已更改过来
            if (event.get(ResourceCells.PROFILE_TYPE).equals("0") || event.get(ResourceCells.PROFILE_TYPE).equals("1")) {
                //根据机构获取定制模板
                List<ArchiveTemplate> list;
                if (StringUtils.isEmpty(templateName)) {
@ -70,7 +71,8 @@ public class ProfileCDAService extends ProfileBasicService {
                        List<Map<String, Object>> data = new ArrayList<>();
                        subList.forEach(item2 -> {
                            Map<String, Object> dataMap = new HashMap<>();
                            String item2Name = (String) item2.get("EHR_002883"); //检查名称
                            //检查名称
                            String item2Name = (String) item2.get("EHR_002883");
                            dataMap.put(ResourceCells.PROFILE_ID, item2.get(ResourceCells.ROWKEY));
                            dataMap.put(ResourceCells.PROFILE_TYPE, event.get(ResourceCells.PROFILE_TYPE));
                            dataMap.put("cda_document_id", item.getCdaDocumentId());
@ -79,7 +81,8 @@ public class ProfileCDAService extends ProfileBasicService {
                            dataMap.put("mobile_template", item.getMobileUrl());
                            dataMap.put("template_id", item.getId());
                            dataMap.put("name", item2Name);
                            dataMap.put("mark", item2.get("EHR_000316")); //检查报告单号
                            //检查报告单号
                            dataMap.put("mark", item2.get("EHR_000316"));
                            data.add(dataMap);
                        });
                        temp.put("template_name", item.getTitle());
@ -93,7 +96,8 @@ public class ProfileCDAService extends ProfileBasicService {
                        List<Map<String, Object>> data = new ArrayList<>();
                        subList.forEach(item2 -> {
                            Map<String, Object> dataMap = new HashMap<>();
                            String item2Name = (String) item2.get("EHR_000352"); //检验项目
                            //检验项目
                            String item2Name = (String) item2.get("EHR_000352");
                            dataMap.put(ResourceCells.PROFILE_ID, item2.get(ResourceCells.ROWKEY));
                            dataMap.put(ResourceCells.PROFILE_TYPE, event.get(ResourceCells.PROFILE_TYPE));
                            dataMap.put("cda_document_id", item.getCdaDocumentId());
@ -102,7 +106,8 @@ public class ProfileCDAService extends ProfileBasicService {
                            dataMap.put("mobile_template", item.getMobileUrl());
                            dataMap.put("template_id", item.getId());
                            dataMap.put("name", item2Name);
                            dataMap.put("mark", item2.get("EHR_000363")); //检验报告单号
                            //检验报告单号
                            dataMap.put("mark", item2.get("EHR_000363"));
                            data.add(dataMap);
                        });
                        temp.put("template_name", item.getTitle());
@ -116,7 +121,8 @@ public class ProfileCDAService extends ProfileBasicService {
                        List<Map<String, Object>> data = new ArrayList<>();
                        subList.forEach(item2 -> {
                            Map<String, Object> dataMap = new HashMap<>();
                            String item2Name = (String) item2.get("EHR_000418"); //手术名称
                            //手术名称
                            String item2Name = (String) item2.get("EHR_000418");
                            dataMap.put(ResourceCells.PROFILE_ID, item2.get(ResourceCells.ROWKEY));
                            dataMap.put(ResourceCells.PROFILE_TYPE, event.get(ResourceCells.PROFILE_TYPE));
                            dataMap.put("cda_document_id", item.getCdaDocumentId());
@ -125,14 +131,16 @@ public class ProfileCDAService extends ProfileBasicService {
                            dataMap.put("mobile_template", item.getMobileUrl());
                            dataMap.put("template_id", item.getId());
                            dataMap.put("name", item2Name);
                            dataMap.put("mark", item2.get("EHR_000423")); //手术申请单号
                            //手术申请单号
                            dataMap.put("mark", item2.get("EHR_000423"));
                            data.add(dataMap);
                        });
                        temp.put("template_name", item.getTitle());
                        temp.put("multi", true);
                        temp.put("data", new HashMap<>());
                        temp.put("records", data);
                    } else if  (item.getTitle().contains("中药")) { //中西药特殊处理
                        //中西药特殊处理
                    } else if  (item.getTitle().contains("中药")) {
                        String subQ = "{\"q\":\"rowkey:" + profileId + "$HDSD00_83$*\"}";
                        Envelop subEnvelop = resource.getSubData(subQ, 1, 1, null);
                        if (subEnvelop.getDetailModelList() != null && subEnvelop.getDetailModelList().size() > 0) {
@ -149,7 +157,8 @@ public class ProfileCDAService extends ProfileBasicService {
                            prescription.add(dataMap);
                        }
                        continue;
                    } else if (item.getTitle().contains("西药")) { //中西药特殊处理
                        //中西药特殊处理
                    } else if (item.getTitle().contains("西药")) {
                        String subQ = "{\"q\":\"rowkey:" + profileId + "$HDSD00_84$*\"}";
                        Envelop subEnvelop = resource.getSubData(subQ, 1, 1, null);
                        if (subEnvelop.getDetailModelList() != null && subEnvelop.getDetailModelList().size() > 0) {

+ 21 - 2
src/main/java/com/yihu/ehr/profile/service/ProfileDiseaseService.java

@ -44,7 +44,8 @@ public class ProfileDiseaseService extends ProfileBasicService {
                        if (!StringUtils.isEmpty(chronicInfo)) {
                            String [] _chronicInfo = chronicInfo.split("-");
                            if (!"0".equals(_chronicInfo[1])) {
                                String healthProblem = redisService.getHpCodeByIcd10(code); //祝金仙
                                //祝金仙
                                String healthProblem = redisService.getHpCodeByIcd10(code);
                                if (!StringUtils.isEmpty(healthProblem)) {
                                    for (String hpCode : healthProblem.split(";")) {
                                        List<Map<String, Object>> profileList = new ArrayList<>();
@ -62,7 +63,9 @@ public class ProfileDiseaseService extends ProfileBasicService {
            });
            for (String hpCode : hpMap.keySet()) {
                Map<String, Object> obj = new HashedMap();
                //健康问题编码
                obj.put("healthProblemCode", hpCode);
                //健康问题名称
                obj.put("healthProblemName", redisService.getHealthProblem(hpCode));
                int visitTimes = 0;
                int hospitalizationTimes = 0;
@ -84,19 +87,30 @@ public class ProfileDiseaseService extends ProfileBasicService {
                    }
                    //第一条
                    if (i == 0) {
                        //最近就诊时间
                        obj.put("lastVisitDate", profile.get(ResourceCells.EVENT_DATE));
                        //最近就诊的机构编码
                        obj.put("lastVisitOrgCode", profile.get(ResourceCells.ORG_CODE));
                        //最近就诊的机构名称
                        obj.put("lastVisitOrg", profile.get(ResourceCells.ORG_NAME));
                        //最近就诊的档案主索引
                        obj.put("lastVisitRecord", profile.get(ResourceCells.ROWKEY));
                        //最近就诊事件
                        obj.put("recentEvent", recentEvent);
                        //最近就诊事件的类型
                        obj.put("eventType", eventType);
                    }
                    //最后一条
                    if (i == profileList.size() - 1) {
                        //病龄
                        obj.put("ageOfDisease", getAgeOfDisease(profile.get(ResourceCells.EVENT_DATE)));
                        //首次就诊的时间
                        obj.put("firstVisitDate", profile.get(ResourceCells.EVENT_DATE));
                        //首次就诊的机构编码
                        obj.put("firstVisitOrgCode", profile.get(ResourceCells.ORG_CODE));
                        //首次就诊的机构名称
                        obj.put("firstVisitOrg", profile.get(ResourceCells.ORG_NAME));
                        //首次就诊的档案索引
                        obj.put("firstVisitRecord", profile.get(ResourceCells.ROWKEY));
                    }
                    //提取并发症
@ -143,9 +157,13 @@ public class ProfileDiseaseService extends ProfileBasicService {
                    data.put("record", profile.get(ResourceCells.ROWKEY));
                    complicationList.add(data);
                });
                //并发症
                obj.put("complication", complicationList);
                //门诊次数
                obj.put("visitTimes", visitTimes);
                //住院次数
                obj.put("hospitalizationTimes", hospitalizationTimes);
                //身份证号码
                obj.put("demographicId", demographicId);
                result.add(obj);
            }
@ -231,7 +249,8 @@ public class ProfileDiseaseService extends ProfileBasicService {
                        String diagnosis = (String) profile.get(ResourceCells.DIAGNOSIS);
                        String [] _diagnosis = diagnosis.split(";");
                        for (String diagnosisCode : _diagnosis) {
                            String healthProblem = redisService.getHpCodeByIcd10(diagnosisCode);//通过ICD10获取健康问题
                            //通过ICD10获取健康问题
                            String healthProblem = redisService.getHpCodeByIcd10(diagnosisCode);
                            if (!StringUtils.isEmpty(healthProblem)) {
                                if (healthProblem.contains(hpCode)) {
                                    if (commonSymptoms.containsKey(diagnosisCode)) {

+ 36 - 18
src/main/java/com/yihu/ehr/profile/service/ProfileEventService.java

@ -70,14 +70,16 @@ public class ProfileEventService extends ProfileBasicService {
                            Map<String, Object> resultMap = simpleEvent(temp, searchParam);
                            if (resultMap != null) {
                                resultMap.put("eventType", blurryType);
                                resultMap.put("mark", subList.get(0).get("EHR_000316")); //检查报告单号
                                //检查报告单号
                                resultMap.put("mark", subList.get(0).get("EHR_000316"));
                                resultList.add(resultMap);
                            }
                        }
                    }
                }
                return resultList;
            } else if ("5".equals(blurryType)) { //检验 examine
                //检验 examine
            } else if ("5".equals(blurryType)) {
                query = SimpleSolrQueryUtil.getQuery(filter, date, query);
                envelop = resource.getMasterData(query, 1, 1000, null);
                List<Map<String, Object>> eventList = envelop.getDetailModelList();
@ -90,17 +92,20 @@ public class ProfileEventService extends ProfileBasicService {
                            Map<String, Object> resultMap = simpleEvent(temp, searchParam);
                            if (resultMap != null) {
                                resultMap.put("eventType", blurryType);
                                resultMap.put("mark", subList.get(0).get("EHR_000363")); //检验报告单号
                                //检验报告单号
                                resultMap.put("mark", subList.get(0).get("EHR_000363"));
                                resultList.add(resultMap);
                            }
                        }
                    }
                }
                return resultList;
            } else if ("6".equals(blurryType)) { //妇幼 immunity
                //妇幼 immunity
            } else if ("6".equals(blurryType)) {
                //query = "{\"q\":\"demographic_id:" + demographicId + " AND EHR_002443:*\"}";
                return resultList;
            } else if ("7".equals(blurryType)){  //免疫 immunity
                //免疫 immunity
            } else if ("7".equals(blurryType)){
                query = SimpleSolrQueryUtil.getQuery(filter, date, query);
                envelop = resource.getMasterData(query, 1, 1000, null);
                List<Map<String, Object>> eventList = envelop.getDetailModelList();
@ -113,7 +118,8 @@ public class ProfileEventService extends ProfileBasicService {
                            Map<String, Object> resultMap = simpleEvent(temp, searchParam);
                            if (resultMap != null) {
                                resultMap.put("eventType", blurryType);
                                resultMap.put("mark", subList.get(0).get("EHR_002438")); //预防接种卡编号
                                //预防接种卡编号
                                resultMap.put("mark", subList.get(0).get("EHR_002438"));
                                resultList.add(resultMap);
                            }
                        }
@ -249,11 +255,14 @@ public class ProfileEventService extends ProfileBasicService {
            resultMap.put("diagnosis", diagnosisList);
            String subQ = "{\"q\":\"profile_id:" + profileId + "\"}";
            Envelop subEnvelop = resource.getSubData(subQ, 1, 1000, null);
            List<Map<String, Object>> subList = subEnvelop.getDetailModelList(); //细表数据
            if (temp.get(ResourceCells.EVENT_TYPE).equals("0")) { //门诊信息
            //细表数据
            List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
            //门诊信息
            if (temp.get(ResourceCells.EVENT_TYPE).equals("0")) {
                resultMap.put("department", temp.get("EHR_000082") == null ? "" : temp.get("EHR_000082") );
                resultMap.put("doctor", temp.get("EHR_000079") == null ? "" : temp.get("EHR_000079"));
                resultMap.put("diagnosticResult", resultMap.get("healthProblemName")); //诊断结果
                //诊断结果
                resultMap.put("diagnosticResult", resultMap.get("healthProblemName"));
                //检查
                List<Map<String, Object>> inspectResult = new ArrayList<>();
                for (Map<String, Object> temp1 : subList) {
@ -261,7 +270,8 @@ public class ProfileEventService extends ProfileBasicService {
                        if (temp1.get("EHR_002883") != null) {
                            Map<String, Object> data = new HashMap<>();
                            data.put("name", temp1.get("EHR_002883"));
                            data.put("mark", temp1.get("EHR_000316")); //检查报告单号
                            //检查报告单号
                            data.put("mark", temp1.get("EHR_000316"));
                            inspectResult.add(data);
                        }
                    }
@ -274,13 +284,15 @@ public class ProfileEventService extends ProfileBasicService {
                        if (temp1.get("EHR_000352") != null) {
                            Map<String, Object> data = new HashMap<>();
                            data.put("name", temp1.get("EHR_000352"));
                            data.put("mark", temp1.get("EHR_000363")); //检验报告单号
                            //检验报告单号
                            data.put("mark", temp1.get("EHR_000363"));
                            examineResult.add(data);
                        }
                    }
                }
                resultMap.put("examineResult", examineResult);
            } else if (temp.get(ResourceCells.EVENT_TYPE).equals("1")) { //住院信息
                //住院信息
            } else if (temp.get(ResourceCells.EVENT_TYPE).equals("1")) {
                String department = "";
                if (!StringUtils.isEmpty(temp.get("EHR_006209"))) {
                    department = (String) temp.get("EHR_006209");
@ -302,8 +314,10 @@ public class ProfileEventService extends ProfileBasicService {
                    }
                }
                resultMap.put("doctor", doctor);
                resultMap.put("inSituation", temp.get("EHR_005203") == null ? "" : temp.get("EHR_005203")); //入院情况
                resultMap.put("outSituation", temp.get("EHR_000154") == null ? "" : temp.get("EHR_000154")); //出院情况
                //入院情况
                resultMap.put("inSituation", temp.get("EHR_005203") == null ? "" : temp.get("EHR_005203"));
                //出院情况
                resultMap.put("outSituation", temp.get("EHR_000154") == null ? "" : temp.get("EHR_000154"));
                String inResult = "";
                String outResult = "";
                for (Map<String, Object> temp1 : subList) {
@ -318,16 +332,20 @@ public class ProfileEventService extends ProfileBasicService {
                        }
                    }
                }
                resultMap.put("inResult", inResult); //入院诊断
                resultMap.put("outResult", outResult); //出院诊断
                //入院诊断
                resultMap.put("inResult", inResult);
                //出院诊断
                resultMap.put("outResult", outResult);
                String treatmentResults = "";
                if (temp.get("EHR_000166_VALUE") != null) {
                    treatmentResults = (String) temp.get("EHR_000166_VALUE");
                } else if (temp.get("EHR_000166") != null) {
                    treatmentResults = (String) temp.get("EHR_000166");
                }
                resultMap.put("treatmentResults", treatmentResults); //治疗结果
                resultMap.put("dischargeInstructions", temp.get("EHR_000157") == null ? "" :  temp.get("EHR_000157")); //出院医嘱
                //治疗结果
                resultMap.put("treatmentResults", treatmentResults);
                //出院医嘱
                resultMap.put("dischargeInstructions", temp.get("EHR_000157") == null ? "" :  temp.get("EHR_000157"));
            }
            return resultMap;
        }

+ 2 - 2
src/main/java/com/yihu/ehr/profile/service/ProfileInfoBaseService.java

@ -124,8 +124,8 @@ public class ProfileInfoBaseService extends BaseJpaService {
                        labels.add("新生儿");
                        //出生身高
                        patientMap.put("height", result.get("EHR_001256") == null ? "" : result.get("EHR_001256"));
                        //出生体重
                        patientMap.put("weight", result.get("EHR_001257") == null ? "" : result.get("EHR_001257")); //单位(g)
                        //出生体重 单位(g)
                        patientMap.put("weight", result.get("EHR_001257") == null ? "" : result.get("EHR_001257"));
                    }
                }
            }

+ 45 - 25
src/main/java/com/yihu/ehr/profile/service/ProfileInspectionService.java

@ -9,11 +9,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Created by progr1mmer on 2018/3/13.
 * @author progr1mmer
 * @date Created on 2018/3/13.
 */
@Service
public class ProfileInspectionService extends ProfileBasicService {
@ -24,11 +23,15 @@ public class ProfileInspectionService extends ProfileBasicService {
        typeMap.put("HDSD00_79", "inspect");
        typeMap.put("HDSD00_77", "examine");
        Map<String, String> nameMap = new HashMap<>();
        nameMap.put("HDSD00_79", "EHR_002883"); //检查名称
        nameMap.put("HDSD00_77", "EHR_000352"); //检验项目
        //检查名称
        nameMap.put("HDSD00_79", "EHR_002883");
        //检验项目
        nameMap.put("HDSD00_77", "EHR_000352");
        Map<String, String> numMap = new HashMap<>();
        numMap.put("HDSD00_79", "EHR_000316"); //检查报告单号
        numMap.put("HDSD00_77", "EHR_000363"); //检验报告单号
        //检查报告单号
        numMap.put("HDSD00_79", "EHR_000316");
        //检验报告单号
        numMap.put("HDSD00_77", "EHR_000363");
        for (String dataset : typeMap.keySet()) {
            String query = "{\"q\":\"demographic_id:" + demographicId + "\"}";
            query = SimpleSolrQueryUtil.getQuery(filter, date, query);
@ -82,9 +85,11 @@ public class ProfileInspectionService extends ProfileBasicService {
                List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
                for (int i = 0; i < subList.size(); i ++) {
                    Map<String, Object> item = subList.get(i);
                    if (!StringUtils.isEmpty(item.get("EHR_002883"))) {  //检查名称
                    //检查名称
                    if (!StringUtils.isEmpty(item.get("EHR_002883"))) {
                        String name = item.get("EHR_002883").toString();
                        String result = item.get("EHR_000347") == null ? "-" : item.get("EHR_000347").toString(); //影像结论
                        //影像结论
                        String result = item.get("EHR_000347") == null ? "-" : item.get("EHR_000347").toString();
                        if (dataMap.containsKey(name)) {
                            Integer count = dataMap.get(name);
                            dataMap.put(name, count + 1);
@ -104,7 +109,8 @@ public class ProfileInspectionService extends ProfileBasicService {
                                }
                            }
                        }
                    } else if (!StringUtils.isEmpty(item.get("EHR_000352"))) { //检验项目
                        //检验项目
                    } else if (!StringUtils.isEmpty(item.get("EHR_000352"))) {
                        String name = item.get("EHR_000352").toString();
                        if (dataMap.containsKey(name)) {
                            Integer count = dataMap.get(name);
@ -151,18 +157,23 @@ public class ProfileInspectionService extends ProfileBasicService {
        List<Map<String, Object>> subList = subData.getDetailModelList();
        if (subList.size() > 0) {
            Map<String, Object> temp = subList.get(0);
            String reportNo = temp.get("EHR_000363").toString(); //检验报告单号
            //检验报告单号
            String reportNo = temp.get("EHR_000363").toString();
            subQ = "{\"q\":\"rowkey:" + profileId.split("\\$")[0] + "$HDSD00_75$*" + "\"}";
            subData = resource.getSubData(subQ, 1, 1000, null);
            List<Map<String, Object>> subItems = subData.getDetailModelList();
            subItems.forEach(item -> {
                if (reportNo.equals(item.get("EHR_006339"))) { //子项所属的报告单号
                //子项所属的报告单号
                if (reportNo.equals(item.get("EHR_006339"))) {
                    //结果值
                    if (item.get("EHR_000387") != null) {
                        String result = item.get("EHR_000387").toString(); //结果值
                        //结果值
                        String result = item.get("EHR_000387").toString();
                        if (item.get("EHR_000391") != null && item.get("EHR_000390")!= null) {
                            String low = item.get("EHR_000391").toString(); //下限
                            String high = item.get("EHR_000390").toString(); //上限
                            //下限
                            String low = item.get("EHR_000391").toString();
                            //上限
                            String high = item.get("EHR_000390").toString();
                            if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
                                Double _result = Double.parseDouble(result);
                                Double _row = Double.parseDouble(low);
@ -207,21 +218,27 @@ public class ProfileInspectionService extends ProfileBasicService {
            Envelop subEnvelop = resource.getSubData(subQ, 1, 1000, null);
            List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
            for (Map<String, Object> subItem : subList) {
                if (name.equals(subItem.get("EHR_000352"))) { //检验项目
                    String reportNo = subItem.get("EHR_000363").toString(); //检验报告单号
                //检验项目
                if (name.equals(subItem.get("EHR_000352"))) {
                    //检验报告单号
                    String reportNo = subItem.get("EHR_000363").toString();
                    subQ = "{\"q\":\"rowkey:" + masterItem.get(ResourceCells.ROWKEY) + "$HDSD00_75$*" + "\"}";
                    subEnvelop = resource.getSubData(subQ, 1, 1000, null);
                    List<Map<String, Object>> subItems = subEnvelop.getDetailModelList();
                    subItems.forEach(item -> {
                        if (reportNo.equals(item.get("EHR_006339"))) { //子项所属的报告单号
                            String itemName = item.get("EHR_000394").toString(); //子项名称
                        //子项所属的报告单号
                        if (reportNo.equals(item.get("EHR_006339"))) {
                            //子项名称
                            String itemName = item.get("EHR_000394").toString();
                            data.add(itemName);
                            //结果值
                            if (item.get("EHR_000387") != null) { //结果值
                            if (item.get("EHR_000387") != null) {
                                String result = item.get("EHR_000387").toString();
                                if (item.get("EHR_000391") != null && item.get("EHR_000390")!= null) {
                                    String low = item.get("EHR_000391").toString(); //上限
                                    String high = item.get("EHR_000390").toString(); //下限
                                    //上限
                                    String low = item.get("EHR_000391").toString();
                                    //下限
                                    String high = item.get("EHR_000390").toString();
                                    if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
                                        Double _result = Double.parseDouble(result);
                                        Double _row = Double.parseDouble(low);
@ -252,11 +269,14 @@ public class ProfileInspectionService extends ProfileBasicService {
                                            unknownMap.put(itemName, 1);
                                        }
                                    }
                                } else if (item.get("EHR_000382") != null) { //参考值备注
                                    //参考值备注
                                } else if (item.get("EHR_000382") != null) {
                                    String range = item.get("EHR_000382").toString();
                                    //上限
                                    if (range.split("-").length == 2) {
                                        String low = range.split("-")[0]; //上限
                                        String high = range.split("-")[1]; //下限
                                        String low = range.split("-")[0];
                                        //下限
                                        String high = range.split("-")[1];
                                        if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
                                            Double _result = Double.parseDouble(result);
                                            Double _row = Double.parseDouble(low);

+ 54 - 27
src/main/java/com/yihu/ehr/profile/service/ProfileMedicationService.java

@ -10,7 +10,8 @@ import org.springframework.util.StringUtils;
import java.util.*;
/**
 * Created by progr1mmer on 2018/3/13.
 * @author progr1mmer
 * @date Created on 2018/3/13.
 */
@Service
public class ProfileMedicationService extends ProfileBasicService {
@ -91,7 +92,8 @@ public class ProfileMedicationService extends ProfileBasicService {
                    if (subList.size() > 0) {
                        for (Map<String, Object> subMap : subList) {
                            if (!StringUtils.isEmpty(subMap.get("EHR_000131"))) {
                                String drugName = subMap.get("EHR_000131") + "_01";  //中药名称
                                //中药名称
                                String drugName = subMap.get("EHR_000131") + "_01";
                                if (dataMap.containsKey(drugName)) {
                                    Integer count = dataMap.get(drugName);
                                    dataMap.put(drugName, count + 1);
@ -101,7 +103,8 @@ public class ProfileMedicationService extends ProfileBasicService {
                                continue;
                            }
                            if (!StringUtils.isEmpty(subMap.get("EHR_000100"))) {
                                String drugName = subMap.get("EHR_000100") + "_02"; //西药名称
                                //西药名称
                                String drugName = subMap.get("EHR_000100") + "_02";
                                if (dataMap.containsKey(drugName)) {
                                    Integer count = dataMap.get(drugName);
                                    dataMap.put(drugName, count + 1);
@ -148,13 +151,16 @@ public class ProfileMedicationService extends ProfileBasicService {
                    List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
                    if (subList.size() > 0) {
                        boolean match = false;
                        String typeMark = "00"; //中西药标识
                        //中西药标识
                        String typeMark = "00";
                        for (Map<String, Object> subMap : subList) {
                            if (subMap.get("EHR_000131") != null) {
                                if (subMap.get(ResourceCells.ROWKEY).toString().contains("HDSD00_83")) {
                                    typeMark = "01"; //中药
                                    //中药
                                    typeMark = "01";
                                } else {
                                    typeMark = "02"; //西药
                                    //西药
                                    typeMark = "02";
                                }
                                if (keyWord != null) {
                                    if (subMap.get("EHR_000131").toString().contains(keyWord)) {
@ -168,9 +174,11 @@ public class ProfileMedicationService extends ProfileBasicService {
                            }
                            if (subMap.get("EHR_000100") != null) {
                                if (subMap.get(ResourceCells.ROWKEY).toString().contains("HDSD00_83")) {
                                    typeMark = "01"; //中药
                                    //中药
                                    typeMark = "01";
                                } else {
                                    typeMark = "02"; //西药
                                    //西药
                                    typeMark = "02";
                                }
                                if (keyWord != null && subMap.get("EHR_000100") != null) {
                                    if (subMap.get("EHR_000100").toString().contains(keyWord)) {
@ -187,10 +195,12 @@ public class ProfileMedicationService extends ProfileBasicService {
                            //时间轴基本字段
                            Map<String, Object> resultMap = simpleEvent(masterMap, null);
                            resultMap.put("mark", typeMark);
                            if (masterMap.get(ResourceCells.EVENT_TYPE).equals("0")) { //门诊信息
                            //门诊信息
                            if (masterMap.get(ResourceCells.EVENT_TYPE).equals("0")) {
                                resultMap.put("department", masterMap.get("EHR_000082"));
                                resultMap.put("doctor", masterMap.get("EHR_000079"));
                            } else if (masterMap.get(ResourceCells.EVENT_TYPE).equals("1")) { //住院信息
                                //住院信息
                            } else if (masterMap.get(ResourceCells.EVENT_TYPE).equals("1")) {
                                resultMap.put("department", masterMap.get("EHR_000229"));
                                resultMap.put("doctor", masterMap.get("EHR_005072"));
                            }
@ -219,30 +229,47 @@ public class ProfileMedicationService extends ProfileBasicService {
            if (subList.size() > 0) {
                for (Map<String, Object> subMap : subList) {
                    Map<String, Object> dataMap = new HashMap<>();
                    dataMap.put("prescriptionNumber", subMap.get("EHR_000086") == null ? "" : subMap.get("EHR_000086") ); //处方编号
                    dataMap.put("substancesForDrugUse", subMap.get("EHR_000101") == null ? "" : subMap.get("EHR_000101")); //药物使用次剂量
                    dataMap.put("prescriptionDrugGroupNumber", subMap.get("EHR_000127") == null ? "" : subMap.get("EHR_000127")); //处方药品组号
                    dataMap.put("drugSpecifications", subMap.get("EHR_000129") == null ? "" : subMap.get("EHR_000129")); //药物规格
                    dataMap.put("drugFormulationCode", subMap.get("EHR_000130") == null ? "" : subMap.get("EHR_000130")); //药物剂型代码
                    dataMap.put("drugFormulationValue", subMap.get("EHR_000130_VALUE") == null ? "" : subMap.get("EHR_000130_VALUE")); //药物剂型值
                    //处方编号
                    dataMap.put("prescriptionNumber", subMap.get("EHR_000086") == null ? "" : subMap.get("EHR_000086") );
                    //药物使用次剂量
                    dataMap.put("substancesForDrugUse", subMap.get("EHR_000101") == null ? "" : subMap.get("EHR_000101"));
                    //处方药品组号
                    dataMap.put("prescriptionDrugGroupNumber", subMap.get("EHR_000127") == null ? "" : subMap.get("EHR_000127"));
                    //药物规格
                    dataMap.put("drugSpecifications", subMap.get("EHR_000129") == null ? "" : subMap.get("EHR_000129"));
                    //药物剂型代码
                    dataMap.put("drugFormulationCode", subMap.get("EHR_000130") == null ? "" : subMap.get("EHR_000130"));
                    //药物剂型值
                    dataMap.put("drugFormulationValue", subMap.get("EHR_000130_VALUE") == null ? "" : subMap.get("EHR_000130_VALUE"));
                    String drugName = "";
                    if (!StringUtils.isEmpty(subMap.get("EHR_000100"))) {
                        drugName = (String) subMap.get("EHR_000100");
                    } else if (!StringUtils.isEmpty(subMap.get("EHR_000131"))) {
                        drugName = (String) subMap.get("EHR_000131");
                    }
                    dataMap.put("drugName", drugName); //药物名称
                    dataMap.put("drugsUseDosageUnits", subMap.get("EHR_000133") == null ? "" :  subMap.get("EHR_000133")); //药物使用剂量单位
                    dataMap.put("drugUsageFrequencyCode", subMap.get("EHR_000134") == null ? "" : subMap.get("EHR_000134")); //药物使用频次代码
                    dataMap.put("drugUsageFrequencyValue", subMap.get("EHR_000134_VALUE") == null ? "" :  subMap.get("EHR_000134_VALUE")); //药物使用频次值
                    dataMap.put("totalDoseOfDrugUsed", subMap.get("EHR_000135") == null ? "" : subMap.get("EHR_000135")); //药物使用总剂量
                    dataMap.put("medicationRouteCode", subMap.get("EHR_000136") == null ? "" : subMap.get("EHR_000136")); //用药途径代码
                    dataMap.put("medicationRouteValue", subMap.get("EHR_000136_VALUE") == null ? "" : subMap.get("EHR_000136_VALUE")); //用药途径值
                    //药物名称
                    dataMap.put("drugName", drugName);
                    //药物使用剂量单位
                    dataMap.put("drugsUseDosageUnits", subMap.get("EHR_000133") == null ? "" :  subMap.get("EHR_000133"));
                    //药物使用频次代码
                    dataMap.put("drugUsageFrequencyCode", subMap.get("EHR_000134") == null ? "" : subMap.get("EHR_000134"));
                    //药物使用频次值
                    dataMap.put("drugUsageFrequencyValue", subMap.get("EHR_000134_VALUE") == null ? "" :  subMap.get("EHR_000134_VALUE"));
                    //药物使用总剂量
                    dataMap.put("totalDoseOfDrugUsed", subMap.get("EHR_000135") == null ? "" : subMap.get("EHR_000135"));
                    //用药途径代码
                    dataMap.put("medicationRouteCode", subMap.get("EHR_000136") == null ? "" : subMap.get("EHR_000136"));
                    //用药途径值
                    dataMap.put("medicationRouteValue", subMap.get("EHR_000136_VALUE") == null ? "" : subMap.get("EHR_000136_VALUE"));
                    String dataSetCode = String.valueOf(subMap.get("rowkey")).split("\\$")[1];
                    if ("HDSD00_84".equals(dataSetCode)) { //西药
                        dataMap.put("drugUseTotalDoseUnit", subMap.get("EHR_001249") == null ? "" : subMap.get("EHR_001249")); //药物使用总剂量单位
                    } else { //中药
                        dataMap.put("drugUseTotalDoseUnit", subMap.get("EHR_001250") == null ? "" : subMap.get("EHR_001250")); //药物使用总剂量单位
                    //西药
                    if ("HDSD00_84".equals(dataSetCode)) {
                        //药物使用总剂量单位
                        dataMap.put("drugUseTotalDoseUnit", subMap.get("EHR_001249") == null ? "" : subMap.get("EHR_001249"));
                        //中药
                    } else {
                        //药物使用总剂量单位
                        dataMap.put("drugUseTotalDoseUnit", subMap.get("EHR_001250") == null ? "" : subMap.get("EHR_001250"));
                    }
                    dataList.add(dataMap);
                }