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

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 com.lantone.qc.pub.model.doc.transferrecord.TransferOutDoc;
import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
import com.lantone.qc.pub.util.ListUtil;
import org.springframework.stereotype.Component;

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

/**
 * @author wangfeng
 * @Description: 转出记录无患方签名
 * @date 2020-06-30 13:29
 */
@Component
public class DUT03009 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        TransferRecordDoc transferRecordDoc = inputInfo.getTransferRecordDocs();
        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
        if (transferRecordDoc == null || ListUtil.isEmpty(threeLevelWardDocs)) {
            return;
        }
        List<TransferOutDoc> transferOutDocs = transferRecordDoc.getTransferOutDocs();
        if(transferOutDocs!=null&& ListUtil.isNotEmpty(transferOutDocs)){
            for(TransferOutDoc ts :transferOutDocs){
                Map<String, String> structureMap = ts.getStructureMap();
                if(structureMap!=null){
                    String patients = structureMap.get("患者签字");
                    if(patients==null||patients.equals("")){
                        status.set("-1");
                        return;
                    }
                }

            }
        }
    }

}
