NINS_CODE/bahmni_config/openmrs/migrations/openmrs-visits-liquibase.xml

138 lines
6.8 KiB
XML
Raw Normal View History

2024-12-12 22:37:39 +06:00
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<!-- This Liquibase file is meant to contain changesets for Visit Related Information Only -->
<changeSet id="BAHMNI-IMPL-OMRS-V-001" author="tw">
<comment>Create new visit type for inpatient</comment>
<insert tableName="visit_type">
<column name="name" value="inpatient" />
<column name="description" value="Visit for patients being admitted" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-002" author="tw">
<comment>Create new visit type for outpatient</comment>
<insert tableName="visit_type">
<column name="name" value="outpatient" />
<column name="description" value="Visit for patients coming for Out Patient" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-003" author="tw">
<comment>Add global property to configure visit auto expire hours</comment>
<sql>
INSERT INTO global_property (`property`, `property_value`, `description`, `uuid`)
VALUES ('emrapi.visitExpireHours', '24', 'Number of hours after which visit can be auto closed', uuid())
ON DUPLICATE KEY UPDATE property_value = '24';
</sql>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-005" author="tw">
<comment>Delete OpenMRS property autoCloseVisitType since we don't use that scheduler (to avoid confusion)</comment>
<sql>
DELETE FROM global_property WHERE property like '%visits.autoCloseVisitType%';
</sql>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-006" author="tw">
<comment>Delete OpenMRS property visits.autoCloseMinimumNumberOfDays since we don't use that scheduler (to avoid confusion)</comment>
<sql>
DELETE FROM global_property WHERE property like '%visits.autoCloseMinimumNumberOfDays%';
</sql>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-007" author="tw">
<comment>Delete OpenMRS scheduler AutoCloseVisitsTask since we don't use that scheduler (to avoid confusion)</comment>
<delete tableName="scheduler_task_config">
<where>schedulable_class = 'org.openmrs.scheduler.tasks.AutoCloseVisitsTask'</where>
</delete>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-008" author="tw">
<comment>Add Bahmni preferred EMR API scheduler which closes stale visits</comment>
<insert tableName="scheduler_task_config">
<column name="name" value="Close Stale Visits Task" />
<column name="description" value="Auto close visit task after number of hours specified by emrapi.visitExpireHours" />
<column name="schedulable_class" value="org.openmrs.module.emrapi.adt.CloseStaleVisitsTask" />
<column name="start_on_startup" valueBoolean="true" />
<column name="start_time_pattern" value="MM/dd/yyyy HH:mm:ss" />
<column name="start_time" valueDate="2014-04-30T23:59:59" />
<column name="repeat_interval" value="86400" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
<column name="created_by" value="1" />
<column name="uuid" valueComputed="uuid()" />
</insert>
</changeSet>
<changeSet id="BAHMNI-IMPL-OMRS-V-010" author="tw">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
SELECT COUNT(*) FROM visit_type where name = 'emergency';
</sqlCheck>
</preConditions>
<comment>Create new visit type for Emergency</comment>
<insert tableName="visit_type">
<column name="name" value="emergency" />
<column name="description" value="Emergency patient visit" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
<changeSet id="BD-V-201504221612" author="neha">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
SELECT COUNT(*) FROM visit_type where name = 'ambulatory';
</sqlCheck>
</preConditions>
<comment>Create new visit type for Ambulatory</comment>
<insert tableName="visit_type">
<column name="name" value="ambulatory" />
<column name="description" value="Ambulatory patient visit" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
<changeSet id="BD-V-201504221613" author="neha">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
SELECT COUNT(*) FROM visit_type where name = 'home';
</sqlCheck>
</preConditions>
<comment>Create new visit type for Home</comment>
<insert tableName="visit_type">
<column name="name" value="home" />
<column name="description" value="Home patient visit" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
<changeSet id="BD-V-201504221614" author="neha">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
SELECT COUNT(*) FROM visit_type where name = 'field';
</sqlCheck>
</preConditions>
<comment>Create new visit type for Field</comment>
<insert tableName="visit_type">
<column name="name" value="field" />
<column name="description" value="Field patient visit" />
<column name="creator" value="1" />
<column name="uuid" valueComputed="uuid()" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
</insert>
</changeSet>
</databaseChangeLog>