--
-- PostgreSQL database dump
--

-- Dumped from database version 17.2 (Debian 17.2-1.pgdg120+1)
-- Dumped by pg_dump version 17.2

-- Started on 2024-12-26 07:33:41 UTC

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 3657 (class 1262 OID 16384)
-- Name: spacs; Type: DATABASE; Schema: -; Owner: spacs
--

CREATE DATABASE spacs WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.utf8';


ALTER DATABASE spacs OWNER TO spacs;

\connect spacs

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 5 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: spacs
--

CREATE SCHEMA public;


ALTER SCHEMA public OWNER TO spacs;

--
-- TOC entry 3658 (class 0 OID 0)
-- Dependencies: 5
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: spacs
--

COMMENT ON SCHEMA public IS 'standard public schema';


--
-- TOC entry 266 (class 1255 OID 40546)
-- Name: addtestmodalityworklist(integer); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.addtestmodalityworklist(naddtestcount integer) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 index_mwl integer := 0;
 index_test_count integer := 0;
 i integer := 0;
 strPatientID text := '';
 strPatientName text := '';
 strPatientOtherName text := '';
 strPatientSex text := '';
 strPatientBirthDate text := '';
 strPatientWeight text := '';
 strModality text := ''; 
BEGIN

  i := 0;
  index_test_count := 0;
  LOOP
    EXIT WHEN i = nAddTestCount;

	SELECT format('pid%s', i+1) into strPatientID;
	SELECT format('테스트%s', i+1) into strPatientName;
	SELECT format('테스트다른이름%s', i+1) into strPatientOtherName;
	
	SELECT format('%s', 19990101+i) into strPatientBirthDate;
	SELECT format('%sKg', 20+i) into strPatientWeight;

	IF i%2 = 0 THEN
	  SELECT format('ES') into strModality;
	  SELECT format('M') into strPatientSex;
	ELSE
	  SELECT format('DX') into strModality;
	  SELECT format('F') into strPatientSex;
	END IF;
	
	select index from public.FindOrAddModalityWorklist(strPatientID, strPatientName, strPatientOtherName, strPatientSex,
								strPatientBirthDate, '', '', 'L', strPatientWeight,
								'Patient Comments', 'Students', 'Asian',

								strModality,
	
								'', 'StudyDescription', '',
	
								'', '', '',
								'', '', 
								'', '') as x(index int) INTO index_mwl;
	IF index_mwl > 0 THEN
	  SELECT index_test_count+1 INTO index_test_count;
	END IF;
        
    SELECT i+1 INTO i;
  END LOOP;

  select index_test_count into rec;
  --SELECT I INTO REC;
  return next rec;
END $$;


ALTER FUNCTION public.addtestmodalityworklist(naddtestcount integer) OWNER TO spacs;

--
-- TOC entry 262 (class 1255 OID 40545)
-- Name: findoraddimage(text, text, integer, integer, integer, integer, text, text, integer); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddimage(strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text, nseriesindex integer) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 strCheckAcquisitionDate text := '';
 strCheckAcquisitionTime text := '';
BEGIN

  IF LENGTH(strAcquisitionDate)=0 THEN
    select to_char(now(), 'YYYYMMDD') into strCheckAcquisitionDate;
  ELSE
    select strAcquisitionDate into strCheckAcquisitionDate;
  END IF;

  IF LENGTH(strAcquisitionTime)=0 THEN
    select to_char(now(), 'HH24MISS') into strCheckAcquisitionTime;
  ELSE
    select strAcquisitionTime into strCheckAcquisitionTime;
  END IF;

  select count(*) from public.SPACS_Series where index=nSeriesIndex into count_series;
  IF count_series < 1 THEN
  	select -2 into rec;
  ELSE

    select count(*) from public.SPACS_Image where sop_instance_uid=strSOPInstanceUID into count_image;
    IF count_image > 0 THEN
      select index from public.SPACS_Image where sop_instance_uid=strSOPInstanceUID into rec;
    ELSE

      insert into public.SPACS_Image (sop_instance_uid, file_location, image_number, window_width, window_center,
	  								   acquisition_number, acquisition_date, acquisition_time, series_index, series_instance_uid, modality)
									select strSOPInstanceUID, strFileLocation, nImageNumber, nWindowWidth, nWindowCenter, nAcquisitionNumber,
									strCheckAcquisitionDate, strCheckAcquisitionTime, nSeriesIndex, series_instance_uid, modality from public.SPACS_Series as t1 where t1.index=nSeriesIndex;

	  select count(*) from public.SPACS_Image where sop_instance_uid=strSOPInstanceUID into count_image;
	  IF count_image > 0 THEN
        select index from public.SPACS_Image where sop_instance_uid=strSOPInstanceUID into rec;
      ELSE
        select -1 into rec;
	  END IF;
    END IF;

  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddimage(strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text, nseriesindex integer) OWNER TO spacs;

--
-- TOC entry 255 (class 1255 OID 21259)
-- Name: findoraddinstance(text, text, integer, integer, integer, integer, text, text, text, text, text, text, text, integer, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddinstance(strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 acq_date text := '';
 acq_time text := '';

 nPatientIndex integer := 0;
 nStudyIndex integer := 0;
 nSeriesIndex integer := 0;
 nInstanceIndex integer := 0;
BEGIN

  select index from public.FindOrAddPatient(strPatientID, strPatientName, strOtherPatientName,
												strPatientSex, strPatientBirthDate, strPatientBirthTime,
												strPatientSize, strPatientWeight, strOccupation, strEthnicGroup) into nPatientIndex;

  select COALESCE(nPatientIndex, -1) into nPatientIndex;
  IF nPatientIndex < 0 THEN
  	select nPatientIndex into rec;
	return next rec;
  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddinstance(strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text) OWNER TO spacs;

--
-- TOC entry 256 (class 1255 OID 21260)
-- Name: findoraddinstance_v2(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddinstance_v2(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 acq_date text := '';
 acq_time text := '';

 nPatientIndex integer := 0;
 nStudyIndex integer := 0;
 nSeriesIndex integer := 0;
 nInstanceIndex integer := 0;
BEGIN
  select index from public.FindOrAddPatient(strPatientID, strPatientName, strOtherPatientName, strPatientSex,
  											strPatientBirthDate, strPatientBirthTime, strPatientSize, strPatientWeight,
											strOccupation, strEthnicGroup) as x(index int) into nPatientIndex;

  select COALESCE(nPatientIndex, -1) into nPatientIndex;
  select nPatientIndex into rec;
  IF nPatientIndex < 0 THEN
  	return next rect;
  END IF;


  select index from public.FindOrAddStudy(strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
												strStudyID, strStudyDate, strStudyTime, strNameOfPhysiciansReadingStudy,
												strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel,
												strSpecificCharacterSet, strIssuerOfPatientID, strSOPClassUID,
												strPatientAge, strAdmittingDiagnosesDescription) as x(index int) into nStudyIndex;

  select COALESCE(nStudyIndex, -2) into nStudyIndex;
  select nStudyIndex into rec;
  IF nStudyIndex < 0 THEN
    return next rect;
  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddinstance_v2(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text) OWNER TO spacs;

--
-- TOC entry 258 (class 1255 OID 22395)
-- Name: findoraddinstance_v3(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, integer, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddinstance_v3(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 acq_date text := '';
 acq_time text := '';

 nPatientIndex integer := 0;
 nStudyIndex integer := 0;
 nSeriesIndex integer := 0;
 nInstanceIndex integer := 0;
BEGIN
  select index from public.FindOrAddPatient(strPatientID, strPatientName, strOtherPatientName, strPatientSex,
  											strPatientBirthDate, strPatientBirthTime, strPatientSize, strPatientWeight,
											strOccupation, strEthnicGroup) as x(index int) into nPatientIndex;

  select COALESCE(nPatientIndex, -1) into nPatientIndex;
  select nPatientIndex into rec;
  IF nPatientIndex < 0 THEN
  	return next rect;
  END IF;


  select index from public.FindOrAddStudy(strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
												strStudyID, strStudyDate, strStudyTime, strNameOfPhysiciansReadingStudy,
												strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel,
												strSpecificCharacterSet, strIssuerOfPatientID, strSOPClassUID,
												strPatientAge, strAdmittingDiagnosesDescription) as x(index int) into nStudyIndex;

  select COALESCE(nStudyIndex, -2) into nStudyIndex;
  select nStudyIndex into rec;
  IF nStudyIndex < 0 THEN
    return next rect;
  END IF;

  select index from public.FindOrAddSeries(strSeriesInstanceUID, strSeriesDescription, nStudyIndex, strProcedureDescription,
													strSeriesDate, strSeriesTime, nSeriesNumber, strProtocolName,
													strOperatorsName, strPerformingPhysicianName, strModality) as x(index int) into nSeriesIndex;

  select COALESCE(nSeriesIndex, -2) into nSeriesIndex;
  select nSeriesIndex into rec;
  IF nSeriesIndex < 0 THEN
    return next rect;
  END IF;


  return next rec;
END $$;


ALTER FUNCTION public.findoraddinstance_v3(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text) OWNER TO spacs;

--
-- TOC entry 260 (class 1255 OID 22623)
-- Name: findoraddinstance_v4(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, integer, text, text, text, text, text, text, integer, integer, integer, integer, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddinstance_v4(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 acq_date text := '';
 acq_time text := '';

 nPatientIndex integer := 0;
 nStudyIndex integer := 0;
 nSeriesIndex integer := 0;
 nInstanceIndex integer := 0;
 nInstanceTotalCount integer := 0;
BEGIN
  select index from public.FindOrAddPatient(strPatientID, strPatientName, strOtherPatientName, strPatientSex,
  											strPatientBirthDate, strPatientBirthTime, strPatientSize, strPatientWeight,
											strOccupation, strEthnicGroup) as x(index int) into nPatientIndex;

  select COALESCE(nPatientIndex, -1) into nPatientIndex;
  select nPatientIndex into rec;
  IF nPatientIndex < 0 THEN
  	return next rect;
  END IF;


  select index from public.FindOrAddStudy(strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
												strStudyID, strStudyDate, strStudyTime, strNameOfPhysiciansReadingStudy,
												strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel,
												strSpecificCharacterSet, strIssuerOfPatientID, strSOPClassUID,
												strPatientAge, strAdmittingDiagnosesDescription) as x(index int) into nStudyIndex;

  select COALESCE(nStudyIndex, -2) into nStudyIndex;
  select nStudyIndex into rec;
  IF nStudyIndex < 0 THEN
    return next rect;
  END IF;

  select index from public.FindOrAddSeries(strSeriesInstanceUID, strSeriesDescription, nStudyIndex, strProcedureDescription,
													strSeriesDate, strSeriesTime, nSeriesNumber, strProtocolName,
													strOperatorsName, strPerformingPhysicianName, strModality) as x(index int) into nSeriesIndex;
  select COALESCE(nSeriesIndex, -2) into nSeriesIndex;
  select nSeriesIndex into rec;
  IF nSeriesIndex < 0 THEN
    return next rect;
  END IF;

  select index from public.FindOrAddImage(strSOPInstanceUID, strFileLocation, nImageNumber,
												  nWindowWidth, nWindowCenter, nAcquisitionNumber,
												  strAcquisitionDate, strAcquisitionTime, nSeriesIndex) as x(index int) into nInstanceIndex;
  select COALESCE(nInstanceIndex, -3) into nInstanceIndex;
  select nInstanceIndex into rec;
  IF nInstanceIndex < 0 THEN
    return next rect;
  ELSE
    select count(*) as InstanceTotalCount from public.SPACS_Image where Series_Index=nSeriesIndex into nInstanceTotalCount;
	UPDATE SPACS_Series SET instance_total_count=nInstanceTotalCount where index=nSeriesIndex;
  END IF;





  return next rec;
END $$;


ALTER FUNCTION public.findoraddinstance_v4(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientsize text, strpatientweight text, stroccupation text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text) OWNER TO spacs;

--
-- TOC entry 261 (class 1255 OID 28112)
-- Name: findoraddinstance_v4(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, integer, text, text, text, text, text, text, integer, integer, integer, integer, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddinstance_v4(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, strpatientsize text, strpatientweight text, stroccupation text, strpatientcomments text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_series integer := 0;
 count_image integer := 0;
 acq_date text := '';
 acq_time text := '';

 nPatientIndex integer := 0;
 nStudyIndex integer := 0;
 nSeriesIndex integer := 0;
 nInstanceIndex integer := 0;
 nInstanceTotalCount integer := 0;
BEGIN
												   
  select index from public.FindOrAddPatient(strPatientID, strPatientName, strOtherPatientName, 
  											strPatientSex, strPatientBirthDate, strPatientBirthTime, strEthnicGroup) as x(index int) into nPatientIndex;

  select COALESCE(nPatientIndex, -1) into nPatientIndex;
  select nPatientIndex into rec;
  IF nPatientIndex < 0 THEN
  	return next rec;
  END IF;


  select index from public.FindOrAddStudy(strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
												strStudyID, strStudyDate, strStudyTime, strNameOfPhysiciansReadingStudy,
												strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel,
												strSpecificCharacterSet, strIssuerOfPatientID, strSOPClassUID,
												strPatientAge, strPatientSize, strPatientWeight, strOccupation, strPatientComments,
												strAdmittingDiagnosesDescription) as x(index int) into nStudyIndex;

  select COALESCE(nStudyIndex, -2) into nStudyIndex;
  select nStudyIndex into rec;
  IF nStudyIndex < 0 THEN
    return next rec;
  END IF;

  select index from public.FindOrAddSeries(strSeriesInstanceUID, strSeriesDescription, nStudyIndex, strProcedureDescription,
													strSeriesDate, strSeriesTime, nSeriesNumber, strProtocolName,
													strOperatorsName, strPerformingPhysicianName, strModality) as x(index int) into nSeriesIndex;
  select COALESCE(nSeriesIndex, -2) into nSeriesIndex;
  select nSeriesIndex into rec;
  IF nSeriesIndex < 0 THEN
    return next rec;
  END IF;

  select index from public.FindOrAddImage(strSOPInstanceUID, strFileLocation, nImageNumber,
												  nWindowWidth, nWindowCenter, nAcquisitionNumber,
												  strAcquisitionDate, strAcquisitionTime, nSeriesIndex) as x(index int) into nInstanceIndex;
  select COALESCE(nInstanceIndex, -3) into nInstanceIndex;
  select nInstanceIndex into rec;
  IF nInstanceIndex < 0 THEN
    return next rec;
  ELSE
    select count(*) as InstanceTotalCount from public.SPACS_Image where Series_Index=nSeriesIndex into nInstanceTotalCount;
	UPDATE SPACS_Series SET instance_total_count=nInstanceTotalCount where index=nSeriesIndex;
  END IF;





  return next rec;
END $$;


ALTER FUNCTION public.findoraddinstance_v4(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strethnicgroup text, strstudyinstanceuid text, strstudydescription text, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, strpatientsize text, strpatientweight text, stroccupation text, strpatientcomments text, stradmittingdiagnosesdescription text, strseriesinstanceuid text, strseriesdescription text, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text, strsopinstanceuid text, strfilelocation text, nimagenumber integer, nwindowwidth integer, nwindowcenter integer, nacquisitionnumber integer, stracquisitiondate text, stracquisitiontime text) OWNER TO spacs;

--
-- TOC entry 264 (class 1255 OID 34128)
-- Name: findoraddmodalityworklist(text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddmodalityworklist(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientage text, strpatientsize text, strpatientweight text, strpatientcomments text, stroccupation text, strethnicgroup text, strmodality text, strstudyid text, strstudydescription text, strstudyinstanceuid text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, straccessionnumber text, strspecificcharacterset text, strissuerofpatientid text, stradmittingdiagnosesdescription text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 index_mwl integer := 0;
 count_mwl integer := 0;
 strScheduledDate text := '';
 strScheduledTime text := '';
 strCheckAge text := '';
 strCheckAccessionNumber text := '';
 strCheckStudyInstanceUID text := '';
 strCheckStudyDescription text := '';
 
BEGIN

  select index from public.SPACS_MWL where Accession_Number=strAccessionNumber into index_mwl;
  select count(index) from public.SPACS_MWL into count_mwl;

  

  IF index_mwl!=NULL THEN
  	select index_mwl into rec;
  ELSE

	select to_char(now(), 'YYYYMMDD') into strScheduledDate;
  	select to_char(now(), 'HH24MISS.US') into strScheduledTime;
    --SELECT EXTRACT(year FROM public.age(CURRENT_DATE,strPatientBirthDate)) into strCheckAge;
	--SELECT age(CURRENT_DATE,strPatientBirthDate);
	SELECT (EXTRACT(year FROM age(NOW(), TO_TIMESTAMP(strPatientBirthDate, 'YYYYMMDD'))) || 'Y') INTO strCheckAge;

	IF LENGTH(strAccessionNumber)<1 THEN
	  SELECT format('AccessionNumber%s', count_mwl+1) into strCheckAccessionNumber;
	ELSE
	  SELECT strAccessionNumber into strCheckAccessionNumber;
	END IF;

	IF LENGTH(strStudyInstanceUID)<1 THEN
	  SELECT format('1.22.33.44.55.%s', count_mwl+1) into strCheckStudyInstanceUID;
	ELSE
	  SELECT strStudyInstanceUID into strCheckStudyInstanceUID;
	END IF;

	SELECT format('StudyDescription %s', count_mwl+1) into strCheckStudyDescription;
  
  	insert into public.SPACS_MWL 
	(
	  Patient_ID, Patient_Name, Other_Patient_Name, Patient_Sex, Patient_Birth_Date, Patient_Birth_Time,
	  Patient_Age, Patient_Size, Patient_Weight, Occupation, Ethnic_Group, Patient_Comments,

	  Modality,

	  Scheduled_Date, Scheduled_Time,
	
	  Study_ID, Study_Description, Study_Instance_UID, 
	  NameOfPhysicians_Reading_Study, Referring_Physician_Name, Attending_Physicians_Name, 
	  Accession_Number, Specific_Character_Set,
	  IssuerOfPatient_ID, Admitting_Diagnoses_Description
	) 
	VALUES 
	(
	  strPatientID, strPatientName, strOtherPatientName, strPatientSex, strPatientBirthDate, strPatientBirthTime,
	  strCheckAge, strPatientSize, strPatientWeight, strOccupation, strEthnicGroup, strPatientComments,

	  strModality,

	  strScheduledDate, strScheduledTime,
	
	  strStudyID, strCheckStudyDescription, strCheckStudyInstanceUID, 
	  strNameOfPhysiciansReadingStudy, strReferringPhysicianName, strAttendingPhysiciansName, 
	  strCheckAccessionNumber, strSpecificCharacterSet,
	  strIssuerOfPatientID, strAdmittingDiagnosesDescription
	);

	select index from public.SPACS_MWL where Accession_Number=strCheckAccessionNumber into index_mwl;
	select index_mwl into rec;
  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddmodalityworklist(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strpatientage text, strpatientsize text, strpatientweight text, strpatientcomments text, stroccupation text, strethnicgroup text, strmodality text, strstudyid text, strstudydescription text, strstudyinstanceuid text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, straccessionnumber text, strspecificcharacterset text, strissuerofpatientid text, stradmittingdiagnosesdescription text) OWNER TO spacs;

--
-- TOC entry 263 (class 1255 OID 32148)
-- Name: findoraddpatient(text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddpatient(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strethnicgroup text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$

DECLARE
 rec record;
 index_patient integer := 0;
 count_patient integer := 0;
BEGIN
  select count(index) from public.SPACS_Patient where Patient_ID=strPatientID into count_patient;
  IF count_patient < 1 THEN
     insert into public.SPACS_Patient (Patient_ID, Patient_Name, Other_Patient_Name, Patient_Sex, Patient_Birth_Date, Patient_Birth_Time, Ethnic_Group) values
										 (strPatientID, strPatientName, strOtherPatientName, strPatientSex, strPatientBirthDate, strPatientBirthTime, strEthnicGroup);
  END IF;

  select index from public.SPACS_Patient where Patient_ID=strPatientID into index_patient;
	 IF index_patient < 1 THEN
		select -1 into index_patient;
	 END IF;

  select index_patient into rec;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddpatient(strpatientid text, strpatientname text, strotherpatientname text, strpatientsex text, strpatientbirthdate text, strpatientbirthtime text, strethnicgroup text) OWNER TO spacs;

--
-- TOC entry 259 (class 1255 OID 21257)
-- Name: findoraddseries(text, text, integer, text, text, text, integer, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddseries(strseriesinstanceuid text, strseriesdescription text, nstudyindex integer, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_study integer := 0;
 count_series integer := 0;
 strCheckSeriesDate text := '';
 strCheckSeriesTime text := '';
 nSeriesTotalCount integer := 0;
BEGIN

  IF LENGTH(strSeriesDate)=0 THEN
    select to_char(now(), 'YYYYMMDD') into strCheckSeriesDate;
  ELSE
    select strSeriesDate into strCheckSeriesDate;
  END IF;

  IF LENGTH(strSeriesTime)=0 THEN
    select to_char(now(), 'HH24MISS') into strCheckSeriesTime;
  ELSE
    select strSeriesTime into strCheckSeriesTime;
  END IF;

  select count(*) from public.SPACS_Study where index=nStudyIndex into count_study;
  IF count_study < 1 THEN
  	select -2 into rec;
  ELSE

    select count(*) from public.SPACS_Series where series_instance_uid=strSeriesInstanceUID into count_series;
    IF count_series > 0 THEN
      select index from public.SPACS_Series where series_instance_uid=strSeriesInstanceUID into rec;
    ELSE


      insert into public.SPACS_Series (series_instance_uid, series_description, study_index, procedure_description,
	  									series_date, series_time, series_number, protocol_name,
										operators_name, performing_physician_name, modality, patient_id, patient_name, patient_sex)
	  							select strSeriesInstanceUID, strSeriesDescription, nStudyIndex, strProcedureDescription,
								  		strCheckSeriesDate, strCheckSeriesTime, nSeriesNumber, strProtocolName,
										strOperatorsName, strPerformingPhysicianName, strModality,
										patient_id, patient_name, patient_sex from public.SPACS_Study as t1 where t1.index=nStudyIndex;

	  select count(*) from public.SPACS_Series where series_instance_uid=strSeriesInstanceUID into count_series;
	  IF count_series > 0 THEN
        select index from public.SPACS_Series where series_instance_uid=strSeriesInstanceUID into rec;
		select count(*) from public.SPACS_Series where study_index=nStudyIndex into nSeriesTotalCount;
		UPDATE SPACS_Study SET Series_total_count=nSeriesTotalCount where index=nStudyIndex;

      ELSE
        select -1 into rec;
	  END IF;
    END IF;

  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddseries(strseriesinstanceuid text, strseriesdescription text, nstudyindex integer, strproceduredescription text, strseriesdate text, strseriestime text, nseriesnumber integer, strprotocolname text, stroperatorsname text, strperformingphysicianname text, strmodality text) OWNER TO spacs;

--
-- TOC entry 257 (class 1255 OID 21256)
-- Name: findoraddstudy(text, text, integer, text, text, text, text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddstudy(strstudyinstanceuid text, strstudydescription text, npatientindex integer, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_study integer := 0;
 count_patient integer := 0;
 strCheckStudyDate text := '';
 strCheckStudyTime text := '';
BEGIN

  IF LENGTH(strStudyDate)=0 THEN
    select to_char(now(), 'YYYYMMDD') into strCheckStudyDate;
  ELSE
    select strStudyDate into strCheckStudyDate;
  END IF;

  IF LENGTH(strStudyTime)=0 THEN
    select to_char(now(), 'HH24MISS') into strCheckStudyTime;
  ELSE
    select strStudyTime into strCheckStudyTime;
  END IF;

  select count(*) from public.SPACS_Patient where index=nPatientIndex into count_patient;
  IF count_patient < 1 THEN
  	select -2 into rec;
  ELSE

    select count(*) from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into count_study;
    IF count_study > 0 THEN
        select index from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into rec;
    ELSE





      insert into public.SPACS_Study (study_instance_uid, study_description, patient_index, accession_number,
	  								study_id, study_date, study_time, nameofphysicians_reading_study,
									  referring_physician_name, attending_physicians_name, presentation_label, specific_character_set,
									  issuerofpatient_id, sop_class_uid, patient_age, admitting_diagnoses_description,
									  patient_id, patient_name, patient_sex)
	  						select strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
	  								strStudyID, strCheckStudyDate, strCheckStudyTime, strNameOfPhysiciansReadingStudy,
				  					strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel, strSpecificCharacterSet,
				  					strIssuerOfPatientID, strSOPClassUID, strPatientAge, strAdmittingDiagnosesDescription,
									patient_id, patient_name, patient_sex from public.SPACS_Patient where index=nPatientIndex;

	  select count(*) from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into count_study;
	  IF count_study > 0 THEN
        select index from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into rec;
      ELSE
        select -1 into rec;
	  END IF;
    END IF;

  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddstudy(strstudyinstanceuid text, strstudydescription text, npatientindex integer, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, stradmittingdiagnosesdescription text) OWNER TO spacs;

--
-- TOC entry 265 (class 1255 OID 28111)
-- Name: findoraddstudy(text, text, integer, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: spacs
--

CREATE FUNCTION public.findoraddstudy(strstudyinstanceuid text, strstudydescription text, npatientindex integer, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, strpatientsize text, strpatientweight text, stroccupation text, strpatientcomments text, stradmittingdiagnosesdescription text) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
DECLARE
 rec record;
 count_study integer := 0;
 count_patient integer := 0;
 strCheckStudyDate text := '';
 strCheckStudyTime text := '';
BEGIN

  IF LENGTH(strStudyDate)=0 THEN
    select to_char(now(), 'YYYYMMDD') into strCheckStudyDate;
  ELSE
    select strStudyDate into strCheckStudyDate;
  END IF;

  IF LENGTH(strStudyTime)=0 THEN
    select to_char(now(), 'HH24MISS') into strCheckStudyTime;
  ELSE
    select strStudyTime into strCheckStudyTime;
  END IF;

  select count(*) from public.SPACS_Patient where index=nPatientIndex into count_patient;
  IF count_patient < 1 THEN
  	select -2 into rec;
  ELSE

    select count(*) from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into count_study;
    IF count_study > 0 THEN
        select index from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into rec;
    ELSE





      insert into public.SPACS_Study (study_instance_uid, study_description, patient_index, accession_number,
	  								study_id, study_date, study_time, nameofphysicians_reading_study,
									  referring_physician_name, attending_physicians_name, presentation_label, specific_character_set,
									  issuerofpatient_id, sop_class_uid, patient_age, admitting_diagnoses_description,
									  patient_id, patient_name, patient_sex, Patient_Size, Patient_Weight, Occupation, Patient_Comments)
	  						select strStudyInstanceUID, strStudyDescription, nPatientIndex, strAccessionNumber,
	  								strStudyID, strCheckStudyDate, strCheckStudyTime, strNameOfPhysiciansReadingStudy,
				  					strReferringPhysicianName, strAttendingPhysiciansName, strPresentationLabel, strSpecificCharacterSet,
				  					strIssuerOfPatientID, strSOPClassUID, strPatientAge, strAdmittingDiagnosesDescription,
									patient_id, patient_name, patient_sex, strPatientSize, strPatientWeight, strOccupation, strPatientComments
							from public.SPACS_Patient where index=nPatientIndex;

	  select count(*) from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into count_study;
	  IF count_study > 0 THEN
        select index from public.SPACS_Study where study_instance_uid=strStudyInstanceUID into rec;
      ELSE
        select -1 into rec;
	  END IF;
    END IF;

  END IF;

  return next rec;
END $$;


ALTER FUNCTION public.findoraddstudy(strstudyinstanceuid text, strstudydescription text, npatientindex integer, straccessionnumber text, strstudyid text, strstudydate text, strstudytime text, strnameofphysiciansreadingstudy text, strreferringphysicianname text, strattendingphysiciansname text, strpresentationlabel text, strspecificcharacterset text, strissuerofpatientid text, strsopclassuid text, strpatientage text, strpatientsize text, strpatientweight text, stroccupation text, strpatientcomments text, stradmittingdiagnosesdescription text) OWNER TO spacs;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 217 (class 1259 OID 16385)
-- Name: SImage; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public."SImage" (
    id integer NOT NULL,
    name text DEFAULT ''::text NOT NULL,
    value integer NOT NULL
);


ALTER TABLE public."SImage" OWNER TO spacs;

--
-- TOC entry 218 (class 1259 OID 16391)
-- Name: SImage_id_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public."SImage_id_seq"
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public."SImage_id_seq" OWNER TO spacs;

--
-- TOC entry 3659 (class 0 OID 0)
-- Dependencies: 218
-- Name: SImage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public."SImage_id_seq" OWNED BY public."SImage".id;


--
-- TOC entry 219 (class 1259 OID 16392)
-- Name: _prisma_migrations; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public._prisma_migrations (
    id character varying(36) NOT NULL,
    checksum character varying(64) NOT NULL,
    finished_at timestamp with time zone,
    migration_name character varying(255) NOT NULL,
    logs text,
    rolled_back_at timestamp with time zone,
    started_at timestamp with time zone DEFAULT now() NOT NULL,
    applied_steps_count integer DEFAULT 0 NOT NULL
);


ALTER TABLE public._prisma_migrations OWNER TO spacs;

--
-- TOC entry 231 (class 1259 OID 16723)
-- Name: s_devices; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_devices (
    index integer NOT NULL,
    created_datetime timestamp without time zone DEFAULT (now())::timestamp without time zone,
    modified_datetime timestamp without time zone DEFAULT now(),
    host_ip character varying(20) DEFAULT ''::character varying,
    host_port integer DEFAULT 104,
    host_name character varying(128) DEFAULT ''::character varying,
    calling_aetitle character varying(128) DEFAULT 'CALLING_AE_TITLE'::character varying,
    called_aetitle character varying(128) DEFAULT 'CALLED_AE_TITLE'::character varying,
    storage_location character varying(128) DEFAULT 'DEFAULT_STORAGE'::character varying
);


ALTER TABLE public.s_devices OWNER TO spacs;

--
-- TOC entry 230 (class 1259 OID 16722)
-- Name: s_devices_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_devices_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_devices_index_seq OWNER TO spacs;

--
-- TOC entry 3660 (class 0 OID 0)
-- Dependencies: 230
-- Name: s_devices_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_devices_index_seq OWNED BY public.s_devices.index;


--
-- TOC entry 220 (class 1259 OID 16399)
-- Name: s_image; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_image (
    index integer NOT NULL,
    created_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    image_instance_uid character varying(256) DEFAULT ''::character varying NOT NULL,
    file_location character varying(1024) DEFAULT ''::character varying NOT NULL,
    acquisition_number integer NOT NULL,
    image_number integer NOT NULL,
    patient_index integer NOT NULL,
    study_index integer NOT NULL,
    series_index integer NOT NULL
);


ALTER TABLE public.s_image OWNER TO spacs;

--
-- TOC entry 221 (class 1259 OID 16407)
-- Name: s_image_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_image_index_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_image_index_seq OWNER TO spacs;

--
-- TOC entry 3661 (class 0 OID 0)
-- Dependencies: 221
-- Name: s_image_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_image_index_seq OWNED BY public.s_image.index;


--
-- TOC entry 222 (class 1259 OID 16408)
-- Name: s_order; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_order (
    index integer NOT NULL,
    created_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    study_reserve_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    order_modality character varying(16) DEFAULT ''::character varying,
    order_name character varying(64) DEFAULT ''::character varying,
    order_code character varying(64) DEFAULT ''::character varying,
    order_status character varying(16) DEFAULT ''::character varying,
    order_reason character varying(256) DEFAULT ''::character varying,
    accession_number bigint DEFAULT 0,
    physician_name character varying(64) DEFAULT ''::character varying,
    order_department character varying(64) DEFAULT ''::character varying,
    study_complete_date character varying(14) DEFAULT NULL::character varying,
    status_flag character varying(1) DEFAULT 'Y'::character varying,
    patient_index bigint NOT NULL
);


ALTER TABLE public.s_order OWNER TO spacs;

--
-- TOC entry 223 (class 1259 OID 16425)
-- Name: s_order_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_order_index_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_order_index_seq OWNER TO spacs;

--
-- TOC entry 3662 (class 0 OID 0)
-- Dependencies: 223
-- Name: s_order_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_order_index_seq OWNED BY public.s_order.index;


--
-- TOC entry 224 (class 1259 OID 16426)
-- Name: s_patient; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_patient (
    index integer NOT NULL,
    created_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    patient_name character varying(64) DEFAULT ''::character varying NOT NULL,
    patient_id character varying(128) DEFAULT ''::character varying NOT NULL,
    patient_uid character varying(128) DEFAULT ''::character varying,
    patient_sex character varying(8) DEFAULT ''::character varying,
    patient_birth_date character varying(8) DEFAULT ''::character varying,
    patient_age character varying(4) DEFAULT ''::character varying,
    patient_location character varying(8) DEFAULT ''::character varying
);


ALTER TABLE public.s_patient OWNER TO spacs;

--
-- TOC entry 225 (class 1259 OID 16437)
-- Name: s_patient_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_patient_index_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_patient_index_seq OWNER TO spacs;

--
-- TOC entry 3663 (class 0 OID 0)
-- Dependencies: 225
-- Name: s_patient_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_patient_index_seq OWNED BY public.s_patient.index;


--
-- TOC entry 226 (class 1259 OID 16438)
-- Name: s_series; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_series (
    index integer NOT NULL,
    created_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    series_instance_uid character varying(256) DEFAULT ''::character varying NOT NULL,
    series_description character varying(256) DEFAULT ''::character varying NOT NULL,
    series_report character varying(4096) DEFAULT ''::character varying NOT NULL,
    modality character varying(16) DEFAULT ''::character varying NOT NULL,
    patient_index integer NOT NULL,
    study_index integer NOT NULL,
    series_date character varying(8) DEFAULT ''::character varying NOT NULL,
    series_time character varying(6) DEFAULT ''::character varying NOT NULL
);


ALTER TABLE public.s_series OWNER TO spacs;

--
-- TOC entry 227 (class 1259 OID 16448)
-- Name: s_series_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_series_index_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_series_index_seq OWNER TO spacs;

--
-- TOC entry 3664 (class 0 OID 0)
-- Dependencies: 227
-- Name: s_series_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_series_index_seq OWNED BY public.s_series.index;


--
-- TOC entry 233 (class 1259 OID 16787)
-- Name: s_storage; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_storage (
    index integer NOT NULL,
    created_datetime timestamp without time zone DEFAULT (now())::timestamp without time zone,
    modified_datetime timestamp without time zone DEFAULT now(),
    ae_title character varying(32) DEFAULT ''::character varying,
    storage_location character varying(1024) DEFAULT ''::character varying,
    storage_used_gb integer DEFAULT 0,
    storage_limits_gb integer DEFAULT 1000
);


ALTER TABLE public.s_storage OWNER TO spacs;

--
-- TOC entry 232 (class 1259 OID 16786)
-- Name: s_storage_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_storage_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_storage_index_seq OWNER TO spacs;

--
-- TOC entry 3665 (class 0 OID 0)
-- Dependencies: 232
-- Name: s_storage_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_storage_index_seq OWNED BY public.s_storage.index;


--
-- TOC entry 228 (class 1259 OID 16449)
-- Name: s_study; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.s_study (
    index integer NOT NULL,
    created_datetime character varying(14) DEFAULT to_char(now(), 'YYYYMMDDhhmmss'::text),
    study_instance_uid character varying(256) DEFAULT ''::character varying NOT NULL,
    study_description character varying(256) DEFAULT ''::character varying NOT NULL,
    study_report character varying(4096) DEFAULT ''::character varying NOT NULL,
    study_date character varying(8) DEFAULT ''::character varying NOT NULL,
    study_time character varying(6) DEFAULT ''::character varying NOT NULL,
    order_index integer NOT NULL,
    patient_index integer NOT NULL
);


ALTER TABLE public.s_study OWNER TO spacs;

--
-- TOC entry 229 (class 1259 OID 16460)
-- Name: s_study_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.s_study_index_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.s_study_index_seq OWNER TO spacs;

--
-- TOC entry 3666 (class 0 OID 0)
-- Dependencies: 229
-- Name: s_study_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.s_study_index_seq OWNED BY public.s_study.index;


--
-- TOC entry 243 (class 1259 OID 44790)
-- Name: spacs_image; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.spacs_image (
    index integer NOT NULL,
    create_datetime timestamp with time zone DEFAULT now(),
    modified_datetime timestamp with time zone DEFAULT now(),
    sop_instance_uid character varying(256) DEFAULT ''::character varying,
    file_location character varying(512) DEFAULT ''::character varying,
    image_number character varying(256) DEFAULT ''::character varying,
    window_width integer DEFAULT 0,
    window_center integer DEFAULT 0,
    acquisition_number integer DEFAULT 0,
    acquisition_date character varying(8) DEFAULT ''::character varying,
    acquisition_time character varying(16) DEFAULT ''::character varying,
    series_index integer DEFAULT 0,
    modality character varying(16) DEFAULT ''::character varying,
    series_instance_uid character varying(256) DEFAULT ''::character varying
);


ALTER TABLE public.spacs_image OWNER TO spacs;

--
-- TOC entry 242 (class 1259 OID 44789)
-- Name: spacs_image_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.spacs_image_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.spacs_image_index_seq OWNER TO spacs;

--
-- TOC entry 3667 (class 0 OID 0)
-- Dependencies: 242
-- Name: spacs_image_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.spacs_image_index_seq OWNED BY public.spacs_image.index;


--
-- TOC entry 235 (class 1259 OID 44665)
-- Name: spacs_mwl; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.spacs_mwl (
    index integer NOT NULL,
    create_datetime timestamp with time zone DEFAULT now(),
    modified_datetime timestamp with time zone DEFAULT now(),
    patient_id character varying(128) DEFAULT ''::character varying,
    patient_name character varying(128) DEFAULT ''::character varying,
    other_patient_name character varying(128) DEFAULT ''::character varying,
    patient_sex character varying(16) DEFAULT ''::character varying,
    patient_birth_date character varying(8) DEFAULT ''::character varying,
    patient_birth_time character varying(16) DEFAULT ''::character varying,
    patient_age character varying(8) DEFAULT ''::character varying,
    patient_size character varying(8) DEFAULT ''::character varying,
    patient_weight character varying(8) DEFAULT ''::character varying,
    occupation character varying(64) DEFAULT ''::character varying,
    ethnic_group character varying(64) DEFAULT ''::character varying,
    patient_comments character varying(4096) DEFAULT ''::character varying,
    modality character varying(16) DEFAULT ''::character varying,
    scheduled_date character varying(8) DEFAULT to_char(now(), 'YYYYMMDD'::text),
    scheduled_time character varying(16) DEFAULT to_char(now(), 'HH24MISS'::text),
    study_id character varying(128) DEFAULT ''::character varying,
    study_description character varying(256) DEFAULT ''::character varying,
    study_instance_uid character varying(256) DEFAULT ''::character varying,
    nameofphysicians_reading_study character varying(128) DEFAULT ''::character varying,
    referring_physician_name character varying(128) DEFAULT ''::character varying,
    attending_physicians_name character varying(128) DEFAULT ''::character varying,
    accession_number character varying(128) DEFAULT ''::character varying,
    specific_character_set character varying(16) DEFAULT ''::character varying,
    issuerofpatient_id character varying(128) DEFAULT ''::character varying,
    admitting_diagnoses_description character varying(128) DEFAULT ''::character varying
);


ALTER TABLE public.spacs_mwl OWNER TO spacs;

--
-- TOC entry 234 (class 1259 OID 44664)
-- Name: spacs_mwl_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.spacs_mwl_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.spacs_mwl_index_seq OWNER TO spacs;

--
-- TOC entry 3668 (class 0 OID 0)
-- Dependencies: 234
-- Name: spacs_mwl_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.spacs_mwl_index_seq OWNED BY public.spacs_mwl.index;


--
-- TOC entry 237 (class 1259 OID 44701)
-- Name: spacs_patient; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.spacs_patient (
    index integer NOT NULL,
    create_datetime timestamp with time zone DEFAULT now(),
    modified_datetime timestamp with time zone DEFAULT now(),
    patient_id character varying(128) DEFAULT ''::character varying,
    patient_name character varying(128) DEFAULT ''::character varying,
    other_patient_name character varying(128) DEFAULT ''::character varying,
    patient_sex character varying(16) DEFAULT ''::character varying,
    patient_birth_date character varying(8) DEFAULT ''::character varying,
    patient_birth_time character varying(16) DEFAULT ''::character varying,
    ethnic_group character varying(64) DEFAULT ''::character varying
);


ALTER TABLE public.spacs_patient OWNER TO spacs;

--
-- TOC entry 236 (class 1259 OID 44700)
-- Name: spacs_patient_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.spacs_patient_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.spacs_patient_index_seq OWNER TO spacs;

--
-- TOC entry 3669 (class 0 OID 0)
-- Dependencies: 236
-- Name: spacs_patient_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.spacs_patient_index_seq OWNED BY public.spacs_patient.index;


--
-- TOC entry 241 (class 1259 OID 44759)
-- Name: spacs_series; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.spacs_series (
    index integer NOT NULL,
    create_datetime timestamp with time zone DEFAULT now(),
    modified_datetime timestamp with time zone DEFAULT now(),
    series_description character varying(256) DEFAULT ''::character varying,
    procedure_description character varying(256) DEFAULT ''::character varying,
    series_instance_uid character varying(256) DEFAULT ''::character varying,
    series_date character varying(8) DEFAULT to_char(now(), 'YYYYMMDD'::text),
    series_time character varying(16) DEFAULT to_char(now(), 'HH24MISS'::text),
    series_number integer DEFAULT 0,
    protocol_name character varying(128) DEFAULT ''::character varying,
    operators_name character varying(128) DEFAULT ''::character varying,
    performing_physician_name character varying(128) DEFAULT ''::character varying,
    modality character varying(16) DEFAULT ''::character varying,
    study_index integer DEFAULT 0,
    patient_id character varying(128) DEFAULT ''::character varying,
    patient_name character varying(128) DEFAULT ''::character varying,
    patient_sex character varying(16) DEFAULT ''::character varying,
    instance_total_count integer DEFAULT 0
);


ALTER TABLE public.spacs_series OWNER TO spacs;

--
-- TOC entry 240 (class 1259 OID 44758)
-- Name: spacs_series_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.spacs_series_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.spacs_series_index_seq OWNER TO spacs;

--
-- TOC entry 3670 (class 0 OID 0)
-- Dependencies: 240
-- Name: spacs_series_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.spacs_series_index_seq OWNED BY public.spacs_series.index;


--
-- TOC entry 239 (class 1259 OID 44719)
-- Name: spacs_study; Type: TABLE; Schema: public; Owner: spacs
--

CREATE TABLE public.spacs_study (
    index integer NOT NULL,
    create_datetime timestamp with time zone DEFAULT now(),
    modified_datetime timestamp with time zone DEFAULT now(),
    study_id character varying(128) DEFAULT ''::character varying,
    study_description character varying(256) DEFAULT ''::character varying,
    study_instance_uid character varying(256) DEFAULT ''::character varying,
    study_date character varying(8) DEFAULT to_char(now(), 'YYYYMMDD'::text),
    study_time character varying(16) DEFAULT to_char(now(), 'HH24MISS'::text),
    nameofphysicians_reading_study character varying(128) DEFAULT ''::character varying,
    referring_physician_name character varying(128) DEFAULT ''::character varying,
    attending_physicians_name character varying(128) DEFAULT ''::character varying,
    accession_number character varying(128) DEFAULT ''::character varying,
    presentation_label character varying(128) DEFAULT ''::character varying,
    specific_character_set character varying(16) DEFAULT ''::character varying,
    issuerofpatient_id character varying(128) DEFAULT ''::character varying,
    sop_class_uid character varying(128) DEFAULT ''::character varying,
    patient_age character varying(8) DEFAULT ''::character varying,
    admitting_diagnoses_description character varying(128) DEFAULT ''::character varying,
    patient_index integer DEFAULT 0,
    patient_id character varying(128) DEFAULT ''::character varying,
    patient_name character varying(128) DEFAULT ''::character varying,
    patient_sex character varying(16) DEFAULT ''::character varying,
    patient_comments character varying(4096) DEFAULT ''::character varying,
    patient_size character varying(8) DEFAULT ''::character varying,
    patient_weight character varying(8) DEFAULT ''::character varying,
    occupation character varying(64) DEFAULT ''::character varying,
    series_total_count integer DEFAULT 0
);


ALTER TABLE public.spacs_study OWNER TO spacs;

--
-- TOC entry 238 (class 1259 OID 44718)
-- Name: spacs_study_index_seq; Type: SEQUENCE; Schema: public; Owner: spacs
--

CREATE SEQUENCE public.spacs_study_index_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.spacs_study_index_seq OWNER TO spacs;

--
-- TOC entry 3671 (class 0 OID 0)
-- Dependencies: 238
-- Name: spacs_study_index_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: spacs
--

ALTER SEQUENCE public.spacs_study_index_seq OWNED BY public.spacs_study.index;


--
-- TOC entry 3286 (class 2604 OID 16461)
-- Name: SImage id; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public."SImage" ALTER COLUMN id SET DEFAULT nextval('public."SImage_id_seq"'::regclass);


--
-- TOC entry 3331 (class 2604 OID 16726)
-- Name: s_devices index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_devices ALTER COLUMN index SET DEFAULT nextval('public.s_devices_index_seq'::regclass);


--
-- TOC entry 3290 (class 2604 OID 16462)
-- Name: s_image index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_image ALTER COLUMN index SET DEFAULT nextval('public.s_image_index_seq'::regclass);


--
-- TOC entry 3294 (class 2604 OID 16463)
-- Name: s_order index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_order ALTER COLUMN index SET DEFAULT nextval('public.s_order_index_seq'::regclass);


--
-- TOC entry 3307 (class 2604 OID 16464)
-- Name: s_patient index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_patient ALTER COLUMN index SET DEFAULT nextval('public.s_patient_index_seq'::regclass);


--
-- TOC entry 3316 (class 2604 OID 16465)
-- Name: s_series index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_series ALTER COLUMN index SET DEFAULT nextval('public.s_series_index_seq'::regclass);


--
-- TOC entry 3340 (class 2604 OID 16790)
-- Name: s_storage index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_storage ALTER COLUMN index SET DEFAULT nextval('public.s_storage_index_seq'::regclass);


--
-- TOC entry 3324 (class 2604 OID 16466)
-- Name: s_study index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_study ALTER COLUMN index SET DEFAULT nextval('public.s_study_index_seq'::regclass);


--
-- TOC entry 3430 (class 2604 OID 44793)
-- Name: spacs_image index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_image ALTER COLUMN index SET DEFAULT nextval('public.spacs_image_index_seq'::regclass);


--
-- TOC entry 3347 (class 2604 OID 44668)
-- Name: spacs_mwl index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_mwl ALTER COLUMN index SET DEFAULT nextval('public.spacs_mwl_index_seq'::regclass);


--
-- TOC entry 3375 (class 2604 OID 44704)
-- Name: spacs_patient index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_patient ALTER COLUMN index SET DEFAULT nextval('public.spacs_patient_index_seq'::regclass);


--
-- TOC entry 3412 (class 2604 OID 44762)
-- Name: spacs_series index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_series ALTER COLUMN index SET DEFAULT nextval('public.spacs_series_index_seq'::regclass);


--
-- TOC entry 3385 (class 2604 OID 44722)
-- Name: spacs_study index; Type: DEFAULT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_study ALTER COLUMN index SET DEFAULT nextval('public.spacs_study_index_seq'::regclass);


--
-- TOC entry 3625 (class 0 OID 16385)
-- Dependencies: 217
-- Data for Name: SImage; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public."SImage" (id, name, value) VALUES (2, 'test2', 2);
INSERT INTO public."SImage" (id, name, value) VALUES (3, 'test3', 3);
INSERT INTO public."SImage" (id, name, value) VALUES (4, 'test4', 4);
INSERT INTO public."SImage" (id, name, value) VALUES (1, 'test11', 1);
INSERT INTO public."SImage" (id, name, value) VALUES (5, 'test5', 5);
INSERT INTO public."SImage" (id, name, value) VALUES (6, 'Name6', 6);
INSERT INTO public."SImage" (id, name, value) VALUES (7, 'Name7', 7);
INSERT INTO public."SImage" (id, name, value) VALUES (8, 'Name8', 8);
INSERT INTO public."SImage" (id, name, value) VALUES (9, 'Name9', 9);
INSERT INTO public."SImage" (id, name, value) VALUES (10, 'Name10', 10);
INSERT INTO public."SImage" (id, name, value) VALUES (11, 'Name11', 11);
INSERT INTO public."SImage" (id, name, value) VALUES (12, 'Name12', 12);
INSERT INTO public."SImage" (id, name, value) VALUES (13, 'Name13', 13);
INSERT INTO public."SImage" (id, name, value) VALUES (14, 'Name14', 14);
INSERT INTO public."SImage" (id, name, value) VALUES (15, 'Name15', 15);
INSERT INTO public."SImage" (id, name, value) VALUES (16, 'Name16', 16);
INSERT INTO public."SImage" (id, name, value) VALUES (17, 'Name17', 17);
INSERT INTO public."SImage" (id, name, value) VALUES (18, 'Name18', 18);
INSERT INTO public."SImage" (id, name, value) VALUES (19, 'Name19', 19);
INSERT INTO public."SImage" (id, name, value) VALUES (20, 'Name20', 20);
INSERT INTO public."SImage" (id, name, value) VALUES (21, 'Name21', 21);
INSERT INTO public."SImage" (id, name, value) VALUES (22, 'Name22', 22);
INSERT INTO public."SImage" (id, name, value) VALUES (23, 'Name23', 23);
INSERT INTO public."SImage" (id, name, value) VALUES (24, 'Name24', 24);
INSERT INTO public."SImage" (id, name, value) VALUES (25, 'Name25', 25);
INSERT INTO public."SImage" (id, name, value) VALUES (26, 'Name26', 26);
INSERT INTO public."SImage" (id, name, value) VALUES (27, 'Name27', 27);
INSERT INTO public."SImage" (id, name, value) VALUES (28, 'Name테스트_28', 28);
INSERT INTO public."SImage" (id, name, value) VALUES (29, 'Name테스트_29', 29);
INSERT INTO public."SImage" (id, name, value) VALUES (30, 'Name테스트_30', 30);
INSERT INTO public."SImage" (id, name, value) VALUES (31, 'Name테스트_31', 31);
INSERT INTO public."SImage" (id, name, value) VALUES (32, 'Name테스트_32', 32);
INSERT INTO public."SImage" (id, name, value) VALUES (33, 'Name테스트_33', 33);
INSERT INTO public."SImage" (id, name, value) VALUES (34, 'Name테스트_34', 34);
INSERT INTO public."SImage" (id, name, value) VALUES (35, 'Name테스트_35', 35);
INSERT INTO public."SImage" (id, name, value) VALUES (36, 'Name테스트_36', 36);
INSERT INTO public."SImage" (id, name, value) VALUES (37, 'Name테스트_37', 37);
INSERT INTO public."SImage" (id, name, value) VALUES (38, 'Name테스트_38', 38);
INSERT INTO public."SImage" (id, name, value) VALUES (39, 'Name테스트_39', 39);
INSERT INTO public."SImage" (id, name, value) VALUES (40, 'Name테스트_40', 40);
INSERT INTO public."SImage" (id, name, value) VALUES (41, 'Name테스트_41', 41);
INSERT INTO public."SImage" (id, name, value) VALUES (42, 'Name테스트_42', 42);
INSERT INTO public."SImage" (id, name, value) VALUES (43, 'Name테스트_43', 43);
INSERT INTO public."SImage" (id, name, value) VALUES (44, 'Name테스트_44', 44);
INSERT INTO public."SImage" (id, name, value) VALUES (45, 'Name테스트_45', 45);
INSERT INTO public."SImage" (id, name, value) VALUES (46, 'Name테스트_46', 46);
INSERT INTO public."SImage" (id, name, value) VALUES (47, 'Name테스트_47', 47);
INSERT INTO public."SImage" (id, name, value) VALUES (48, 'Name테스트_48', 48);
INSERT INTO public."SImage" (id, name, value) VALUES (49, 'Name테스트_49', 49);
INSERT INTO public."SImage" (id, name, value) VALUES (50, 'Name테스트_50', 50);
INSERT INTO public."SImage" (id, name, value) VALUES (51, 'Name테스트_51', 51);
INSERT INTO public."SImage" (id, name, value) VALUES (52, 'Name테스트_52', 52);
INSERT INTO public."SImage" (id, name, value) VALUES (53, 'Name테스트_53', 53);
INSERT INTO public."SImage" (id, name, value) VALUES (54, 'Name테스트_54', 54);
INSERT INTO public."SImage" (id, name, value) VALUES (55, 'Name테스트_55', 55);
INSERT INTO public."SImage" (id, name, value) VALUES (56, 'Name테스트_56', 56);
INSERT INTO public."SImage" (id, name, value) VALUES (57, 'Name테스트_57', 57);
INSERT INTO public."SImage" (id, name, value) VALUES (58, 'Name테스트_58', 58);
INSERT INTO public."SImage" (id, name, value) VALUES (59, 'Name테스트_59', 59);
INSERT INTO public."SImage" (id, name, value) VALUES (60, 'Name테스트_60', 60);
INSERT INTO public."SImage" (id, name, value) VALUES (61, 'Name테스트_61', 61);
INSERT INTO public."SImage" (id, name, value) VALUES (62, 'Name테스트_62', 62);
INSERT INTO public."SImage" (id, name, value) VALUES (63, 'Name테스트_63', 63);
INSERT INTO public."SImage" (id, name, value) VALUES (64, 'Name테스트_64', 64);
INSERT INTO public."SImage" (id, name, value) VALUES (65, 'Name테스트_65', 65);
INSERT INTO public."SImage" (id, name, value) VALUES (66, 'Name테스트_66', 66);
INSERT INTO public."SImage" (id, name, value) VALUES (67, 'Name테스트_67', 67);
INSERT INTO public."SImage" (id, name, value) VALUES (68, 'Name테스트_68', 68);


--
-- TOC entry 3627 (class 0 OID 16392)
-- Dependencies: 219
-- Data for Name: _prisma_migrations; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public._prisma_migrations (id, checksum, finished_at, migration_name, logs, rolled_back_at, started_at, applied_steps_count) VALUES ('586a87d8-29f7-4f39-9c27-711e4768f2fd', 'd47653fd619c9200de79be046d103ff8533322bc8106665291f20ce18d3d18ab', '2023-06-04 20:30:17.821879+09', '20230604113017_init', NULL, NULL, '2023-06-04 20:30:17.811107+09', 1);


--
-- TOC entry 3639 (class 0 OID 16723)
-- Dependencies: 231
-- Data for Name: s_devices; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_devices (index, created_datetime, modified_datetime, host_ip, host_port, host_name, calling_aetitle, called_aetitle, storage_location) VALUES (1, '2024-10-29 20:55:47.942378', '2024-10-29 20:55:47.942378', '127.0.0.1', 1105, 'localhost', 'UNITED1', 'UNITED_STORE', 'DEFAULT_STORAGE');


--
-- TOC entry 3628 (class 0 OID 16399)
-- Dependencies: 220
-- Data for Name: s_image; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (1, '20230608100617', '1.2.34.5678.20230608103818.1.1.4', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.4_4.dcm', 0, 4, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (2, '20230608100649', '1.2.34.5678.20230608103818.1.1.5', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.5_5.dcm', 0, 5, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (3, '20230608100650', '1.2.34.5678.20230608103818.1.1.6', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.6_6.dcm', 0, 6, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (4, '20230608100650', '1.2.34.5678.20230608103818.1.1.7', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.7_7.dcm', 0, 7, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (5, '20230608100650', '1.2.34.5678.20230608103818.1.1.8', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.8_8.dcm', 0, 8, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (6, '20230608100651', '1.2.34.5678.20230608103818.1.1.9', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.9_9.dcm', 0, 9, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (7, '20230608100651', '1.2.34.5678.20230608103818.1.1.10', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.10_10.dcm', 0, 10, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (8, '20230608100651', '1.2.34.5678.20230608103818.1.1.11', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.11_11.dcm', 0, 11, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (9, '20230608100651', '1.2.34.5678.20230608103818.1.1.12', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.12_12.dcm', 0, 12, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (10, '20230608100652', '1.2.34.5678.20230608103818.1.1.13', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.13_13.dcm', 0, 13, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (11, '20230608100653', '1.2.34.5678.20230608103818.1.1.14', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.1.1.14_14.dcm', 0, 14, 1, 1, 1);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (12, '20230608100638', '1.2.34.5678.20230608103818.2.1.1', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.1_1.dcm', 0, 1, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (13, '20230608100639', '1.2.34.5678.20230608103818.2.1.2', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.2_2.dcm', 0, 2, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (14, '20230608100640', '1.2.34.5678.20230608103818.2.1.3', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.3_3.dcm', 0, 3, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (15, '20230608100640', '1.2.34.5678.20230608103818.2.1.4', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.4_4.dcm', 0, 4, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (16, '20230608100640', '1.2.34.5678.20230608103818.2.1.5', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.5_5.dcm', 0, 5, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (17, '20230608100641', '1.2.34.5678.20230608103818.2.1.6', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.6_6.dcm', 0, 6, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (18, '20230608100641', '1.2.34.5678.20230608103818.2.1.7', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.7_7.dcm', 0, 7, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (19, '20230608100643', '1.2.34.5678.20230608103818.2.1.8', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.8_8.dcm', 0, 8, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (20, '20230608100643', '1.2.34.5678.20230608103818.2.1.9', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.9_9.dcm', 0, 9, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (21, '20230608100643', '1.2.34.5678.20230608103818.2.1.10', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.10_10.dcm', 0, 10, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (22, '20230608100643', '1.2.34.5678.20230608103818.2.1.11', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.11_11.dcm', 0, 11, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (23, '20230608100643', '1.2.34.5678.20230608103818.2.1.12', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.12_12.dcm', 0, 12, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (24, '20230608100643', '1.2.34.5678.20230608103818.2.1.13', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.13_13.dcm', 0, 13, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (25, '20230608100643', '1.2.34.5678.20230608103818.2.1.14', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.14_14.dcm', 0, 14, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (26, '20230608100643', '1.2.34.5678.20230608103818.2.1.15', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.15_15.dcm', 0, 15, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (27, '20230608100643', '1.2.34.5678.20230608103818.2.1.16', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.16_16.dcm', 0, 16, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (28, '20230608100643', '1.2.34.5678.20230608103818.2.1.17', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.17_17.dcm', 0, 17, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (29, '20230608100643', '1.2.34.5678.20230608103818.2.1.18', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.2.1.18_18.dcm', 0, 18, 2, 2, 2);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (30, '20230608100648', '1.2.34.5678.20230608103818.3.1.1', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.1_1.dcm', 0, 1, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (31, '20230608100649', '1.2.34.5678.20230608103818.3.1.2', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.2_2.dcm', 0, 2, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (32, '20230608100650', '1.2.34.5678.20230608103818.3.1.3', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.3_3.dcm', 0, 3, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (33, '20230608100650', '1.2.34.5678.20230608103818.3.1.4', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.4_4.dcm', 0, 4, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (34, '20230608100650', '1.2.34.5678.20230608103818.3.1.5', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.5_5.dcm', 0, 5, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (35, '20230608100651', '1.2.34.5678.20230608103818.3.1.6', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.6_6.dcm', 0, 6, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (36, '20230608100652', '1.2.34.5678.20230608103818.3.1.7', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.7_7.dcm', 0, 7, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (37, '20230608100653', '1.2.34.5678.20230608103818.3.1.8', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.8_8.dcm', 0, 8, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (38, '20230608100653', '1.2.34.5678.20230608103818.3.1.9', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.9_9.dcm', 0, 9, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (39, '20230608100654', '1.2.34.5678.20230608103818.3.1.10', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.10_10.dcm', 0, 10, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (40, '20230608100655', '1.2.34.5678.20230608103818.3.1.11', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.11_11.dcm', 0, 11, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (41, '20230608100656', '1.2.34.5678.20230608103818.3.1.12', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.12_12.dcm', 0, 12, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (42, '20230608100657', '1.2.34.5678.20230608103818.3.1.13', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.13_13.dcm', 0, 13, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (43, '20230608100657', '1.2.34.5678.20230608103818.3.1.14', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.14_14.dcm', 0, 14, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (44, '20230608100658', '1.2.34.5678.20230608103818.3.1.15', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.3.1.15_15.dcm', 0, 15, 3, 3, 3);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (45, '20230608100609', '1.2.34.5678.20230608103818.4.1.1', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.1_1.dcm', 0, 1, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (46, '20230608100611', '1.2.34.5678.20230608103818.4.1.2', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.2_2.dcm', 0, 2, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (47, '20230608100611', '1.2.34.5678.20230608103818.4.1.3', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.3_3.dcm', 0, 3, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (48, '20230608100611', '1.2.34.5678.20230608103818.4.1.4', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.4_4.dcm', 0, 4, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (49, '20230608100613', '1.2.34.5678.20230608103818.4.1.5', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.5_5.dcm', 0, 5, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (50, '20230608100613', '1.2.34.5678.20230608103818.4.1.6', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.6_6.dcm', 0, 6, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (51, '20230608100613', '1.2.34.5678.20230608103818.4.1.7', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.7_7.dcm', 0, 7, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (52, '20230608100613', '1.2.34.5678.20230608103818.4.1.8', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.8_8.dcm', 0, 8, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (53, '20230608100613', '1.2.34.5678.20230608103818.4.1.9', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.9_9.dcm', 0, 9, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (54, '20230608100613', '1.2.34.5678.20230608103818.4.1.10', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.10_10.dcm', 0, 10, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (55, '20230608100613', '1.2.34.5678.20230608103818.4.1.11', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.11_11.dcm', 0, 11, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (56, '20230608100613', '1.2.34.5678.20230608103818.4.1.12', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.12_12.dcm', 0, 12, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (57, '20230608100613', '1.2.34.5678.20230608103818.4.1.13', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.4.1.13_13.dcm', 0, 13, 4, 4, 4);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (58, '20230608040617', '1.2.34.5678.20230608103818.6.1.1', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.1_1.dcm', 0, 1, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (59, '20230608040618', '1.2.34.5678.20230608103818.6.1.2', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.2_2.dcm', 0, 2, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (60, '20230608040619', '1.2.34.5678.20230608103818.6.1.3', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.3_3.dcm', 0, 3, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (61, '20230608040619', '1.2.34.5678.20230608103818.6.1.4', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.4_4.dcm', 0, 4, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (62, '20230608040619', '1.2.34.5678.20230608103818.6.1.5', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.5_5.dcm', 0, 5, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (63, '20230608040619', '1.2.34.5678.20230608103818.6.1.6', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.6_6.dcm', 0, 6, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (64, '20230608040620', '1.2.34.5678.20230608103818.6.1.7', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.7_7.dcm', 0, 7, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (65, '20230608040620', '1.2.34.5678.20230608103818.6.1.8', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.8_8.dcm', 0, 8, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (66, '20230608040620', '1.2.34.5678.20230608103818.6.1.9', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.9_9.dcm', 0, 9, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (67, '20230608040621', '1.2.34.5678.20230608103818.6.1.10', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.10_10.dcm', 0, 10, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (68, '20230608040621', '1.2.34.5678.20230608103818.6.1.11', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.11_11.dcm', 0, 11, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (69, '20230608040621', '1.2.34.5678.20230608103818.6.1.12', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.12_12.dcm', 0, 12, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (70, '20230608040621', '1.2.34.5678.20230608103818.6.1.13', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.13_13.dcm', 0, 13, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (71, '20230608040621', '1.2.34.5678.20230608103818.6.1.14', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.14_14.dcm', 0, 14, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (72, '20230608040621', '1.2.34.5678.20230608103818.6.1.15', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.15_15.dcm', 0, 15, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (73, '20230608040621', '1.2.34.5678.20230608103818.6.1.16', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.16_16.dcm', 0, 16, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (74, '20230608040621', '1.2.34.5678.20230608103818.6.1.17', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.17_17.dcm', 0, 17, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (75, '20230608040622', '1.2.34.5678.20230608103818.6.1.18', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.18_18.dcm', 0, 18, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (76, '20230608040622', '1.2.34.5678.20230608103818.6.1.19', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.19_19.dcm', 0, 19, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (77, '20230608040622', '1.2.34.5678.20230608103818.6.1.20', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.20_20.dcm', 0, 20, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (78, '20230608040622', '1.2.34.5678.20230608103818.6.1.21', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.21_21.dcm', 0, 21, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (79, '20230608040622', '1.2.34.5678.20230608103818.6.1.22', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.22_22.dcm', 0, 22, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (80, '20230608040623', '1.2.34.5678.20230608103818.6.1.23', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.23_23.dcm', 0, 23, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (81, '20230608040623', '1.2.34.5678.20230608103818.6.1.24', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.24_24.dcm', 0, 24, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (82, '20230608040623', '1.2.34.5678.20230608103818.6.1.25', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.25_25.dcm', 0, 25, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (83, '20230608040623', '1.2.34.5678.20230608103818.6.1.26', 'Storage\2023\06\08\ES_1.2.34.5678.20230608103818.6.1.26_26.dcm', 0, 26, 5, 5, 5);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (84, '20241025162040', '1.2.34.5678.20230608103818.6.6.1.1', 'location_test1', 1, 11, 1, 11, 8);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (85, '20241025173457', '1.2.34.5678.20230608103818.7.1.1', 'test_location', 11, 11, 1, 15, 10);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (86, '20241025212452', '1.3.6.1.4.1.53829.3.6.5.20211227101700495351495050.2.1.1', './DX.1.3.6.1.4.1.53829.3.6.5.20211227101700495351495050.2.1.1', 0, 0, 1, 16, 11);
INSERT INTO public.s_image (index, created_datetime, image_instance_uid, file_location, acquisition_number, image_number, patient_index, study_index, series_index) VALUES (87, '20241025212518', '1.2.3.777.20210512.104559.1.3', './SC.1.2.3.777.20210512.104559.1.3', 0, 0, 1, 17, 12);


--
-- TOC entry 3630 (class 0 OID 16408)
-- Dependencies: 222
-- Data for Name: s_order; Type: TABLE DATA; Schema: public; Owner: spacs
--



--
-- TOC entry 3632 (class 0 OID 16426)
-- Dependencies: 224
-- Data for Name: s_patient; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_patient (index, created_datetime, patient_name, patient_id, patient_uid, patient_sex, patient_birth_date, patient_age, patient_location) VALUES (1, '20230608100617', 'Test^Hilbert^^', '20230608103818101', '', 'M', '', '', '');
INSERT INTO public.s_patient (index, created_datetime, patient_name, patient_id, patient_uid, patient_sex, patient_birth_date, patient_age, patient_location) VALUES (2, '20230608100638', 'Test^Hilbert^^', '20230608103818102', '', 'M', '', '', '');
INSERT INTO public.s_patient (index, created_datetime, patient_name, patient_id, patient_uid, patient_sex, patient_birth_date, patient_age, patient_location) VALUES (3, '20230608100648', 'Test^Hilbert^^', '20230608103818103', '', 'M', '', '', '');
INSERT INTO public.s_patient (index, created_datetime, patient_name, patient_id, patient_uid, patient_sex, patient_birth_date, patient_age, patient_location) VALUES (4, '20230608100609', 'Test^Hilbert^^', '20230608103818104', '', 'M', '', '', '');
INSERT INTO public.s_patient (index, created_datetime, patient_name, patient_id, patient_uid, patient_sex, patient_birth_date, patient_age, patient_location) VALUES (5, '20230608040617', 'Test^Hilbert^^', '20230608103818106', '', 'M', '', '', '');


--
-- TOC entry 3634 (class 0 OID 16438)
-- Dependencies: 226
-- Data for Name: s_series; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (1, '20230608100617', '1.2.34.5678.20230608103818.1.1', 'ksuaghoahsglahglsahg', '', 'ES', 1, 1, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (2, '20230608100638', '1.2.34.5678.20230608103818.2.1', 'ksuaghoahsglahglsahg', '', 'ES', 2, 2, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (3, '20230608100648', '1.2.34.5678.20230608103818.3.1', 'ksuaghoahsglahglsahg', '', 'ES', 3, 3, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (4, '20230608100609', '1.2.34.5678.20230608103818.4.1', 'ksuaghoahsglahglsahg', '', 'ES', 4, 4, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (5, '20230608040617', '1.2.34.5678.20230608103818.6.1', 'ksuaghoahsglahglsahg', '', 'ES', 5, 5, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (6, '20230608100638', '1.2.34.5678.20230608103818.1.2', 'ksuaghoahsglahglsahg', '', 'ES', 1, 1, '', '');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (7, '20241025155804', '1.2.34.5678.20230608103818.6.5.1', 'test series description', 'test series report 1', 'ES', 1, 11, '20241025', '155804');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (8, '20241025160350', '1.2.34.5678.20230608103818.6.6.1', 'test series description', 'test series report 1', 'ES', 1, 11, '20241025', '160350');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (9, '20241025173114', '1.2.34.5678.20230608103818.7', '1_series_description', '1_series_report', 'ES', 1, 15, '20241025', '173114');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (10, '20241025173457', '1.2.34.5678.20230608103818.7.1', '1_series_description', '1_series_report', 'ES', 1, 15, '20241025', '173457');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (11, '20241025212452', '1.3.6.1.4.1.53829.3.6.5.20211227101700495351495050.2', '', '', 'DX', 1, 16, '20241025', '212452');
INSERT INTO public.s_series (index, created_datetime, series_instance_uid, series_description, series_report, modality, patient_index, study_index, series_date, series_time) VALUES (12, '20241025212518', '1.2.3.777.20210512.104559.1', '', '', 'SC', 1, 17, '20241025', '212518');


--
-- TOC entry 3641 (class 0 OID 16787)
-- Dependencies: 233
-- Data for Name: s_storage; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_storage (index, created_datetime, modified_datetime, ae_title, storage_location, storage_used_gb, storage_limits_gb) VALUES (1, '2024-10-29 22:54:17.563958', '2024-10-29 22:54:17.563958', 'UNITED_STORE', '/workspace/storage/1', 0, 1000);


--
-- TOC entry 3636 (class 0 OID 16449)
-- Dependencies: 228
-- Data for Name: s_study; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (1, '20230608100617', '1.2.34.5678.20230608103818.1', '', '', '20230608', '103833', 20, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (2, '20230608100638', '1.2.34.5678.20230608103818.2', '', '', '20230608', '105033', 20, 2);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (3, '20230608100648', '1.2.34.5678.20230608103818.3', '', '', '20230608', '105043', 20, 3);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (4, '20230608100609', '1.2.34.5678.20230608103818.4', '', '', '20230608', '105104', 20, 4);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (5, '20230608040617', '1.2.34.5678.20230608103818.6', '', '', '20230608', '163012', 20, 5);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (10, '20241025151421', '1.2.34.5678.20230608103818.6.1', 'test description', 'test report', '20241025', '151421', 11, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (11, '20241025151548', '1.2.34.5678.20230608103818.6.2', 'test description', 'test report', '20241025', '151548', 11, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (12, '20241025151553', '1.2.34.5678.20230608103818.6.3', 'test description', 'test report', '20241025', '151553', 11, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (13, '20241025153128', '1.2.34.5678.20230608103818.6.4', 'test study description', 'test report 1', '20241025', '153128', 11, 2);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (14, '20241025153130', '1.2.34.5678.20230608103818.6.5', 'test study description', 'test report 1', '20241025', '153130', 11, 2);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (15, '20241025172928', '1.2.34.5678.20230608103818.7', '1study_description', '1study_report', '20241025', '172928', 1, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (16, '20241025212452', '1.3.6.1.4.1.53829.3.6.5.20211227101700495351495050', 'CHEST', '', '20241025', '212452', 1, 1);
INSERT INTO public.s_study (index, created_datetime, study_instance_uid, study_description, study_report, study_date, study_time, order_index, patient_index) VALUES (17, '20241025212518', '1.2.3.777.20210512.104559', 'SC Series Description', '', '20241025', '212518', 1, 1);


--
-- TOC entry 3651 (class 0 OID 44790)
-- Dependencies: 243
-- Data for Name: spacs_image; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.spacs_image (index, create_datetime, modified_datetime, sop_instance_uid, file_location, image_number, window_width, window_center, acquisition_number, acquisition_date, acquisition_time, series_index, modality, series_instance_uid) VALUES (1, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '', '', '', 0, 0, 0, '', '', 1, '', '');
INSERT INTO public.spacs_image (index, create_datetime, modified_datetime, sop_instance_uid, file_location, image_number, window_width, window_center, acquisition_number, acquisition_date, acquisition_time, series_index, modality, series_instance_uid) VALUES (2, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '1.2.3.6.1.1', 'FileLocation1', '22', 211, 1024, 1, '20241119', '154717', 2, 'SC', '1.2.3.6.1');
INSERT INTO public.spacs_image (index, create_datetime, modified_datetime, sop_instance_uid, file_location, image_number, window_width, window_center, acquisition_number, acquisition_date, acquisition_time, series_index, modality, series_instance_uid) VALUES (3, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '2.2.2.2.1.1', 'file', '1', 1024, 512, 22, '20241119', '154717', 3, 'SC', '2.2.2.2.1');


--
-- TOC entry 3643 (class 0 OID 44665)
-- Dependencies: 235
-- Data for Name: spacs_mwl; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (1, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid123', '테스트123', '태수트123', 'M', '20110909', '', '13Y', 'L', '29Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 1', '1.22.33.44.55.1', '', '', '', 'AccessionNumber1', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (2, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid1', '테스트1', '테스트다른이름1', 'M', '19990101', '', '25Y', 'L', '20Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 2', '1.22.33.44.55.2', '', '', '', 'AccessionNumber2', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (3, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid2', '테스트2', '테스트다른이름2', 'F', '19990102', '', '25Y', 'L', '21Kg', 'Students', 'Asian', 'Patient Comments', 'DX', '20241119', '154717.169365', '', 'StudyDescription 3', '1.22.33.44.55.3', '', '', '', 'AccessionNumber3', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (4, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid3', '테스트3', '테스트다른이름3', 'M', '19990103', '', '25Y', 'L', '22Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 4', '1.22.33.44.55.4', '', '', '', 'AccessionNumber4', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (5, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid4', '테스트4', '테스트다른이름4', 'F', '19990104', '', '25Y', 'L', '23Kg', 'Students', 'Asian', 'Patient Comments', 'DX', '20241119', '154717.169365', '', 'StudyDescription 5', '1.22.33.44.55.5', '', '', '', 'AccessionNumber5', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (6, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid5', '테스트5', '테스트다른이름5', 'M', '19990105', '', '25Y', 'L', '24Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 6', '1.22.33.44.55.6', '', '', '', 'AccessionNumber6', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (7, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid6', '테스트6', '테스트다른이름6', 'F', '19990106', '', '25Y', 'L', '25Kg', 'Students', 'Asian', 'Patient Comments', 'DX', '20241119', '154717.169365', '', 'StudyDescription 7', '1.22.33.44.55.7', '', '', '', 'AccessionNumber7', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (8, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid7', '테스트7', '테스트다른이름7', 'M', '19990107', '', '25Y', 'L', '26Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 8', '1.22.33.44.55.8', '', '', '', 'AccessionNumber8', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (9, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid8', '테스트8', '테스트다른이름8', 'F', '19990108', '', '25Y', 'L', '27Kg', 'Students', 'Asian', 'Patient Comments', 'DX', '20241119', '154717.169365', '', 'StudyDescription 9', '1.22.33.44.55.9', '', '', '', 'AccessionNumber9', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (10, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid9', '테스트9', '테스트다른이름9', 'M', '19990109', '', '25Y', 'L', '28Kg', 'Students', 'Asian', 'Patient Comments', 'ES', '20241119', '154717.169365', '', 'StudyDescription 10', '1.22.33.44.55.10', '', '', '', 'AccessionNumber10', '', '', '');
INSERT INTO public.spacs_mwl (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, patient_age, patient_size, patient_weight, occupation, ethnic_group, patient_comments, modality, scheduled_date, scheduled_time, study_id, study_description, study_instance_uid, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, specific_character_set, issuerofpatient_id, admitting_diagnoses_description) VALUES (11, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'pid10', '테스트10', '테스트다른이름10', 'F', '19990110', '', '25Y', 'L', '29Kg', 'Students', 'Asian', 'Patient Comments', 'DX', '20241119', '154717.169365', '', 'StudyDescription 11', '1.22.33.44.55.11', '', '', '', 'AccessionNumber11', '', '', '');


--
-- TOC entry 3645 (class 0 OID 44701)
-- Dependencies: 237
-- Data for Name: spacs_patient; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.spacs_patient (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, ethnic_group) VALUES (1, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '1212', '테스트이름1212', '', 'M', '', '', '');
INSERT INTO public.spacs_patient (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, ethnic_group) VALUES (2, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '2212', '테스트이름2212', '', 'M', '', '', '');
INSERT INTO public.spacs_patient (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, ethnic_group) VALUES (3, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '8212', 'test3212', '', 'M', '19990909', '202011', 'Ethnic_Group text');
INSERT INTO public.spacs_patient (index, create_datetime, modified_datetime, patient_id, patient_name, other_patient_name, patient_sex, patient_birth_date, patient_birth_time, ethnic_group) VALUES (4, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '2222', 'test11111', '11111_1', 'F', '19990909', '201122', 'east');


--
-- TOC entry 3649 (class 0 OID 44759)
-- Dependencies: 241
-- Data for Name: spacs_series; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.spacs_series (index, create_datetime, modified_datetime, series_description, procedure_description, series_instance_uid, series_date, series_time, series_number, protocol_name, operators_name, performing_physician_name, modality, study_index, patient_id, patient_name, patient_sex, instance_total_count) VALUES (1, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '', '', '', '20241119', '154717', 0, '', '', '', '', 1, '2212', '테스트이름2212', 'M', 0);
INSERT INTO public.spacs_series (index, create_datetime, modified_datetime, series_description, procedure_description, series_instance_uid, series_date, series_time, series_number, protocol_name, operators_name, performing_physician_name, modality, study_index, patient_id, patient_name, patient_sex, instance_total_count) VALUES (2, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'series desc', 'procedure desc', '1.2.3.6.1', '20241119', '154717', 1, 'protocol name1', 'operator name', 'performing physician name', 'SC', 1, '2212', '테스트이름2212', 'M', 0);
INSERT INTO public.spacs_series (index, create_datetime, modified_datetime, series_description, procedure_description, series_instance_uid, series_date, series_time, series_number, protocol_name, operators_name, performing_physician_name, modality, study_index, patient_id, patient_name, patient_sex, instance_total_count) VALUES (3, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'seriesdesc 2.2.2.2.1', 'seriesd 2.2.2.2.1', '2.2.2.2.1', '20241119', '154717', 1, 'protocol', 'strOperatorsName222221', 'strPerformingPhysicianName22221', 'SC', 3, '2222', 'test11111', 'F', 1);


--
-- TOC entry 3647 (class 0 OID 44719)
-- Dependencies: 239
-- Data for Name: spacs_study; Type: TABLE DATA; Schema: public; Owner: spacs
--

INSERT INTO public.spacs_study (index, create_datetime, modified_datetime, study_id, study_description, study_instance_uid, study_date, study_time, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, presentation_label, specific_character_set, issuerofpatient_id, sop_class_uid, patient_age, admitting_diagnoses_description, patient_index, patient_id, patient_name, patient_sex, patient_comments, patient_size, patient_weight, occupation, series_total_count) VALUES (2, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'id1', 'desc', '1.2.3.6', '20241119', '154717', '', '', '', 'accession_number1', '', '', '', '1.2.3.4.5.5.555', '11Y', '', 1, '1212', '테스트이름1212', 'M', 'calling', 'small', '55Kg', 'student', 0);
INSERT INTO public.spacs_study (index, create_datetime, modified_datetime, study_id, study_description, study_instance_uid, study_date, study_time, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, presentation_label, specific_character_set, issuerofpatient_id, sop_class_uid, patient_age, admitting_diagnoses_description, patient_index, patient_id, patient_name, patient_sex, patient_comments, patient_size, patient_weight, occupation, series_total_count) VALUES (1, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', '', '', '', '20241119', '154717', '', '', '', '', '', '', '', '', '3Y', '', 2, '2212', '테스트이름2212', 'M', '', '', '', '', 2);
INSERT INTO public.spacs_study (index, create_datetime, modified_datetime, study_id, study_description, study_instance_uid, study_date, study_time, nameofphysicians_reading_study, referring_physician_name, attending_physicians_name, accession_number, presentation_label, specific_character_set, issuerofpatient_id, sop_class_uid, patient_age, admitting_diagnoses_description, patient_index, patient_id, patient_name, patient_sex, patient_comments, patient_size, patient_weight, occupation, series_total_count) VALUES (3, '2024-11-19 15:47:17.169365+09', '2024-11-19 15:47:17.169365+09', 'studyid2.2.2.2', 'studydesc 2.2.2.2', '2.2.2.2', '20241119', '154717', 'nameofphysicianreading', 'referringphysician', 'attendingphysician', 'accessnum2.2.2.2', 'P', 'UTF-8', 'IssuerOfPID', '2.2.2.2', '12Y', 'Admitting dignoses Description', 4, '2222', 'test11111', 'F', 'abcdef', 'small', '56Kg', 'student on middle school', 1);


--
-- TOC entry 3672 (class 0 OID 0)
-- Dependencies: 218
-- Name: SImage_id_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public."SImage_id_seq"', 7, true);


--
-- TOC entry 3673 (class 0 OID 0)
-- Dependencies: 230
-- Name: s_devices_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_devices_index_seq', 1, true);


--
-- TOC entry 3674 (class 0 OID 0)
-- Dependencies: 221
-- Name: s_image_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_image_index_seq', 87, true);


--
-- TOC entry 3675 (class 0 OID 0)
-- Dependencies: 223
-- Name: s_order_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_order_index_seq', 1, false);


--
-- TOC entry 3676 (class 0 OID 0)
-- Dependencies: 225
-- Name: s_patient_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_patient_index_seq', 5, true);


--
-- TOC entry 3677 (class 0 OID 0)
-- Dependencies: 227
-- Name: s_series_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_series_index_seq', 12, true);


--
-- TOC entry 3678 (class 0 OID 0)
-- Dependencies: 232
-- Name: s_storage_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_storage_index_seq', 1, true);


--
-- TOC entry 3679 (class 0 OID 0)
-- Dependencies: 229
-- Name: s_study_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.s_study_index_seq', 17, true);


--
-- TOC entry 3680 (class 0 OID 0)
-- Dependencies: 242
-- Name: spacs_image_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.spacs_image_index_seq', 3, true);


--
-- TOC entry 3681 (class 0 OID 0)
-- Dependencies: 234
-- Name: spacs_mwl_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.spacs_mwl_index_seq', 11, true);


--
-- TOC entry 3682 (class 0 OID 0)
-- Dependencies: 236
-- Name: spacs_patient_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.spacs_patient_index_seq', 4, true);


--
-- TOC entry 3683 (class 0 OID 0)
-- Dependencies: 240
-- Name: spacs_series_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.spacs_series_index_seq', 3, true);


--
-- TOC entry 3684 (class 0 OID 0)
-- Dependencies: 238
-- Name: spacs_study_index_seq; Type: SEQUENCE SET; Schema: public; Owner: spacs
--

SELECT pg_catalog.setval('public.spacs_study_index_seq', 3, true);


--
-- TOC entry 3445 (class 2606 OID 16468)
-- Name: SImage SImage_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public."SImage"
    ADD CONSTRAINT "SImage_pkey" PRIMARY KEY (id);


--
-- TOC entry 3447 (class 2606 OID 16470)
-- Name: _prisma_migrations _prisma_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public._prisma_migrations
    ADD CONSTRAINT _prisma_migrations_pkey PRIMARY KEY (id);


--
-- TOC entry 3459 (class 2606 OID 16738)
-- Name: s_devices s_devices_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_devices
    ADD CONSTRAINT s_devices_pkey PRIMARY KEY (index);


--
-- TOC entry 3449 (class 2606 OID 16472)
-- Name: s_image s_image_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_image
    ADD CONSTRAINT s_image_pkey PRIMARY KEY (index);


--
-- TOC entry 3451 (class 2606 OID 16474)
-- Name: s_order s_order_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_order
    ADD CONSTRAINT s_order_pkey PRIMARY KEY (index);


--
-- TOC entry 3453 (class 2606 OID 16476)
-- Name: s_patient s_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_patient
    ADD CONSTRAINT s_patient_pkey PRIMARY KEY (index);


--
-- TOC entry 3455 (class 2606 OID 16478)
-- Name: s_series s_series_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_series
    ADD CONSTRAINT s_series_pkey PRIMARY KEY (index);


--
-- TOC entry 3461 (class 2606 OID 16800)
-- Name: s_storage s_storage_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_storage
    ADD CONSTRAINT s_storage_pkey PRIMARY KEY (index);


--
-- TOC entry 3457 (class 2606 OID 16480)
-- Name: s_study s_study_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_study
    ADD CONSTRAINT s_study_pkey PRIMARY KEY (index);


--
-- TOC entry 3471 (class 2606 OID 44810)
-- Name: spacs_image spacs_image_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_image
    ADD CONSTRAINT spacs_image_pkey PRIMARY KEY (index);


--
-- TOC entry 3463 (class 2606 OID 44699)
-- Name: spacs_mwl spacs_mwl_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_mwl
    ADD CONSTRAINT spacs_mwl_pkey PRIMARY KEY (index);


--
-- TOC entry 3465 (class 2606 OID 44717)
-- Name: spacs_patient spacs_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_patient
    ADD CONSTRAINT spacs_patient_pkey PRIMARY KEY (index);


--
-- TOC entry 3469 (class 2606 OID 44783)
-- Name: spacs_series spacs_series_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_series
    ADD CONSTRAINT spacs_series_pkey PRIMARY KEY (index);


--
-- TOC entry 3467 (class 2606 OID 44752)
-- Name: spacs_study spacs_study_pkey; Type: CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_study
    ADD CONSTRAINT spacs_study_pkey PRIMARY KEY (index);


--
-- TOC entry 3477 (class 2606 OID 44753)
-- Name: spacs_study Patient_IndexForeignKey; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_study
    ADD CONSTRAINT "Patient_IndexForeignKey" FOREIGN KEY (patient_index) REFERENCES public.spacs_patient(index);


--
-- TOC entry 3479 (class 2606 OID 44811)
-- Name: spacs_image Series_IndexForeignKey; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_image
    ADD CONSTRAINT "Series_IndexForeignKey" FOREIGN KEY (series_index) REFERENCES public.spacs_series(index);


--
-- TOC entry 3478 (class 2606 OID 44784)
-- Name: spacs_series Study_IndexForeignKey; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.spacs_series
    ADD CONSTRAINT "Study_IndexForeignKey" FOREIGN KEY (study_index) REFERENCES public.spacs_study(index);


--
-- TOC entry 3476 (class 2606 OID 16481)
-- Name: s_study fk_patient_index; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_study
    ADD CONSTRAINT fk_patient_index FOREIGN KEY (patient_index) REFERENCES public.s_patient(index) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 3475 (class 2606 OID 16486)
-- Name: s_series fk_patient_index; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_series
    ADD CONSTRAINT fk_patient_index FOREIGN KEY (patient_index) REFERENCES public.s_patient(index) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 3472 (class 2606 OID 16491)
-- Name: s_image fk_patient_index; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_image
    ADD CONSTRAINT fk_patient_index FOREIGN KEY (patient_index) REFERENCES public.s_patient(index) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 3473 (class 2606 OID 16496)
-- Name: s_image fk_series_index; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_image
    ADD CONSTRAINT fk_series_index FOREIGN KEY (series_index) REFERENCES public.s_series(index) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 3474 (class 2606 OID 16501)
-- Name: s_image fk_study_index; Type: FK CONSTRAINT; Schema: public; Owner: spacs
--

ALTER TABLE ONLY public.s_image
    ADD CONSTRAINT fk_study_index FOREIGN KEY (study_index) REFERENCES public.s_study(index) ON UPDATE CASCADE ON DELETE CASCADE;


-- Completed on 2024-12-26 07:33:41 UTC

--
-- PostgreSQL database dump complete
--

