Skip to content

Commit 5012028

Browse files
Scripts modified
1 parent 4d915bb commit 5012028

File tree

3 files changed

+112
-4
lines changed

3 files changed

+112
-4
lines changed

src/main/resources/db/migration/db1097identity/V2__DB_1097_IDENTITY.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,25 @@ EXECUTE stmt1;
1919
DEALLOCATE PREPARE stmt1 $$
2020
Delimiter ;
2121

22+
Delimiter $$
23+
SET @dbname = "db_1097_identity";
24+
SET @tablename = "i_beneficiarydetails";
25+
SET @columnname = "faceEmbedding";
26+
SET @preparedStatement = (select if (
27+
exists(
28+
SELECT Distinct column_name FROM INFORMATION_SCHEMA.COLUMNS
29+
WHERE
30+
(table_name = @tablename)
31+
AND (table_schema = @dbname)
32+
AND (column_name = @columnname)
33+
)
34+
,'select ''Column exists'';'
35+
,CONCAT("ALTER TABLE ", @tablename, " ADD ", @columnname, " longtext after Others;")) );
36+
PREPARE stmt1 FROM @preparedStatement;
37+
EXECUTE stmt1;
38+
DEALLOCATE PREPARE stmt1 $$
39+
Delimiter ;
40+
41+
42+
43+

src/main/resources/db/migration/dbiemr/V2__DB_IEMR.sql

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,33 @@ CREATE TABLE if not exists `t_mapsectionprojects` (
6161
CONSTRAINT `FK_t_Mapsectionprojects_SectionID` FOREIGN KEY (`SectionID`) REFERENCES `m_registrationsections` (`SectionID`)
6262
) ;
6363

64+
CREATE TABLE if not exists `t_registrationfields` (
65+
`ID` int NOT NULL AUTO_INCREMENT,
66+
`SectionID` int DEFAULT NULL,
67+
`FieldName` varchar(50) NOT NULL,
68+
`FieldTitle` varchar(50) DEFAULT NULL,
69+
`FieldTypeID` int DEFAULT NULL,
70+
`FieldType` varchar(50) NOT NULL,
71+
`AllowMin` int DEFAULT NULL,
72+
`AllowMax` int DEFAULT NULL,
73+
`Rank` int NOT NULL,
74+
`AllowText` varchar(50) DEFAULT NULL,
75+
`IsRequired` bit(1) DEFAULT b'0',
76+
`Options` varchar(100) DEFAULT NULL,
77+
`IsEditable` bit(1) DEFAULT b'1',
78+
`Placeholder` varchar(100) DEFAULT NULL,
79+
`Deleted` bit(1) DEFAULT b'0',
80+
`Processed` char(4) NOT NULL DEFAULT 'N',
81+
`CreatedBy` varchar(50) NOT NULL,
82+
`CreatedDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
83+
`ModifiedBy` varchar(50) DEFAULT NULL,
84+
`LastModDate` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
85+
`ServiceProviderID` int DEFAULT NULL,
86+
PRIMARY KEY (`ID`),
87+
KEY `FK_t_registrationsections_SectionID` (`SectionID`),
88+
CONSTRAINT `FK_t_registrationsections_SectionID` FOREIGN KEY (`SectionID`) REFERENCES `m_registrationsections` (`SectionID`)
89+
) ;
90+
6491
CREATE TABLE if not exists `t_projectservicelinemapping` (
6592
`ID` int NOT NULL AUTO_INCREMENT,
6693
`ServiceLineId` int NOT NULL,
@@ -229,6 +256,46 @@ CREATE
229256
(`a`.`Rank` IS NOT NULL);
230257

231258

259+
USE `db_iemr`;
260+
CREATE
261+
262+
OR REPLACE VIEW `v_get_prkngplc_dist_zone_state_from_spid` AS
263+
SELECT
264+
`m_sp`.`ProviderServiceMapID` AS `ProviderServiceMapID`,
265+
`m_sp`.`ServicePointID` AS `ServicePointID`,
266+
`m_sp`.`ParkingPlaceID` AS `ParkingPlaceID`,
267+
`m_pp`.`ParkingPlaceName` AS `ParkingPlaceName`,
268+
`m_ppsdm`.`DistrictID` AS `DistrictID`,
269+
`m_d`.`DistrictName` AS `DistrictName`,
270+
`m_zdm`.`ZoneID` AS `ZoneID`,
271+
`m_z`.`ZoneName` AS `ZoneName`,
272+
`m_d`.`StateID` AS `StateID`,
273+
`m_s`.`StateName` AS `StateName`,
274+
`m_b`.`BlockID` AS `blockid`,
275+
`m_b`.`BlockName` AS `blockname`
276+
FROM
277+
((((((((`m_servicepoint` `m_sp`
278+
JOIN `m_parkingplacesubdistrictmap` `m_ppsdm` ON (((`m_sp`.`ParkingPlaceID` = `m_ppsdm`.`ParkingPlaceID`)
279+
AND (`m_sp`.`ProviderServiceMapID` = `m_ppsdm`.`ProviderServiceMapID`)
280+
AND ((0 <> `m_ppsdm`.`Deleted`) IS FALSE))))
281+
JOIN `m_zonedistrictmap` `m_zdm` ON (((`m_zdm`.`DistrictID` = `m_ppsdm`.`DistrictID`)
282+
AND (`m_zdm`.`ProviderServiceMapID` = `m_ppsdm`.`ProviderServiceMapID`)
283+
AND ((0 <> `m_zdm`.`Deleted`) IS FALSE))))
284+
JOIN `m_parkingplace` `m_pp` ON (((`m_sp`.`ParkingPlaceID` = `m_pp`.`ParkingPlaceID`)
285+
AND ((0 <> `m_pp`.`Deleted`) IS FALSE))))
286+
JOIN `m_district` `m_d` ON (((`m_d`.`DistrictID` = `m_zdm`.`DistrictID`)
287+
AND ((0 <> `m_d`.`Deleted`) IS FALSE))))
288+
JOIN `m_districtblock` `m_b` ON ((`m_b`.`DistrictID` = `m_d`.`DistrictID`)))
289+
JOIN `m_userservicerolemapping` `usrm` ON ((`usrm`.`Blockid` = `m_b`.`BlockID`)))
290+
JOIN `m_zone` `m_z` ON (((`m_zdm`.`ZoneID` = `m_z`.`ZoneID`)
291+
AND ((0 <> `m_z`.`Deleted`) IS FALSE))))
292+
JOIN `m_state` `m_s` ON (((`m_d`.`StateID` = `m_s`.`StateID`)
293+
AND ((0 <> `m_s`.`Deleted`) IS FALSE))))
294+
WHERE
295+
((0 <> `m_sp`.`Deleted`) IS FALSE);
296+
297+
298+
232299
Delimiter $$
233300
SET @dbname = "db_iemr";
234301
SET @tablename = "m_providerserviceaddmapping";
@@ -242,7 +309,7 @@ SET @preparedStatement = (select if (
242309
AND (column_name = @columnname)
243310
)
244311
,'select ''Column exists'';'
245-
,CONCAT("ALTER TABLE ", @tablename, " ADD ", @columnname, " INT DEFAULT NULL;")) );
312+
,CONCAT("ALTER TABLE ", @tablename, " ADD ", @columnname, " varchar(20) DEFAULT NULL;")) );
246313
PREPARE stmt1 FROM @preparedStatement;
247314
EXECUTE stmt1;
248315
DEALLOCATE PREPARE stmt1 $$
@@ -270,6 +337,26 @@ EXECUTE stmt1;
270337
DEALLOCATE PREPARE stmt1 $$
271338
Delimiter ;
272339

340+
341+
Delimiter $$
342+
SET @dbname = "db_iemr";
343+
SET @tablename = "t_benvisitdetail";
344+
SET @columnname = "AbdmFacilityID";
345+
SET @preparedStatement = (select if (
346+
exists(
347+
SELECT Distinct column_name FROM INFORMATION_SCHEMA.COLUMNS
348+
WHERE
349+
(table_name = @tablename)
350+
AND (table_schema = @dbname)
351+
AND (column_name = @columnname)
352+
)
353+
,'select ''Column exists'';'
354+
,CONCAT("ALTER TABLE ", @tablename, " ADD ", @columnname, " varchar(20) DEFAULT NULL after CarecontextLinkDate;")) );
355+
PREPARE stmt1 FROM @preparedStatement;
356+
EXECUTE stmt1;
357+
DEALLOCATE PREPARE stmt1 $$
358+
Delimiter ;
359+
273360
USE `db_iemr`;
274361
CREATE
275362

@@ -722,4 +809,3 @@ DELIMITER ;
722809

723810

724811

725-

src/main/resources/db/migration/dbreporting/V2__DB_REPORTING.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ begin
871871
and fb.providerServiceMapID=ifnull(v_psmid,fb.providerServiceMapID)
872872
and fb.ReceivedAgentID=ifnull(v_Agentid,fb.ReceivedAgentID)
873873
and fb.createdDate >=v_starttime and fb.createdDate <=v_endtime
874-
and fr2.questionid in(875,874) and fr2.answer is not null
874+
and fr2.questionid in(281,284) and fr2.answer is not null
875875
union
876876
select distinct
877877
date(fb.CreatedDate) 'Call Date',
@@ -898,7 +898,7 @@ begin
898898
and fb.providerServiceMapID=ifnull(v_psmid,fb.providerServiceMapID)
899899
and fb.ReceivedAgentID=ifnull(v_Agentid,fb.ReceivedAgentID)
900900
and fb.createdDate >=v_starttime and fb.createdDate <=v_endtime
901-
and fr2.questionid in(875,874) and fr2.answer is not null)a;
901+
and fr2.questionid in(281,284) and fr2.answer is not null)a;
902902

903903
drop temporary table if exists temp_ECDMiscarriageReport_2;
904904
create temporary table temp_ECDMiscarriageReport_2

0 commit comments

Comments
 (0)