package thyyxxk.webserver.entity.zhuyuanyisheng.emrcontrolrule;

import lombok.Data;

@Data
public class EmrRuleV2 {
    /**
     * 质控名称
     */
    private String name;
    /**
     * 质控时间
     */
    private Integer prescription = 24;

    /**
     * 来源时间的sql
     */
    private String timeSource;

    /**
     * 创建时间的sql
     */
    private String executionSource;

    /**
     * 超时未写
     */
    private String timeoutNotWritten;

    /**
     * 超时完成
     */
    private String timeoutComplete;


    public String getTimeSource(String patNo, Integer times) {
        return replaceTheInformation(this.timeSource, patNo, times);
    }

    public String getExecutionSource(String patNo, Integer times) {
        return replaceTheInformation(this.executionSource, patNo, times);
    }


    public String replaceTheInformation(String source, String patNo, Integer times) {
        return source.replace("${pat_no}", "'" + patNo + "'")
                .replace("${times}", times.toString());
    }


}
