Skip to content

Commit

Permalink
CNDIT-1729: Update observation services for Montana reports (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
sveselev authored Sep 25, 2024
1 parent 084997d commit 4a8cbbc
Show file tree
Hide file tree
Showing 13 changed files with 1,013 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,10 @@ databaseChangeLog:
- sqlFile:
path: 010-sp_investigation_event-002.sql
splitStatements: false
- changeSet:
id: 24
author: liquibase
changes:
- sqlFile:
path: 021_sp_observation_event-001.sql
splitStatements: false
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,10 @@ databaseChangeLog:
- sqlFile:
path: 015-sp_nrt_ldf_postprocessing-001.sql
splitStatements: false
- changeSet:
id: 37
author: liquibase
changes:
- sqlFile:
path: 017-create_nrt_observation-003.sql
splitStatements: false

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = 'U')
BEGIN
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ctrl_cd_display_form' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD ctrl_cd_display_form varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'obs_domain_cd_st_1' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD obs_domain_cd_st_1 varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'processing_decision_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD processing_decision_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'shared_ind' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD shared_ind char(1);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'status_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD status_cd char(1);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd_system_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd_system_cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd_system_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd_system_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ctrl_cd_user_defined_1' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD ctrl_cd_user_defined_1 varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_desc_txt varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_system_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_system_cd varchar(300);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_system_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_system_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'method_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD method_cd varchar(2000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'method_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD method_desc_txt varchar(2000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'target_site_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD target_site_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'target_site_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD target_site_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD txt varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'interpretation_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD interpretation_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'interpretation_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD interpretation_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_observation_uid' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_observation_uid bigint;
END;

IF EXISTS(SELECT 1 FROM sys.columns col JOIN sys.types t on col.user_type_id = t.user_type_id
WHERE col.name = N'result_observation_uid' AND t.name = 'bigint' AND col.object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ALTER COLUMN result_observation_uid nvarchar(max);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'followup_observation_uid' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD followup_observation_uid nvarchar(max);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_refr_uid' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_refr_uid bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_sprt_uid' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_sprt_uid bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_physician_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_physician_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_reporter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_reporter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_val' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_val varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_first_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_first_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_last_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_last_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_val' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_val varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_first_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_first_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_last_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_last_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'result_interpreter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD result_interpreter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'specimen_collector_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD specimen_collector_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'copy_to_provider_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD copy_to_provider_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'lab_test_technician_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD lab_test_technician_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'health_care_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD health_care_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_hosp_reporter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_hosp_reporter_id bigint;
END;
END;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public class Observation {
@Column(name = "mood_cd")
private String moodCd;

@Column(name = "interpretation_cd")
private String interpretationCd;

@Column(name = "interpretation_desc_txt")
private String interpretationDescTxt;

@Id
@Column(name = "observation_uid")
private Long observationUid;
Expand Down Expand Up @@ -60,6 +66,9 @@ public class Observation {
@Column(name = "electronic_ind")
private Character electronicInd;

@Column(name = "version_ctrl_nbr")
private Short versionCtrlNbr;

@Column(name = "ctrl_cd_display_form")
private String ctrlCdDisplayForm;

Expand All @@ -72,8 +81,44 @@ public class Observation {
@Column(name = "shared_ind")
private Character sharedInd;

@Column(name = "version_ctrl_nbr")
private Short versionCtrlNbr;
@Column(name = "status_cd")
private String statusCd;

@Column(name = "cd_system_cd")
private String cdSystemCd;

@Column(name = "cd_system_desc_txt")
private String cdSystemDescTxt;

@Column(name = "ctrl_cd_user_defined_1")
private String ctrlCdUserDefined1;

@Column(name = "alt_cd")
private String altCd;

@Column(name = "alt_cd_desc_txt")
private String altCdDescTxt;

@Column(name = "alt_cd_system_cd")
private String altCdSystemCd;

@Column(name = "alt_cd_system_desc_txt")
private String altCdSystemDescTxt;

@Column(name = "method_cd")
private String methodCd;

@Column(name = "method_desc_txt")
private String methodDescTxt;

@Column(name = "target_site_cd")
private String targetSiteCd;

@Column(name = "target_site_desc_txt")
private String targetSiteDescTxt;

@Column(name = "txt")
private String txt;

@Column(name = "add_user_id")
private Long addUserId;
Expand Down Expand Up @@ -105,7 +150,27 @@ public class Observation {
@Column(name = "followup_observations")
private String followupObservations;

@Column(name = "parent_observations")
private String parentObservations;

@Column(name = "act_ids")
private String actIds;

@Column(name = "edx_ids")
private String edxIds;

@Column(name = "obs_reason")
private String obsReason;

@Column(name = "obs_txt")
private String obsTxt;

@Column(name = "obs_code")
private String obsCode;

@Column(name = "obs_date")
private String obsDate;

@Column(name = "obs_num")
private String obsNum;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ public class ObservationTransformed {
private Long authorOrganizationId;
private Long orderingOrganizationId;
private Long materialId;
private Long resultObservationUid;
private String resultObservationUid;
private String followUpObservationUid;
private Long reportObservationUid;
private Long reportSprtUid;
private Long reportRefrUid;
}
Loading

0 comments on commit 4a8cbbc

Please sign in to comment.