package com.lantone.qc.kernel.catalogue.threelevelward;

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
import com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

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

/**
 * @ClassName : THR0700
 * @Description : 最后一次查房记录缺“上级医师”
 * @Author : 胡敬
 * @Date: 2020-03-19 17:20
 */
@Component
public class THR0700 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
            List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
            if (allDoctorWradDocs.size() == 0) {
                status.set("0");
                return;
            }
            ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
            Map<String, String> structureMap = lastWardDoc.getStructureMap();
            String recordTitle = structureMap.get("查房标题");
            String conditionRecord = structureMap.get("病情记录");
            if (StringUtil.isBlank(recordTitle) || StringUtil.isBlank(conditionRecord)) {
                status.set("0");
                return;
            }
            if (recordTitle.contains("主治")
                    || recordTitle.contains("主任")
                    || recordTitle.contains("主刀")) {
                status.set("0");
            } else if (conditionRecord.contains("上级医师")) {
                status.set("0");
            }
        }
    }
}