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

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.DeathRecordDoc;
import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
import com.lantone.qc.pub.model.label.DiagLabel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

/**
 * @Description: 出院记录内容缺出院(死亡)诊断
 * @author: rengb
 * @time: 2020/3/10 13:53
 */
@Component
public class LEA0154 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) {
            DiagLabel leaveDiagLabel = leaveHospitalDoc.getLeaveDiagLabel();
            if (leaveDiagLabel != null) {
                if (StringUtils.isBlank(leaveDiagLabel.getText())) {
                    status.set("-1");
                }
            }
        }
    }
}