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

import com.lantone.qc.kernel.catalogue.QCCatalogue;
import com.lantone.qc.kernel.util.RedisUtil;
import com.lantone.qc.kernel.util.SpringContextUtil;
import com.lantone.qc.pub.model.InputInfo;
import com.lantone.qc.pub.model.OutputInfo;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName : THR0094
 * @Description :  首次病程由非执业医师填写
 * @Author : Mark
 * @Date: 2020-04-07 17:06
 */
@Component
public class THR0094 extends QCCatalogue {
    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
        status.set("0");

        String sign = inputInfo.getFirstCourseRecordDoc().getStructureMap().get("记录医师");
        sign = (null==sign)?"":sign.trim();

        if(sign.length() > 0 || true) {
            RedisUtil redisUtil = SpringContextUtil.getBean("redisUtil");
            int cnt = 0;

            Map<String, String> surgeon;

            if (null != redisUtil.get(sign)) {
                surgeon = (Map)redisUtil.get(sign);
                String prof = surgeon.get("职称").trim();
                if (null != prof && prof.contains("医师")) {
                    cnt += 1;
                }
            }

            if (cnt == 0) {
                status.set("-1");
            }
        }
    }
}