package com.lantone.qc.trans.changx;

import com.google.common.collect.Lists;
import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
import com.lantone.qc.pub.model.vo.MedrecVo;
import com.lantone.qc.trans.ModelDocTrans;
import com.lantone.qc.trans.changx.util.CxXmlUtil;
import com.lantone.qc.trans.comsis.ModelDocGenerate;
import com.lantone.qc.trans.comsis.OrdinaryAssistant;

import java.util.List;
import java.util.Map;

/**
 * @Description: 入院记录文档生成
 * @author: rengb
 * @time: 2020/3/5 15:47
 */
public class ChangxBeHospitalizedDocTrans extends ModelDocTrans {

    @Override
    public BeHospitalizedDoc extract(MedrecVo medrecVo) {
        String content = ((List<String>) medrecVo.getContent().get("content")).get(0);
        Map<String, String> sourceMap = CxXmlUtil.firstLevelNodeValue("//DocObjContent", content);
        String tgjc = sourceMap.get("一般情况") + "。"
                + sourceMap.get("皮肤情况") + "。"
                + sourceMap.get("淋巴") + "。"
                + sourceMap.get("头部检查") + "。"
                + sourceMap.get("颈部") + "。"
                + sourceMap.get("胸部检查") + "。"
                + sourceMap.get("肺部检查") + "。"
                + sourceMap.get("心脏检查") + "。"
                + sourceMap.get("血管") + "。"
                + sourceMap.get("腹部检查") + "。"
                + sourceMap.get("外生殖器") + "。"
                + sourceMap.get("直肠肛门") + "。"
                + sourceMap.get("四肢脊柱检查") + "。"
                + sourceMap.get("神经系统检查") + "。"
                + sourceMap.get("其他说明") + "。";
        sourceMap.put("体格检查（二）", tgjc);
        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
        BeHospitalizedDoc beHospitalizedDoc = ModelDocGenerate.beHospitalizedDocGen(structureMap);
        beHospitalizedDoc.setText(content);
        beHospitalizedDoc.setPageData((Map) sourceMap);
        return beHospitalizedDoc;
    }

    private List<String> keyContrasts = Lists.newArrayList(
            "姓名++++患者姓名=姓名",
            "性别=",
            "病区++++病区名称=",
            "床号=",
            "病案号++++住院号=",
            "病人姓名++++患者姓名=",
            "职业=",
            "工作单位++++工作单位地址=",
            "年龄=",
            "出生地++++出生地（住院）=出生地",
            "出生日期=",
            "户口地址=",
            "婚姻状况++++婚姻=婚姻",
            "联系电话=电话",
            "民族=",
            "入院日期=",
            "供史者++++病史叙述者=病史陈述者",
            "记录日期=",
            "主诉=",
            "现病史=",
            "既往史=",
            "目前使用的药物=",
            "成瘾药物=",
            "个人史=",
            "月经史=",
            "婚育史:=婚育史",
            "家族史=",
            "辅助检查=",
            "体重指数++++体重指数（BMI）=",
            "++++复选框=",
            "营养风险评分=",
            "请营养科会诊=",
            "ADL评分分级=",
            "康复科会诊++++康复科会诊1=",
            "康复科会诊++++康复科会诊2=",
            "++++心理评估1=",
            "++++心理评估2=",
            "++++心理卫生科会诊1=",
            "++++心理卫生科会诊2=",
            "Caprini评估++++=",
            "出血风险=",
            "初步诊断=",
            "需求评估=",
            "预期目标=",
            "诊疗计划=",
            "治疗监测计划=",
            "签名++++=",
            "签名时间=",
            "补充诊断=",
            "修正诊断=",
            "签名时间++++补充诊断签名时间=",
            "签名时间++++修正签名时间=",
            "一般情况=",
            "皮肤情况=",
            "淋巴=",
            "头部检查=",
            "颈部=",
            "胸部检查=",
            "肺部检查=",
            "心脏检查=",
            "血管=",
            "腹部检查=",
            "外生殖器++++外生殖器文本框=",
            "直肠肛门=",
            "四肢脊柱检查=",
            "神经系统检查=",
            "其他说明=",
            "体格检查=",
            "体格检查（二）=专科体格检查",
            "++++复选框10=",
            "小计++++=",
            "++++复选框11=",
            "其他风险因素=",
            "++++复选框8=",
            "类型++++VTE类型=",
            "++++复选框9=",
            "++++无需VTE预防=",
            "其他++++抗凝药物禁忌其他=",
            "++++物理预防复选框=",
            "其他++++物理预防其他="
    );

}