generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cnde 1844: Migrate Case Management SAS logic to RTR SQL (#77)
- Loading branch information
Showing
4 changed files
with
180 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
.../main/resources/db/rdb_modern/tables/020-create_nrt_investigation_case_management-001.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation_case_management' and xtype = 'U') | ||
CREATE TABLE dbo.nrt_investigation_case_management | ||
( | ||
public_health_case_uid bigint NULL, | ||
case_management_uid bigint NULL, | ||
act_ref_type_cd varchar(20) NULL, | ||
adi_900_status_cd varchar(20) NULL, | ||
adi_complexion varchar(20) NULL, | ||
adi_ehars_id varchar(10) NULL, | ||
adi_hair varchar(20) NULL, | ||
adi_height varchar(20) NULL, | ||
adi_height_legacy_case varchar(20) NULL, | ||
adi_other_identifying_info varchar(2000) NULL, | ||
adi_size_build varchar(20) NULL, | ||
ca_init_intvwr_assgn_dt datetime NULL, | ||
ca_interviewer_assign_dt datetime NULL, | ||
ca_patient_intv_status varchar(29) NULL, | ||
case_oid bigint NULL, | ||
case_review_status varchar(20) NULL, | ||
case_review_status_date datetime NULL, | ||
cc_closed_dt datetime NULL, | ||
epi_link_id varchar(20) NULL, | ||
field_foll_up_ooj_outcome varchar(20) NULL, | ||
fl_fup_actual_ref_type varchar(15) NULL, | ||
fl_fup_dispo_dt datetime NULL, | ||
fl_fup_disposition_cd varchar(20) NULL, | ||
fl_fup_disposition_desc varchar(44) NULL, | ||
fl_fup_exam_dt datetime NULL, | ||
fl_fup_expected_dt datetime NULL, | ||
fl_fup_expected_in_ind varchar(3) NULL, | ||
fl_fup_field_record_num varchar(20) NULL, | ||
fl_fup_init_assgn_dt datetime NULL, | ||
fl_fup_internet_outcome varchar(41) NULL, | ||
fl_fup_internet_outcome_cd varchar(10) NULL, | ||
fl_fup_investigator_assgn_dt datetime NULL, | ||
fl_fup_notification_plan_cd varchar(15) NULL, | ||
fl_fup_ooj_outcome varchar(44) NULL, | ||
fl_fup_prov_diagnosis varchar(3) NULL, | ||
fl_fup_prov_exm_reason varchar(43) NULL, | ||
fld_foll_up_expected_in varchar(20) NULL, | ||
fld_foll_up_notification_plan varchar(20) NULL, | ||
fld_foll_up_prov_diagnosis varchar(20) NULL, | ||
fld_foll_up_prov_exm_reason varchar(20) NULL, | ||
init_fup_clinic_code varchar(50) NULL, | ||
init_fup_closed_dt datetime NULL, | ||
init_fup_initial_foll_up varchar(22) NULL, | ||
init_fup_initial_foll_up_cd varchar(20) NULL, | ||
init_fup_internet_foll_up_cd varchar(20) NULL, | ||
init_foll_up_notifiable varchar(36) NULL, | ||
init_fup_notifiable_cd varchar(20) NULL, | ||
initiating_agncy varchar(100) NULL, | ||
internet_foll_up varchar(3) NULL, | ||
ooj_agency varchar(100) NULL, | ||
ooj_due_date datetime NULL, | ||
ooj_initg_agncy_outc_due_date datetime NULL, | ||
ooj_initg_agncy_outc_snt_date datetime NULL, | ||
ooj_initg_agncy_recd_date datetime NULL, | ||
ooj_number varchar(20) NULL, | ||
pat_intv_status_cd varchar(20) NULL, | ||
status_900 varchar(44) NULL, | ||
surv_closed_dt datetime NULL, | ||
surv_investigator_assgn_dt datetime NULL, | ||
surv_patient_foll_up varchar(20) NULL, | ||
surv_patient_foll_up_cd varchar(22) NULL, | ||
surv_prov_exm_reason varchar(20) NULL, | ||
surv_provider_contact varchar(27) NULL, | ||
surv_provider_contact_cd varchar(20) NULL, | ||
surv_provider_diagnosis varchar(20) NULL, | ||
surv_provider_exam_reason varchar(43) NULL, | ||
add_user_id bigint NULL, | ||
refresh_datetime datetime2(7) GENERATED ALWAYS AS ROW START NOT NULL, | ||
max_datetime datetime2(7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL, | ||
PERIOD FOR SYSTEM_TIME (refresh_datetime, max_datetime) | ||
); |
13 changes: 13 additions & 0 deletions
13
...ervice/src/main/resources/db/rdb_modern/tables/021-create_nrt_case_management_key-001.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DROP TABLE IF EXISTS dbo.nrt_case_management_key; | ||
|
||
CREATE TABLE dbo.nrt_case_management_key ( | ||
d_case_management_key bigint IDENTITY(1,1) NOT NULL, | ||
public_health_case_uid bigint NULL | ||
); | ||
|
||
declare @max bigint; | ||
select @max=max(D_CASE_MANAGEMENT_KEY)+1 from dbo.D_CASE_MANAGEMENT; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 1 | ||
DBCC CHECKIDENT ('dbo.nrt_case_management_key', RESEED, @max); |