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

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

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

/**
 * @ClassName : THR0601
 * @Description : 整份病历无主治医师查房记录
 * @Author : 胡敬
 * @Date: 2020-03-25 10:21
 */
@Component
public class THR0601 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getThreeLevelWardDocs().size() == 0) {
            return;
        }
        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();//查房记录
        String title;
        boolean findIndications = false;
        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
            Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
            title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
            if (!CatalogueUtil.isEmpty(title) && title.contains(Content.attend)) {
                findIndications = true;
                break;
            }
        }
        if (!findIndications) {
            status.set("-1");
        }
    }
}