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.ward.AttendingDoctorWardDoc;
import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
import com.lantone.qc.pub.util.StringUtil;
import org.springframework.stereotype.Component;

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

/**
 * @ClassName : THR0130
 * @Description : 上级医师（主治医师）首次查房对病史、查体无补充
 * @Author : 胡敬
 * @Date: 2020-03-23 14:16
 */
@Component
public class THR0130 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        if (inputInfo.getThreeLevelWardDocs().size() == 0) {
            status.set("0");
            return;
        }
        List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
        if (attendDocs.size() == 0) {
            status.set("0");
            return;
        }
        AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
        //先取结构化数据判断
        Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
        if (StringUtil.isNotBlank(firstAttendStructureMap.get("体检"))) {
            status.set("0");
            return;
        }
        ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
        if (firstAttendLabel == null) {
            return;
        }

        if (firstAttendLabel.getClinicals().size() != 0 || firstAttendLabel.getSigns().size() != 0) {
            status.set("0");
        }
    }
}