-- =============================================
-- Author:  Ramil M. Enaliev
-- Create date: 2011/05/17
-- Description: Процедура заполнения вспомогательных полей пациента.
-- =============================================
DROP PROCEDURE IF EXISTS public.sp_completepatient;
DROP PROCEDURE IF EXISTS akuz.sp_completepatient;

CREATE OR REPLACE PROCEDURE akuz.sp_completepatient(
    patientid uuid
)
    LANGUAGE plpgsql
AS
$$
DECLARE
    p_patientid uuid := patientid;
BEGIN
    UPDATE akuz.t_patient t
    SET omspolicymapped = dbo.fn_getomspolicy(t.patientid, NULL)
    WHERE t.patientid = p_patientid;
END;
$$;