diff --git a/bahmnicore-omod/src/main/resources/liquibase.xml b/bahmnicore-omod/src/main/resources/liquibase.xml index aef4780146..2767678244 100644 --- a/bahmnicore-omod/src/main/resources/liquibase.xml +++ b/bahmnicore-omod/src/main/resources/liquibase.xml @@ -43,7 +43,12 @@ rel2 - + + + + select count(*) from information_schema.routines WHERE ROUTINE_SCHEMA = DATABASE() AND ROUTINE_NAME = 'add_concept'; + + rel2 @@ -93,7 +98,12 @@ rel3 - + + + + select count(*) from information_schema.routines WHERE ROUTINE_SCHEMA = DATABASE() AND ROUTINE_NAME = 'add_concept_set_members'; + + rel3 @@ -151,8 +161,19 @@ rel3 + + + + SELECT COUNT(*) FROM global_property where property = 'emr.primaryIdentifierType'; + + + Introducing 'emr.primaryIdentifierType' GlobalProperty + + INSERT INTO global_property (property, uuid, description) values ('emr.primaryIdentifierType', UUID(), 'Primary identifier type for looking up patients, generating barcodes, etc'); + + - + SELECT COUNT(*) FROM global_property where property = 'emr.primaryIdentifierType' @@ -435,8 +456,14 @@ - - 3:da4167ac93f082b79d4c3af1807fc7f7 + + + + select count(*) from concept_name cn inner join concept c on cn.concept_id = c.concept_id where cn.name = 'REFERRED_OUT' + and cn.concept_name_type = 'FULLY_SPECIFIED' and c.datatype_id = (SELECT concept_datatype_id FROM concept_datatype WHERE name = 'N/A') + and c.class_id = (SELECT concept_class_id FROM concept_class WHERE name = 'Misc'); + + Add new concept to mark referred out tests set @concept_id = 0; @@ -447,7 +474,7 @@ set @answer_concept_id = 0; call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id,'REFERRED_OUT','REFERRED_OUT', 'N/A', 'Misc', true); - select @labresults_concept_id := concept_id, min(concept_id) from concept_name where name = 'LABRESULTS_CONCEPT'; + select @labresults_concept_id := concept_id, min(concept_id) from concept_name where name = 'LABRESULTS_CONCEPT' GROUP BY concept_id; set @set_concept_id = @concept_id; call add_concept_set_members (@labresults_concept_id,@set_concept_id,1); @@ -1123,17 +1150,19 @@ `property_value`=@concept_set_uuid; - - 3:2b64c9751b31b8fcc7a25f7545326632 + + + + select count(*) from global_property where property = 'order.durationUnitsConceptUuid'; + + Adding duration unit concepts and setting up associated global property set @concept_id = 0; set @concept_name_short_id = 0; set @concept_name_full_id = 0; - call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id, 'Duration Units', 'duration units', 'N/A', 'ConvSet', true); set @set_concept_id = @concept_id; - call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id, 'Days', 'days', 'N/A', 'Misc', false); call add_concept_set_members (@set_concept_id,@concept_id,1); @@ -1252,38 +1281,28 @@ update drug_order set dosing_type='org.openmrs.SimpleDosingInstructions' where dosing_type='SIMPLE'; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Introducing import status table + + CREATE TABLE import_status ( + id INT AUTO_INCREMENT NOT NULL, + original_file_name VARCHAR(500) NOT NULL, + saved_file_name VARCHAR(500) NOT NULL, + error_file_name VARCHAR(500) NULL, + type VARCHAR(25) NOT NULL, + status VARCHAR(25) NOT NULL, + successful_records NUMERIC(6) NULL, + failed_records NUMERIC(6) NULL, + stage_name VARCHAR(10) NULL, + stack_trace TEXT NULL, + uploaded_by VARCHAR(20) NOT NULL, + start_time TIMESTAMP NULL DEFAULT NULL, + end_time TIMESTAMP NULL DEFAULT NULL, + CONSTRAINT import_status_pk PRIMARY KEY (id)); + @@ -1365,8 +1384,14 @@ - - 3:ed9c04ea91806b2e8c789fad21d92302 + + + + select count(*) from concept_name cn inner join concept c on cn.concept_id = c.concept_id where cn.name = 'LAB_REPORT' + and cn.concept_name_type = 'FULLY_SPECIFIED' and c.datatype_id = (SELECT concept_datatype_id FROM concept_datatype WHERE name = 'TEXT') + and c.class_id = (SELECT concept_class_id FROM concept_class WHERE name = 'URL'); + + Add new concept LAB REPORT for uploaded file set @concept_id = 0; @@ -1377,7 +1402,7 @@ set @answer_concept_id = 0; call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id,'LAB_REPORT','LAB_REPORT', 'Text', 'URL', true); - select @labresults_concept_id := concept_id, min(concept_id) from concept_name where name = 'LABRESULTS_CONCEPT'; + select @labresults_concept_id := concept_id, min(concept_id) from concept_name where name = 'LABRESULTS_CONCEPT' GROUP BY concept_id; set @set_concept_id = @concept_id; call add_concept_set_members (@labresults_concept_id,@set_concept_id,1); @@ -3527,23 +3552,48 @@ New roles and privileges for bahmni - - + + - select count(*) from role where role = 'Bahmni-User' + select count(*) from users where system_id='superman'; + + + Adding superman user + + SET @puuid = uuid(); + INSERT INTO person(gender, birthdate_estimated, dead, creator, date_created, uuid) VALUES('M', 0, 0, 1, now(), @puuid); + SELECT person_id INTO @person_id from person where uuid = @puuid; + INSERT INTO person_name(person_id, preferred, given_name, family_name, creator, date_created, uuid) VALUES(@person_id, 1, 'Super', 'Man', 1, now(), @puuid); + INSERT INTO users(system_id, creator, date_created, person_id, uuid, username, password, salt) VALUES ('superman', 1, now(),@person_id, uuid(), 'superman', 'e28e3ae84c66bfba6b2c50a406567f3e34fea1d76b17c006931571fe5d940f6c6b81e49cf8ea5e0adfca19fe3beb68d8ad79f7c3812e92b8d502a9afcf2029b2', '1c9d7e94aeeb7a2459ef45ed200b2944582e0e7088d75f9b57a3644861ea766c20a269b3fe2eadaff1bc445ecfbd9bd3c0c550dfd813de48d39423cd3d1a8b10'); + INSERT INTO provider (person_id, identifier, creator, date_created, uuid, name) VALUES (@person_id, 'superman', 1, now(), uuid(), 'superman'); + + + + + + select count(*) from users where system_id = 'admin' or system_id = 'superman' Map users to new roles set @id = NULL; - select user_id from users where username='admin' into @id; - INSERT INTO `user_role` VALUES (@id, 'bypass2FA'),(@id,'Provider'),(@id,'System Developer'); - - select user_id from users where username='reports-user' into @id; - INSERT INTO `user_role` VALUES (@id, 'Reports-App'); + select user_id from users where system_id='admin' into @id; + INSERT IGNORE INTO `user_role` VALUES (@id,'Provider'),(@id,'System Developer'); - select user_id from users where username='superman' into @id; - INSERT INTO `user_role` VALUES (@id,'Provider'),(@id,'System Developer'), (@id, 'SuperAdmin'); + select user_id from users where system_id='superman' into @id; + INSERT IGNORE INTO `user_role` VALUES (@id,'Provider'),(@id,'System Developer'), (@id, 'SuperAdmin'); + + + + + + select count(*) from role where role = 'Reports-App'; + + + Map 'reports-user' user to new roles + + select user_id from users where username = 'reports-user' into @id; + INSERT IGNORE INTO `user_role` VALUES (@id, 'Reports-App'); @@ -3872,8 +3922,9 @@ - + + 3:2b48153e296e929a8c7fe8bd519654ec SELECT COUNT(*) FROM concept where concept_id in (select concept_id from concept_name where @@ -3959,8 +4010,9 @@ INSERT IGNORE INTO role_privilege (role, privilege) SELECT * FROM (SELECT 'Clinical-App-Read-Only', 'Get Forms') AS tmp WHERE EXISTS ( SELECT role FROM role WHERE role = 'Clinical-App-Read-Only' ); - + + 3:a735e6b93635ffb2bc7e6a01a24407c3 SELECT COUNT(*) FROM concept where concept_id in (select concept_id from concept_name where @@ -4330,6 +4382,31 @@ INSERT INTO role_privilege(role, privilege) VALUES ("OT: ReadOnly", "app:ot"); + + + + + + + + Creating view concept + + SELECT concept.concept_id, concept_full_name.name AS concept_full_name, concept_short_name.name + AS concept_short_name, concept_class.name AS concept_class_name,concept_datatype.name + AS concept_datatype_name,concept.retired,concept_description.description,concept.date_created + AS date_created FROM concept LEFT OUTER JOIN concept_name AS concept_full_name + ON concept_full_name.concept_id = concept.concept_id AND concept_full_name.concept_name_type = + 'FULLY_SPECIFIED' + AND concept_full_name.locale = 'en' AND concept_full_name.voided = 0 + LEFT OUTER JOIN concept_name AS concept_short_name ON concept_short_name.concept_id = concept.concept_id + AND concept_short_name.concept_name_type = 'SHORT'AND concept_short_name.locale = 'en' AND + concept_short_name.voided = 0 + LEFT OUTER JOIN concept_class ON concept_class.concept_class_id = concept.class_id + LEFT OUTER JOIN concept_datatype ON concept_datatype.concept_datatype_id = concept.datatype_id + LEFT OUTER JOIN concept_description ON concept_description.concept_id = concept.concept_id; + + + @@ -4397,7 +4474,6 @@ Override SQL query for Get Patient Details in Ward - @@ -4437,4 +4513,15 @@ + + + + select count(*) from role_privilege where role = 'Anonymous' and privilege = 'Get Locations'; + + + Assign the 'Get Locations' previlege to the Anonymous user + + INSERT INTO role_privilege (role, privilege) VALUES ('Anonymous', 'Get Locations'); + +