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

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

import java.util.Map;

/**
 * @ClassName : DEAR0337
 * @Description : 死亡记录未在患者离院前完成
 * @Author : 楼辉荣
 * @Date: 2020-03-06 17:28
 */
@Component
public class DEAR0337 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");
        if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null
                && inputInfo.getLeaveHospitalDoc() != null && inputInfo.getLeaveHospitalDoc().getStructureMap() != null) {
            Map<String, String> deathRecordStructure = inputInfo.getDeathRecordDoc().getStructureMap();
            Map<String, String> leaveHospitalStructure = inputInfo.getLeaveHospitalDoc().getStructureMap();
            String recordTime = deathRecordStructure.get("记录时间");
            String signTime = leaveHospitalStructure.get("签名时间");
            //如果死亡记录时间比出院小结签名时间晚
            if(CatalogueUtil.compareDate(recordTime,signTime,-1)){
                status.set("-1");
            }
        }
    }
}