<?php

namespace Application\Service\Extension\CheckLogic;

use Application\Service\Extension\Helper\StringHelper;

class AeContentProvider extends BaseContentProvider
{
    public function get()
    {
        $condition = [
            'id' => $this->getMultiId(),
            'is_del' => 0
        ];

        $contentData = $this->getContent('itemPatientAeContent', $condition);
        $val = CheckLogicApplication::formatVal($this->getFieldType(), $this->getVal($contentData, $this->getFieldId()));

        CheckLogicApplication::debugPrint("字段名称: {$this->getFieldData()['name']}");
        CheckLogicApplication::debugPrint("字段类型: {$this->getFieldType()}");
        CheckLogicApplication::debugPrint("原始数据: {$this->getVal($contentData, $this->getFieldId())}");
        CheckLogicApplication::debugPrint("转换后数据: {$val}");

        // 填写了表单, 但是是空值, 并且不跳过空值的异常处理
        if ($val === '' && $this->isSkipEmptyException === false) {
            throw new NotWriteCheckTimeException('表单填写了, 但值为空。');
        }

        return $val;
    }
}