<?php

namespace Application\Service\Extension\Helper;

use Application\Service\Extension\Laminas;

class SyncPatientHelper
{
    public const SYNC_PATIENT = 'sync:patient';

    /**
     * 设置受试者同步状态
     * @param int $patientId
     * @return bool
     */
    public static function setIsSync(int $patientId): bool
    {
        return (bool)Laminas::$serviceManager->redisExtend->getRedisInstance()->setBit(self::SYNC_PATIENT, $patientId, 1);
    }

    /**
     * 受试者是否已同步
     * @param int $patientId
     * @return bool
     */
    public static function getIsSync(int $patientId): bool
    {
        return (bool)Laminas::$serviceManager->redisExtend->getRedisInstance()->getBit(self::SYNC_PATIENT, $patientId);
    }
}
