これらは私のテーブルです。procedure_fkフィルターを使用して、最新のリビジョンの更新日時と最も古いリビジョンの日時をpostgresで見つける必要があります
事前に感謝します
CREATE TABLE "study" (
"pk" SERIAL PRIMARY KEY,
"procedure_runtime_fk" BIGINT,
"patient_fk" BIGINT,
"modality_infra_fk" BIGINT,
"priority_fk" BIGINT,
"status_fk" BIGINT,
"pacs_server_fk" BIGINT,
"study_iuid" VARCHAR(1024) UNIQUE,
"study_datetime" TIMESTAMP,
"accession_no" VARCHAR(128),
"study_desc" TEXT,
"mods_in_study" TEXT,
"num_series" BIGINT,
"num_instances" BIGINT,
"availibility" VARCHAR(32),
"ref_physician" VARCHAR(255),
"create_datetime" TIMESTAMP,
"childs" TEXT
);
CREATE TABLE "procedure_runtime_information" (
"pk" SERIAL PRIMARY KEY,
"patient_fk" BIGINT,
"patient_visit_fk" BIGINT,
"procedure_fk" BIGINT,
"procedure_performed_datetime" TIMESTAMP,
"author_fk" BIGINT,
"creation_datetime" TIMESTAMP,
"procedure_actual_duration" BIGINT,
"procedure_indications" TEXT DEFAULT NULL,
"pre_procedure_info" TEXT DEFAULT NULL,
"procedure_description" TEXT DEFAULT NULL,
"procedure_exposure" TEXT DEFAULT NULL,
"procedure_skindose" TEXT DEFAULT NULL,
"ref_phys_fk" BIGINT DEFAULT NULL,
"object_type" BIGINT DEFAULT NULL,
"priority_fk" BIGINT DEFAULT NULL,
"procedure_id" VARCHAR(256) DEFAULT NULL,
"patient_arrival_datetime" TIMESTAMP,
"procedure_start_datetime" TIMESTAMP
);
CREATE TABLE "report_history" (
"pk" SERIAL PRIMARY KEY,
"revision" BIGINT,
"report_fk" BIGINT,
"old_status_fk" BIGINT,
"updatedby_fk" BIGINT,
"updated_datetime" TIMESTAMP,
"file_path" TEXT,
"synopsis" TEXT
);
CREATE TABLE "report" (
"pk" SERIAL PRIMARY KEY,
"report_uuid" VARCHAR(32) UNIQUE,
"study_fk" BIGINT,
"status_fk" BIGINT,
"priority_fk" BIGINT,
"report_relative_path" VARCHAR(256),
"report_type_fk" BIGINT,
"createdby_fk" BIGINT,
"created_datetime" TIMESTAMP
);