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

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

import java.util.Map;

/**
 * @Description: 出院记录无健康教育
 * @author: 胡敬
 * @time: 2020/3/27 15:44
 */
@Component
public class LEA0515 extends QCCatalogue {
    @Override
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
        if (leaveHospitalDoc == null) {
            return;
        }
        DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
        if (deathRecordDoc == null || deathRecordDoc.getText() == null) {
            Map<String, String> leaveHospitalStructureMap = leaveHospitalDoc.getStructureMap();
            if (leaveHospitalStructureMap != null) {
                if (!CatalogueUtil.isEmpty(leaveHospitalStructureMap.get("健康教育"))) {
                    status.set("0");
                    return;
                }
                //邵逸夫其他指导即健康教育
                if (!CatalogueUtil.isEmpty(leaveHospitalStructureMap.get("其他指导"))) {
                    status.set("0");
                    return;
                }
                status.set("-1");
            }
        }
    }
}