<?php
/**
 *
 * @author：llbjj
 * @DateTime：2022/5/6 10:57
 * @Description：
 *
 */

namespace Application\Service\DB\Item;

use Interop\Container\ContainerInterface;

class Signatorypatient extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        $this->tableName = 'yikeen_signatory_patient';
        parent::__construct($dbAdapter, $container);
    }

    /**
     * Notes: 根据受试者id获取对应研究医生的联系我配置id
     * User: llbjj
     * DateTime: 2022/9/9 9:41
     *
     * @param int $patient_id
     * @return \phpDocumentor\Reflection\Types\Mixed|string|void|null
     */
    public function patientId_to_contactWayId(int $patient_id) {
        $signatory_user_id = $this->getOneFieldVal('signatory_user_id', [
            'is_del' => 0,
            'patient_id' => $patient_id,
        ]);
        if(empty($signatory_user_id)) return '';

        return $this->LocalService()->signatoryUser->getOneFieldVal('contact_way_id', [
            'id' => $signatory_user_id,
            'is_del' => 0,
            'status' => 0,
        ]);
    }

}