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

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 org.springframework.stereotype.Component;

/**
 * @author 王宇
 * @create 2020-05-09 10:12
 * @desc 患者拒绝治疗，缺少相关告知书
 **/
@Component
public class MEDI02882 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        Boolean ref = false;
        if(inputInfo.getBeHospitalizedDoc().getText().contains("拒绝")){//入院记录是否有拒绝
            ref = true;
        }
        if(inputInfo.getLeaveHospitalDoc().getText().contains("拒绝")){//出院记录是否有拒绝
            ref = true;
        }
        for (ThreeLevelWardDoc threeLevelWardDoc : inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs()) {//查房记录是否有拒绝
            if(threeLevelWardDoc.getStructureMap().get("病情记录").contains("拒绝")){
                ref = true;
            }
        }
        if(inputInfo.getFirstCourseRecordDoc().getText().contains("拒绝")){//首次病程是否有拒绝
            ref = true;
        }
        if(ref){
            for (String notice: inputInfo.getNoticeOfConversationDoc().getAllNoticeOfConverstartion()) {
                if(!notice.contains("拒绝")){
                    status.set("-1");
                }
            }
        }
    }
}
