/
liquibase-update-to-latest.xml
9535 lines (8949 loc) · 490 KB
/
liquibase-update-to-latest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!--
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<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">
<!--
See http://www.liquibase.org/manual/home#available_database_refactorings
for a list of supported elements and attributes
-->
<changeSet id="0" author="bwolfe">
<preConditions onError="MARK_RAN" onFail="MARK_RAN">
<sqlCheck expectedResult="The update-to-latest.sql file needs to be run on this db.">
<![CDATA[
SELECT case when REPLACE(property_value, '.', '0') >= REPLACE('1.4.0.20', '.', '0') then 'database_version greater than 1.4.0.20' else 'The update-to-latest.sql file needs to be run on this db.' end FROM global_property WHERE property = 'database_version';
]]>
</sqlCheck>
</preConditions>
<comment>Run the old sqldiff file to get database up to the 1.4.0.20 version if needed. (Requires 'mysql' to be on the PATH)</comment>
<customChange class="org.openmrs.util.databasechange.SourceMySqldiffFile">
<param name="sqlFile">update-to-1.4.2.01-db.mysqldiff.sql</param>
</customChange>
</changeSet>
<changeSet id="1" author="upul" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="person_attribute_type" columnName="edit_privilege"/></not>
</preConditions>
<comment>
Add the column to person_attribute type to connect each type to a privilege
</comment>
<addColumn tableName="person_attribute_type">
<column name="edit_privilege" type="varchar(255)" />
</addColumn>
</changeSet>
<changeSet id="2" author="upul" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><foreignKeyConstraintExists foreignKeyName="privilege_which_can_edit"/></not>
</preConditions>
<comment>
Create the foreign key from the privilege required for to edit
a person attribute type and the privilege.privilege column
</comment>
<addForeignKeyConstraint constraintName="privilege_which_can_edit"
baseTableName="person_attribute_type" baseColumnNames="edit_privilege"
referencedTableName="privilege" referencedColumnNames="privilege"/>
</changeSet>
<changeSet id="200811261102" author="bwolfe" dbms="mysql">
<comment>
Fix field property for new Tribe person attribute
</comment>
<update tableName="field">
<column name="default_value" value="$!{patient.attributeMap.Tribe.hydratedObject.tribeId}^$!{patient.attributeMap.Tribe.hydratedObject.name}"/>
<where>default_value='$!{patient.getTribe().getTribeId()}^$!{patient.getTribe().getName()}'</where>
</update>
</changeSet>
<changeSet id="200805281223" author="bmckown" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="concept_complex"/></not>
</preConditions>
<comment>
Create the concept_complex table
</comment>
<createTable tableName="concept_complex">
<column name="concept_id" type="int">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="handler" type="varchar(255)"/>
</createTable>
<addForeignKeyConstraint constraintName="concept_attributes"
baseTableName="concept_complex" baseColumnNames="concept_id"
referencedTableName="concept" referencedColumnNames="concept_id"/>
</changeSet>
<changeSet id="200805281224" author="bmckown" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="obs" columnName="value_complex"/></not>
</preConditions>
<comment>
Adding the value_complex column to obs. This may take a long time if you have a large number of observations.
</comment>
<addColumn tableName="obs">
<column name="value_complex" type="varchar(255)" />
</addColumn>
</changeSet>
<changeSet id="200805281225" author="bmckown" dbms="mysql">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
<![CDATA[
SELECT count(*) FROM concept_datatype where name='Complex';
]]>
</sqlCheck>
</preConditions>
<comment>
Adding a 'complex' Concept Datatype
</comment>
<insert tableName="concept_datatype">
<column name="name" value="Complex"/>
<column name="hl7_abbreviation" value="ED"/>
<column name="description" value="Complex value. Analogous to HL7 Embedded Datatype"/>
<column name="creator" valueNumeric="1"/>
<column name="date_created" valueDate="2008-05-28T12:25:34" />
</insert>
</changeSet>
<changeSet id="200805281226" author="bmckown" dbms="mysql">
<preConditions onFail="MARK_RAN">
<tableExists tableName="complex_obs"/>
</preConditions>
<comment>
Dropping the mimetype and complex_obs tables as they aren't needed in the new complex obs setup
</comment>
<dropTable tableName="complex_obs"/>
<dropTable tableName="mime_type"/>
</changeSet>
<changeSet id="200809191226" author="smbugua" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="hl7_in_archive" columnName="message_state"/></not>
</preConditions>
<comment>
Adding the hl7 archive message_state column so that archives can be tracked
(preCondition database_version check in place because this change was in the old format in trunk for a while)
</comment>
<addColumn tableName="hl7_in_archive">
<column name="message_state" type="int(1)" defaultValueNumeric="0" remarks="2=processed, 4=deleted" />
</addColumn>
</changeSet>
<changeSet id="200809191927" author="smbugua" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="hl7_in_queue" columnName="message_state"/></not>
</preConditions>
<comment>
Adding the hl7 archive message_state column so that archives can be tracked
</comment>
<renameColumn tableName="hl7_in_queue" oldColumnName="state" newColumnName="message_state" columnDataType="int(1)"/>
<ext:modifyColumn tableName="hl7_in_queue">
<column name="message_state" type="int(1)" defaultValueNumeric="0" remarks="0=pending, 1=processing, 2=processed, 3=error">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
</changeSet>
<changeSet id="200901101524" author="Knoll_Frank" dbms="mysql">
<comment>
Changing datatype of drug.retire_reason from DATETIME to varchar(255)
</comment>
<ext:modifyColumn tableName="drug">
<column name="retire_reason" type="varchar(255)"/>
</ext:modifyColumn>
</changeSet>
<changeSet id="200901130950" author="bwolfe" dbms="mysql">
<comment>
Remove Manage Tribes and View Tribes privileges from all roles
</comment>
<delete tableName="role_privilege">
<where>privilege='Manage Tribes' and not exists (select * from privilege where privilege = 'Manage Tribes')</where>
</delete>
<delete tableName="role_privilege">
<where>privilege='View Tribes' and not exists (select * from privilege where privilege = 'View Tribes')</where>
</delete>
</changeSet>
<changeSet id="200901130951" author="bwolfe" dbms="mysql">
<comment>
Remove Manage Mime Types, View Mime Types, and Purge Mime Types privilege
</comment>
<delete tableName="role_privilege">
<where>privilege in ('Manage Mime Types', 'View Mime Types', 'Purge Mime Types')</where>
</delete>
<delete tableName="privilege">
<where>privilege in ('Manage Mime Types', 'View Mime Types', 'Purge Mime Types')</where>
</delete>
</changeSet>
<changeSet id="200901161126" author="bwolfe" dbms="mysql">
<comment>
Removed the database_version global property
</comment>
<delete tableName="global_property">
<where>property = 'database_version'</where>
</delete>
</changeSet>
<changeSet id="20090121-0949" author="bwolfe" dbms="mysql">
<comment>
Switched the default xslt to use PV1-19 instead of PV1-1
</comment>
<!-- using the <sql> tag instead of the <update> tag here so that xml syntax highlighting doesn't bog down editors -->
<sql splitStatements="false">
<![CDATA[
UPDATE form
SET xslt = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!--\r\nOpenMRS FormEntry Form HL7 Translation\r\n\r\nThis XSLT is used to translate OpenMRS forms from XML into HL7 2.5 format\r\n\r\n@author Burke Mamlin, MD\r\n@author Ben Wolfe\r\n@version 1.9.7\r\n\r\n1.9.7 - moved encounter/encounter.encounter_id to use PV1-19 instead\r\n1.9.6 - added encounter/encounter.encounter_id to PV1-1\r\n1.9.5 - allow for organizing sections under \"obs\" section\r\n1.9.4 - add support for message uid (as HL7 control id) and transform of patient.health_center to Discharge to Location (PV1-37)\r\n1.9.3 - fixed rounding error on timestamp (tenths of seconds getting rounded up, causing \"60\" seconds in some cases) \r\n1.9.2 - first generally useful version\r\n-->\r\n\r\n<xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xdt=\"http://www.w3.org/2005/xpath-datatypes\">\r\n <xsl:output method=\"text\" version=\"1.0\" encoding=\"UTF-8\" indent=\"no\"/>\r\n\r\n<xsl:variable name=\"SENDING-APPLICATION\">FORMENTRY</xsl:variable>\r\n<xsl:variable name=\"SENDING-FACILITY\">AMRS.ELD</xsl:variable>\r\n<xsl:variable name=\"RECEIVING-APPLICATION\">HL7LISTENER</xsl:variable>\r\n<xsl:variable name=\"RECEIVING-FACILITY\">AMRS.ELD</xsl:variable>\r\n<xsl:variable name=\"PATIENT-AUTHORITY\"></xsl:variable> <!-- leave blank for internal id, max 20 characters -->\r\n <!-- for now, must match patient_identifier_type.name -->\r\n<xsl:variable name=\"FORM-AUTHORITY\">AMRS.ELD.FORMID</xsl:variable> <!-- max 20 characters -->\r\n\r\n<xsl:template match=\"/\">\r\n <xsl:apply-templates />\r\n</xsl:template>\r\n\r\n<!-- Form template -->\r\n<xsl:template match=\"form\">\r\n <!-- MSH Header -->\r\n <xsl:text>MSH|^~\\&</xsl:text> <!-- Message header, field separator, and encoding characters -->\r\n <xsl:text>|</xsl:text> <!-- MSH-3 Sending application -->\r\n <xsl:value-of select=\"$SENDING-APPLICATION\" />\r\n <xsl:text>|</xsl:text> <!-- MSH-4 Sending facility -->\r\n <xsl:value-of select=\"$SENDING-FACILITY\" />\r\n <xsl:text>|</xsl:text> <!-- MSH-5 Receiving application -->\r\n <xsl:value-of select=\"$RECEIVING-APPLICATION\" />\r\n <xsl:text>|</xsl:text> <!-- MSH-6 Receiving facility -->\r\n <xsl:value-of select=\"$RECEIVING-FACILITY\" />\r\n <xsl:text>|</xsl:text> <!-- MSH-7 Date/time message sent -->\r\n <xsl:call-template name=\"hl7Timestamp\">\r\n <xsl:with-param name=\"date\" select=\"current-dateTime()\" />\r\n </xsl:call-template>\r\n <xsl:text>|</xsl:text> <!-- MSH-8 Security -->\r\n <xsl:text>|ORU^R01</xsl:text> <!-- MSH-9 Message type ^ Event type (observation report unsolicited) -->\r\n <xsl:text>|</xsl:text> <!-- MSH-10 Message control ID -->\r\n <xsl:choose>\r\n <xsl:when test=\"header/uid\">\r\n <xsl:value-of select=\"header/uid\" />\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select=\"patient/patient.patient_id\" />\r\n <xsl:call-template name=\"hl7Timestamp\">\r\n <xsl:with-param name=\"date\" select=\"current-dateTime()\" />\r\n </xsl:call-template>\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n <xsl:text>|P</xsl:text> <!-- MSH-11 Processing ID -->\r\n <xsl:text>|2.5</xsl:text> <!-- MSH-12 HL7 version -->\r\n <xsl:text>|1</xsl:text> <!-- MSH-13 Message sequence number -->\r\n <xsl:text>|</xsl:text> <!-- MSH-14 Continuation Pointer -->\r\n <xsl:text>|</xsl:text> <!-- MSH-15 Accept Acknowledgement Type -->\r\n <xsl:text>|</xsl:text> <!-- MSH-16 Application Acknowledgement Type -->\r\n <xsl:text>|</xsl:text> <!-- MSH-17 Country Code -->\r\n <xsl:text>|</xsl:text> <!-- MSH-18 Character Set -->\r\n <xsl:text>|</xsl:text> <!-- MSH-19 Principal Language of Message -->\r\n <xsl:text>|</xsl:text> <!-- MSH-20 Alternate Character Set Handling Scheme -->\r\n <xsl:text>|</xsl:text> <!-- MSH-21 Message Profile Identifier -->\r\n <xsl:value-of select=\"@id\" />\r\n <xsl:text>^</xsl:text>\r\n <xsl:value-of select=\"$FORM-AUTHORITY\" />\r\n <xsl:text>
</xsl:text>\r\n\r\n <!-- PID header -->\r\n <xsl:text>PID</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- PID-1 Set ID -->\r\n <xsl:text>|</xsl:text> <!-- PID-2 (deprecated) Patient ID -->\r\n <xsl:text>|</xsl:text> <!-- PID-3 Patient Identifier List -->\r\n <xsl:call-template name=\"patient_id\">\r\n <xsl:with-param name=\"pid\" select=\"patient/patient.patient_id\" />\r\n <xsl:with-param name=\"auth\" select=\"$PATIENT-AUTHORITY\" />\r\n <xsl:with-param name=\"type\" select=\"L\" />\r\n </xsl:call-template>\r\n <xsl:if test=\"patient/patient.previous_mrn and string-length(patient/patient.previous_mrn) > 0\">\r\n <xsl:text>~</xsl:text>\r\n <xsl:call-template name=\"patient_id\">\r\n <xsl:with-param name=\"pid\" select=\"patient/patient.previous_mrn\" />\r\n <xsl:with-param name=\"auth\" select=\"$PATIENT-AUTHORITY\" />\r\n <xsl:with-param name=\"type\" select=\"PRIOR\" />\r\n </xsl:call-template>\r\n </xsl:if>\r\n <!-- Additional patient identifiers -->\r\n <!-- This example is for an MTCT-PLUS identifier used in the AMPATH project in Kenya (skipped if not present) -->\r\n <xsl:if test=\"patient/patient.mtctplus_id and string-length(patient/patient.mtctplus_id) > 0\">\r\n <xsl:text>~</xsl:text>\r\n <xsl:call-template name=\"patient_id\">\r\n <xsl:with-param name=\"pid\" select=\"patient/patient.mtctplus_id\" />\r\n <xsl:with-param name=\"auth\" select=\"$PATIENT-AUTHORITY\" />\r\n <xsl:with-param name=\"type\" select=\"MTCTPLUS\" />\r\n </xsl:call-template>\r\n </xsl:if>\r\n <xsl:text>|</xsl:text> <!-- PID-4 (deprecated) Alternate patient ID -->\r\n <!-- PID-5 Patient name -->\r\n <xsl:text>|</xsl:text> <!-- Family name -->\r\n <xsl:value-of select=\"patient/patient.family_name\" />\r\n <xsl:text>^</xsl:text> <!-- Given name -->\r\n <xsl:value-of select=\"patient/patient.given_name\" />\r\n <xsl:text>^</xsl:text> <!-- Middle name -->\r\n <xsl:value-of select=\"patient/patient.middle_name\" />\r\n <xsl:text>|</xsl:text> <!-- PID-6 Mother\'s maiden name -->\r\n <xsl:text>|</xsl:text> <!-- PID-7 Date/Time of Birth -->\r\n <xsl:value-of select=\"patient/patient.date_of_birth\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n \r\n <!-- PV1 header -->\r\n <xsl:text>PV1</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- PV1-1 Sub ID -->\r\n <xsl:text>|O</xsl:text> <!-- PV1-2 Patient class (O = outpatient) -->\r\n <xsl:text>|</xsl:text> <!-- PV1-3 Patient location -->\r\n <xsl:value-of select=\"encounter/encounter.location_id\" />\r\n <xsl:text>|</xsl:text> <!-- PV1-4 Admission type (2 = return) -->\r\n <xsl:text>|</xsl:text> <!-- PV1-5 Pre-Admin Number -->\r\n <xsl:text>|</xsl:text> <!-- PV1-6 Prior Patient Location -->\r\n <xsl:text>|</xsl:text> <!-- PV1-7 Attending Doctor -->\r\n <xsl:value-of select=\"encounter/encounter.provider_id\" />\r\n <xsl:text>|</xsl:text> <!-- PV1-8 Referring Doctor -->\r\n <xsl:text>|</xsl:text> <!-- PV1-9 Consulting Doctor -->\r\n <xsl:text>|</xsl:text> <!-- PV1-10 Hospital Service -->\r\n <xsl:text>|</xsl:text> <!-- PV1-11 Temporary Location -->\r\n <xsl:text>|</xsl:text> <!-- PV1-12 Preadmin Test Indicator -->\r\n <xsl:text>|</xsl:text> <!-- PV1-13 Re-adminssion Indicator -->\r\n <xsl:text>|</xsl:text> <!-- PV1-14 Admit Source -->\r\n <xsl:text>|</xsl:text> <!-- PV1-15 Ambulatory Status -->\r\n <xsl:text>|</xsl:text> <!-- PV1-16 VIP Indicator -->\r\n <xsl:text>|</xsl:text> <!-- PV1-17 Admitting Doctor -->\r\n <xsl:text>|</xsl:text> <!-- PV1-18 Patient Type -->\r\n <xsl:text>|</xsl:text> <!-- PV1-19 Visit Number -->\r\n <xsl:value-of select=\"encounter/encounter.encounter_id\" />\r\n <xsl:text>|</xsl:text> <!-- PV1-20 Financial Class -->\r\n <xsl:text>|</xsl:text> <!-- PV1-21 Charge Price Indicator -->\r\n <xsl:text>|</xsl:text> <!-- PV1-22 Courtesy Code -->\r\n <xsl:text>|</xsl:text> <!-- PV1-23 Credit Rating -->\r\n <xsl:text>|</xsl:text> <!-- PV1-24 Contract Code -->\r\n <xsl:text>|</xsl:text> <!-- PV1-25 Contract Effective Date -->\r\n <xsl:text>|</xsl:text> <!-- PV1-26 Contract Amount -->\r\n <xsl:text>|</xsl:text> <!-- PV1-27 Contract Period -->\r\n <xsl:text>|</xsl:text> <!-- PV1-28 Interest Code -->\r\n <xsl:text>|</xsl:text> <!-- PV1-29 Transfer to Bad Debt Code -->\r\n <xsl:text>|</xsl:text> <!-- PV1-30 Transfer to Bad Debt Date -->\r\n <xsl:text>|</xsl:text> <!-- PV1-31 Bad Debt Agency Code -->\r\n <xsl:text>|</xsl:text> <!-- PV1-31 Bad Debt Transfer Amount -->\r\n <xsl:text>|</xsl:text> <!-- PV1-33 Bad Debt Recovery Amount -->\r\n <xsl:text>|</xsl:text> <!-- PV1-34 Delete Account Indicator -->\r\n <xsl:text>|</xsl:text> <!-- PV1-35 Delete Account Date -->\r\n <xsl:text>|</xsl:text> <!-- PV1-36 Discharge Disposition -->\r\n <xsl:text>|</xsl:text> <!-- PV1-37 Discharge To Location -->\r\n <xsl:if test=\"patient/patient.health_center\">\r\n <xsl:value-of select=\"replace(patient/patient.health_center,\'\\^\',\'&\')\" />\r\n </xsl:if>\r\n <xsl:text>|</xsl:text> <!-- PV1-38 Diet Type -->\r\n <xsl:text>|</xsl:text> <!-- PV1-39 Servicing Facility -->\r\n <xsl:text>|</xsl:text> <!-- PV1-40 Bed Status -->\r\n <xsl:text>|</xsl:text> <!-- PV1-41 Account Status -->\r\n <xsl:text>|</xsl:text> <!-- PV1-42 Pending Location -->\r\n <xsl:text>|</xsl:text> <!-- PV1-43 Prior Temporary Location -->\r\n <xsl:text>|</xsl:text> <!-- PV1-44 Admit Date/Time -->\r\n <xsl:call-template name=\"hl7Date\">\r\n <xsl:with-param name=\"date\" select=\"encounter/encounter.encounter_datetime\" />\r\n </xsl:call-template>\r\n <xsl:text>|</xsl:text> <!-- PV1-45 Discharge Date/Time -->\r\n <xsl:text>|</xsl:text> <!-- PV1-46 Current Patient Balance -->\r\n <xsl:text>|</xsl:text> <!-- PV1-47 Total Charges -->\r\n <xsl:text>|</xsl:text> <!-- PV1-48 Total Adjustments -->\r\n <xsl:text>|</xsl:text> <!-- PV1-49 Total Payments -->\r\n <xsl:text>|</xsl:text> <!-- PV1-50 Alternate Visit ID -->\r\n <xsl:text>|V</xsl:text> <!-- PV1-51 Visit Indicator -->\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n\r\n <!-- We use encounter date as the timestamp for each observation -->\r\n <xsl:variable name=\"encounterTimestamp\">\r\n <xsl:call-template name=\"hl7Date\">\r\n <xsl:with-param name=\"date\" select=\"encounter/encounter.encounter_datetime\" />\r\n </xsl:call-template>\r\n </xsl:variable>\r\n \r\n <!-- ORC Common Order Segment -->\r\n <xsl:text>ORC</xsl:text> <!-- Message type -->\r\n <xsl:text>|RE</xsl:text> <!-- ORC-1 Order Control (RE = obs to follow) -->\r\n <xsl:text>|</xsl:text> <!-- ORC-2 Placer Order Number -->\r\n <xsl:text>|</xsl:text> <!-- ORC-3 Filler Order Number -->\r\n <xsl:text>|</xsl:text> <!-- ORC-4 Placer Group Number -->\r\n <xsl:text>|</xsl:text> <!-- ORC-5 Order Status -->\r\n <xsl:text>|</xsl:text> <!-- ORC-6 Response Flag -->\r\n <xsl:text>|</xsl:text> <!-- ORC-7 Quantity/Timing -->\r\n <xsl:text>|</xsl:text> <!-- ORC-8 Parent -->\r\n <xsl:text>|</xsl:text> <!-- ORC-9 Date/Time of Transaction -->\r\n <xsl:call-template name=\"hl7Timestamp\">\r\n <xsl:with-param name=\"date\" select=\"xs:dateTime(header/date_entered)\" />\r\n </xsl:call-template>\r\n <xsl:text>|</xsl:text> <!-- ORC-10 Entered By -->\r\n <xsl:value-of select=\"header/enterer\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n\r\n <!-- Observation(s) -->\r\n <!-- <xsl:variable name=\"obsList\" select=\"obs/*[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]\" /> -->\r\n <xsl:variable name=\"obsList\" select=\"obs/*[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]|obs/*[not(@openmrs_concept)]/*[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]\" />\r\n <xsl:variable name=\"obsListCount\" select=\"count($obsList)\" as=\"xs:integer\" />\r\n <!-- Observation OBR -->\r\n <xsl:text>OBR</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- OBR-1 Set ID -->\r\n <xsl:text>1</xsl:text>\r\n <xsl:text>|</xsl:text> <!-- OBR-2 Placer order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-3 Filler order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-4 OBR concept -->\r\n <xsl:value-of select=\"obs/@openmrs_concept\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n\r\n <!-- observation OBXs -->\r\n <xsl:for-each select=\"$obsList\">\r\n <xsl:choose>\r\n <xsl:when test=\"value\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"position()\" />\r\n <xsl:with-param name=\"datatype\" select=\"@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"value\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:variable name=\"setId\" select=\"position()\" />\r\n <xsl:for-each select=\"*[@openmrs_concept and text() = \'true\']\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"$setId\" />\r\n <xsl:with-param name=\"subId\" select=\"concat($setId,position())\" />\r\n <xsl:with-param name=\"datatype\" select=\"../@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"../@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"../@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"../date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"../time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:for-each>\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:for-each>\r\n \r\n <!-- Grouped observation(s) -->\r\n <!-- <xsl:variable name=\"obsGroupList\" select=\"obs/*[@openmrs_concept and not(date) and *[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]]\" /> -->\r\n <xsl:variable name=\"obsGroupList\" select=\"obs/*[@openmrs_concept and not(date) and *[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]]|obs/*[not(@openmrs_concept)]/*[@openmrs_concept and not(date) and *[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]]\" />\r\n <xsl:variable name=\"obsGroupListCount\" select=\"count($obsGroupList)\" as=\"xs:integer\" />\r\n <xsl:for-each select=\"$obsGroupList\">\r\n <!-- Observation OBR -->\r\n <xsl:text>OBR</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- OBR-1 Set ID -->\r\n <xsl:value-of select=\"$obsListCount + position()\" />\r\n <xsl:text>|</xsl:text> <!-- OBR-2 Placer order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-3 Filler order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-4 OBR concept -->\r\n <xsl:value-of select=\"@openmrs_concept\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n \r\n <!-- Generate OBXs -->\r\n <xsl:for-each select=\"*[(@openmrs_concept and value and value/text() != \'\') or *[@openmrs_concept and text()=\'true\']]\">\r\n <xsl:choose>\r\n <xsl:when test=\"value\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"position()\" />\r\n <xsl:with-param name=\"subId\" select=\"1\" />\r\n <xsl:with-param name=\"datatype\" select=\"@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"value\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:variable name=\"setId\" select=\"position()\" />\r\n <xsl:for-each select=\"*[@openmrs_concept and text() = \'true\']\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"$setId\" />\r\n <xsl:with-param name=\"subId\" select=\"concat(\'1.\',position())\" />\r\n <xsl:with-param name=\"datatype\" select=\"../@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"../@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"../@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"../date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"../time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:for-each>\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:for-each>\r\n </xsl:for-each>\r\n\r\n <!-- Problem list(s) -->\r\n <xsl:variable name=\"problemList\" select=\"problem_list/*[value[text() != \'\']]\" />\r\n <xsl:variable name=\"problemListCount\" select=\"count($problemList)\" as=\"xs:integer\" />\r\n <xsl:if test=\"$problemList\">\r\n <!-- Problem list OBR -->\r\n <xsl:text>OBR</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- OBR-1 Set ID -->\r\n <xsl:value-of select=\"$obsListCount + $obsGroupListCount + 1\" />\r\n <xsl:text>|</xsl:text> <!-- OBR-2 Placer order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-3 Filler order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-4 OBR concept -->\r\n <xsl:value-of select=\"problem_list/@openmrs_concept\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n\r\n <!-- Problem list OBXs -->\r\n <xsl:for-each select=\"$problemList\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"position()\" />\r\n <xsl:with-param name=\"datatype\" select=\"\'CWE\'\" />\r\n <xsl:with-param name=\"concept\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"value\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template> \r\n </xsl:for-each>\r\n </xsl:if>\r\n \r\n <!-- Orders -->\r\n <xsl:variable name=\"orderList\" select=\"orders/*[*[@openmrs_concept and ((value and value/text() != \'\') or *[@openmrs_concept and text() = \'true\'])]]\" />\r\n <xsl:variable name=\"orderListCount\" select=\"count($orderList)\" as=\"xs:integer\" />\r\n <xsl:for-each select=\"$orderList\">\r\n <!-- Order section OBR -->\r\n <xsl:text>OBR</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- OBR-1 Set ID -->\r\n <xsl:value-of select=\"$obsListCount + $obsGroupListCount + $problemListCount + 1\" />\r\n <xsl:text>|</xsl:text> <!-- OBR-2 Placer order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-3 Filler order number -->\r\n <xsl:text>|</xsl:text> <!-- OBR-4 OBR concept -->\r\n <xsl:value-of select=\"@openmrs_concept\" />\r\n <xsl:text>
</xsl:text> <!-- new line -->\r\n \r\n <!-- Order OBXs -->\r\n <xsl:for-each select=\"*[@openmrs_concept and ((value and value/text() != \'\') or *[@openmrs_concept and text() = \'true\'])]\">\r\n <xsl:choose>\r\n <xsl:when test=\"value\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"position()\" />\r\n <xsl:with-param name=\"datatype\" select=\"@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"value\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:variable name=\"setId\" select=\"position()\" />\r\n <xsl:for-each select=\"*[@openmrs_concept and text() = \'true\']\">\r\n <xsl:call-template name=\"obsObx\">\r\n <xsl:with-param name=\"setId\" select=\"$setId\" />\r\n <xsl:with-param name=\"subId\" select=\"position()\" />\r\n <xsl:with-param name=\"datatype\" select=\"../@openmrs_datatype\" />\r\n <xsl:with-param name=\"units\" select=\"../@openmrs_units\" />\r\n <xsl:with-param name=\"concept\" select=\"../@openmrs_concept\" />\r\n <xsl:with-param name=\"date\" select=\"../date/text()\" />\r\n <xsl:with-param name=\"time\" select=\"../time/text()\" />\r\n <xsl:with-param name=\"value\" select=\"@openmrs_concept\" />\r\n <xsl:with-param name=\"encounterTimestamp\" select=\"$encounterTimestamp\" />\r\n </xsl:call-template>\r\n </xsl:for-each>\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:for-each> \r\n </xsl:for-each>\r\n \r\n</xsl:template>\r\n\r\n<!-- Patient Identifier (CX) generator -->\r\n<xsl:template name=\"patient_id\">\r\n <xsl:param name=\"pid\" />\r\n <xsl:param name=\"auth\" />\r\n <xsl:param name=\"type\" />\r\n <xsl:value-of select=\"$pid\" />\r\n <xsl:text>^</xsl:text> <!-- Check digit -->\r\n <xsl:text>^</xsl:text> <!-- Check Digit Scheme -->\r\n <xsl:text>^</xsl:text> <!-- Assigning Authority -->\r\n <xsl:value-of select=\"$auth\" />\r\n <xsl:text>^</xsl:text> <!-- Identifier Type -->\r\n <xsl:value-of select=\"$type\" />\r\n</xsl:template>\r\n\r\n<!-- OBX Generator -->\r\n<xsl:template name=\"obsObx\">\r\n <xsl:param name=\"setId\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"subId\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"datatype\" required=\"yes\" />\r\n <xsl:param name=\"concept\" required=\"yes\" />\r\n <xsl:param name=\"date\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"time\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"value\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"units\" required=\"no\"></xsl:param>\r\n <xsl:param name=\"encounterTimestamp\" required=\"yes\" />\r\n <xsl:text>OBX</xsl:text> <!-- Message type -->\r\n <xsl:text>|</xsl:text> <!-- Set ID -->\r\n <xsl:value-of select=\"$setId\" />\r\n <xsl:text>|</xsl:text> <!-- Observation datatype -->\r\n <xsl:choose>\r\n <xsl:when test=\"$datatype = \'BIT\'\">\r\n <xsl:text>NM</xsl:text>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select=\"$datatype\" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n <xsl:text>|</xsl:text> <!-- Concept (what was observed -->\r\n <xsl:value-of select=\"$concept\" />\r\n <xsl:text>|</xsl:text> <!-- Sub-ID -->\r\n <xsl:value-of select=\"$subId\" />\r\n <xsl:text>|</xsl:text> <!-- Value -->\r\n <xsl:choose>\r\n <xsl:when test=\"$datatype = \'TS\'\">\r\n <xsl:call-template name=\"hl7Timestamp\">\r\n <xsl:with-param name=\"date\" select=\"$value\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:when test=\"$datatype = \'DT\'\">\r\n <xsl:call-template name=\"hl7Date\">\r\n <xsl:with-param name=\"date\" select=\"$value\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:when test=\"$datatype = \'TM\'\">\r\n <xsl:call-template name=\"hl7Time\">\r\n <xsl:with-param name=\"time\" select=\"$value\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:when test=\"$datatype = \'BIT\'\">\r\n <xsl:choose>\r\n <xsl:when test=\"$value = \'0\' or upper-case($value) = \'FALSE\'\">0</xsl:when>\r\n <xsl:otherwise>1</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select=\"$value\" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n <xsl:text>|</xsl:text> <!-- Units -->\r\n <xsl:value-of select=\"$units\" />\r\n <xsl:text>|</xsl:text> <!-- Reference range -->\r\n <xsl:text>|</xsl:text> <!-- Abnormal flags -->\r\n <xsl:text>|</xsl:text> <!-- Probability -->\r\n <xsl:text>|</xsl:text> <!-- Nature of abnormal test -->\r\n <xsl:text>|</xsl:text> <!-- Observation result status -->\r\n <xsl:text>|</xsl:text> <!-- Effective date -->\r\n <xsl:text>|</xsl:text> <!-- User defined access checks -->\r\n <xsl:text>|</xsl:text> <!-- Date time of observation -->\r\n <xsl:choose>\r\n <xsl:when test=\"$date and $time\">\r\n <xsl:call-template name=\"hl7Timestamp\">\r\n <xsl:with-param name=\"date\" select=\"dateTime($date,$time)\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:when test=\"$date\">\r\n <xsl:call-template name=\"hl7Date\">\r\n <xsl:with-param name=\"date\" select=\"$date\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select=\"$encounterTimestamp\" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n <xsl:text>
</xsl:text>\r\n</xsl:template>\r\n\r\n<!-- Generate HL7-formatted timestamp -->\r\n<xsl:template name=\"hl7Timestamp\">\r\n <xsl:param name=\"date\" />\r\n <xsl:if test=\"string($date) != \'\'\">\r\n <xsl:value-of select=\"concat(year-from-dateTime($date),format-number(month-from-dateTime($date),\'00\'),format-number(day-from-dateTime($date),\'00\'),format-number(hours-from-dateTime($date),\'00\'),format-number(minutes-from-dateTime($date),\'00\'),format-number(floor(seconds-from-dateTime($date)),\'00\'))\" />\r\n </xsl:if>\r\n</xsl:template>\r\n\r\n<!-- Generate HL7-formatted date -->\r\n<xsl:template name=\"hl7Date\">\r\n <xsl:param name=\"date\" />\r\n <xsl:if test=\"string($date) != \'\'\">\r\n <xsl:choose>\r\n <xsl:when test=\"contains(string($date),\'T\')\">\r\n <xsl:call-template name=\"hl7Date\">\r\n <xsl:with-param name=\"date\" select=\"xs:date(substring-before($date,\'T\'))\" />\r\n </xsl:call-template>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select=\"concat(year-from-date($date),format-number(month-from-date($date),\'00\'),format-number(day-from-date($date),\'00\'))\" />\r\n </xsl:otherwise>\r\n </xsl:choose> \r\n </xsl:if>\r\n</xsl:template>\r\n\r\n<!-- Generate HL7-formatted time -->\r\n<xsl:template name=\"hl7Time\">\r\n <xsl:param name=\"time\" />\r\n <xsl:if test=\"$time != \'\'\">\r\n <xsl:value-of select=\"concat(format-number(hours-from-time($time),\'00\'),format-number(minutes-from-time($time),\'00\'),format-number(floor(seconds-from-time($time)),\'00\'))\" />\r\n </xsl:if>\r\n</xsl:template>\r\n\r\n</xsl:stylesheet>'
WHERE xslt LIKE '%\r\n@version 1.9.6\r\n%';
]]>
</sql>
</changeSet>
<changeSet id="20090122-0853" author="bwolfe" dbms="mysql">
<preConditions onFail="CONTINUE">
<not><dbms type="hsql" /></not> <!-- skip over this changeset in unit tests -->
</preConditions>
<comment>
Remove duplicate concept name tags
</comment>
<sql>
UPDATE
concept_name_tag_map map
SET
concept_name_tag_id = (SELECT
min(concept_name_tag_id)
FROM concept_name_tag
WHERE
tag = (select tag from concept_name_tag where concept_name_tag_id = map.concept_name_tag_id)
);
</sql>
<!-- Copy the concept_name_map_ids to a new table -->
<addLookupTable
existingTableName="concept_name_tag" existingColumnName="concept_name_tag_id"
newTableName="tmp_concept_name_tag_duplicates" newColumnName="concept_name_tag_id"
newColumnDataType="int" constraintName="concept_name_tag_ids_dupes"/>
<dropForeignKeyConstraint
constraintName="concept_name_tag_ids_dupes"
baseTableName="concept_name_tag"/>
<!-- Leave only ids that have duplicates in the table -->
<delete tableName="tmp_concept_name_tag_duplicates">
<where>concept_name_tag_id not in (select concept_name_tag_id from concept_name_tag where tag in (select tag from concept_name_tag group by tag having count(*) > 1))</where>
</delete>
<!-- Now delete all -->
<delete tableName="concept_name_tag">
<where>
concept_name_tag_id in (select concept_name_tag_id from tmp_concept_name_tag_duplicates)
and
concept_name_tag_id not in (select distinct(concept_name_tag_id) from concept_name_tag_map)
</where>
</delete>
<dropTable tableName="tmp_concept_name_tag_duplicates" />
</changeSet>
<changeSet id="20090123-0305" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="concept_name_tag_unique_tags" />
</not>
</preConditions>
<comment>
Add unique constraint to the tags table
</comment>
<addUniqueConstraint tableName="concept_name_tag" columnNames="tag" constraintName="concept_name_tag_unique_tags"/>
</changeSet>
<changeSet id="20090224-1229" author="Keelhaul+bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="location_tag"/></not>
</preConditions>
<comment>
Add location tags table
</comment>
<createTable tableName="location_tag">
<column name="location_tag_id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="description" type="varchar(255)" defaultValue="null"/>
<column name="creator" type="int(11)" >
<constraints nullable="false" />
</column>
<column name="date_created" type="datetime" >
<constraints nullable="false"/>
</column>
<column name="retired" type="tinyint" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="retired_by" type="int(11)" />
<column name="date_retired" type="datetime" />
<column name="retired_reason" type="varchar(255)" defaultValue="null"/>
</createTable>
<addForeignKeyConstraint constraintName="location_tag_creator"
baseTableName="location_tag" baseColumnNames="creator"
referencedTableName="users" referencedColumnNames="user_id"/>
<addForeignKeyConstraint constraintName="location_tag_retired_by"
baseTableName="location_tag" baseColumnNames="retired_by"
referencedTableName="users" referencedColumnNames="user_id"/>
</changeSet>
<changeSet id="20090224-1250" author="Keelhaul+bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="location_tag_map"/></not>
</preConditions>
<comment>
Add location tag map table
</comment>
<createTable tableName="location_tag_map">
<column name="location_id" type="int">
<constraints nullable="false"/>
</column>
<column name="location_tag_id" type="int">
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint constraintName="location_tag_map_location"
baseTableName="location_tag_map" baseColumnNames="location_id"
referencedTableName="location" referencedColumnNames="location_id"/>
<addForeignKeyConstraint constraintName="location_tag_map_tag"
baseTableName="location_tag_map" baseColumnNames="location_tag_id"
referencedTableName="location_tag" referencedColumnNames="location_tag_id"/>
<addPrimaryKey tableName="location_tag_map"
columnNames="location_id,location_tag_id"
constraintName="key_for_location_tag_map"/>
</changeSet>
<changeSet id="20090224-1256" author="Keelhaul+bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="location" columnName="parent_location"/></not>
</preConditions>
<comment>
Add parent_location column to location table
</comment>
<addColumn tableName="location">
<column name="parent_location" type="int(11)" />
</addColumn>
<addForeignKeyConstraint constraintName="parent_location"
baseTableName="location" baseColumnNames="parent_location"
referencedTableName="location" referencedColumnNames="location_id"/>
</changeSet>
<changeSet id="20090225-1551" author="dthomas" dbms="mysql">
<preConditions onFail="MARK_RAN">
<columnExists tableName="location_tag" columnName="name"/>
</preConditions>
<comment>
Change location_tag.name to location_tag.tag and location_tag.retired_reason to location_tag.retire_reason
</comment>
<renameColumn tableName="location_tag"
oldColumnName="name" newColumnName="tag" columnDataType="varchar(50)"/>
<renameColumn tableName="location_tag"
oldColumnName="retired_reason" newColumnName="retire_reason" columnDataType="varchar(255)"/>
</changeSet>
<changeSet id="02232009-1141" author="nribeka" dbms="mysql">
<comment>
Modify the password column to fit the output of SHA-512 function
</comment>
<ext:modifyColumn tableName="users">
<column name="password" type="varchar(128)"/>
<column name="salt" type="varchar(128)"/>
</ext:modifyColumn>
</changeSet>
<changeSet id="20090301-1259" author="bwolfe" dbms="mysql">
<comment>
Fixes the description for name layout global property
</comment>
<update tableName="global_property">
<column name="description" value="Format in which to display the person names. Valid values are short, long"/>
<where>property='layout.name.format'</where>
</update>
<update tableName="global_property">
<column name="property_value" value="short"/>
<where>property='layout.name.format' and property_value='Format in which to display the person names. Valid values are short, long'</where>
</update>
</changeSet>
<changeSet id="20090214-2246" author="isherman" dbms="mysql">
<comment>
Add weight and cd4 to patientGraphConcepts user property (mysql specific)
</comment>
<sql>
UPDATE user_property
SET property_value = CONCAT(
'-',
(SELECT property_value FROM global_property WHERE property = 'concept.weight'),
'-',
(SELECT property_value FROM global_property WHERE property = 'concept.cd4_count'),
property_value
) WHERE property = 'patientGraphConcepts';
</sql>
</changeSet>
<changeSet id="20090214-2247" author="isherman">
<validCheckSum><comment>Fixing sql extra bracket</comment>3:e4eeb4a09c2ab695bbde832cd7b6047d</validCheckSum>
<validCheckSum>3:27ccd45178be533e880f88abbae24c2d</validCheckSum>
<preConditions onFail="MARK_RAN">
<or>
<dbms type="postgresql" />
<dbms type="oracle" />
<dbms type="db2" />
<dbms type="mssql" />
</or>
</preConditions>
<comment>
Add weight and cd4 to patientGraphConcepts user property (using standard sql)
</comment>
<sql>
UPDATE user_property
SET property_value =
'-' ||
(SELECT property_value FROM global_property WHERE property = 'concept.weight') ||
'-' ||
(SELECT property_value FROM global_property WHERE property = 'concept.cd4_count') ||
property_value
WHERE property = 'patientGraphConcepts';
</sql>
<modifySql dbms="mssql">
<replace replace="||" with="+"/>
</modifySql>
</changeSet>
<changeSet id="20090316-1008" author="vanand" dbms="mysql">
<validCheckSum>cf32d07af2933e9a3555395737b5142</validCheckSum><!-- old checksum before adding in person.birthdate_estimated cleanup -->
<validCheckSum>fcdde237e04473db1e6fd16f56bf80e9</validCheckSum><!-- new checksum after adding in person.birthdate_estimated cleanup -->
<comment>
Change column types of all boolean columns to smallint. The columns used to be either tinyint(4) or MySQL's BIT.
(This may take a while on large patient or obs tables)
</comment>
<ext:modifyColumn tableName="cohort">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="is_set" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept_class">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept_datatype">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept_name">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept_name_tag">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="concept_numeric">
<column name="precise" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<update tableName="concept_source">
<column name="voided" value="0" />
<where>voided is null</where>
</update>
<ext:modifyColumn tableName="concept_source">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="drug">
<column name="combination" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="drug_order">
<column name="prn" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="complex" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="encounter">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="encounter_type">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="field">
<column name="select_multiple" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="field_type">
<column name="is_set" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="form">
<column name="published" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="form_field">
<column name="required" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="location_tag">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="obs">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="order_type">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="orders">
<column name="discontinued" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="patient">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="patient_identifier">
<column name="preferred" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="patient_identifier_type">
<column name="check_digit" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="required" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="patient_program">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="patient_state">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<update tableName="person">
<column name="birthdate_estimated" value="0" />
<where>birthdate_estimated is null</where>
</update>
<ext:modifyColumn tableName="person">
<column name="birthdate_estimated" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="dead" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="person_address">
<column name="preferred" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="person_attribute">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="person_attribute_type">
<column name="searchable" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="person_name">
<column name="preferred" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="program">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="program_workflow">
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="program_workflow_state">
<column name="initial" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="terminal" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="relationship">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="report_object">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
<ext:modifyColumn tableName="users">
<column name="voided" type="smallint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</ext:modifyColumn>
</changeSet>
<changeSet id="200903210905" author="mseaton" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="serialized_object"/></not>
</preConditions>
<comment>
Add a table to enable generic storage of serialized objects
</comment>
<createTable tableName="serialized_object">
<column name="serialized_object_id" type="int" autoIncrement="true">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="name" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="varchar(5000)"/>
<column name="type" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="subtype" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="serialization_class" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="serialized_data" type="text">
<constraints nullable="false"/>
</column>
<column name="date_created" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="creator" type="int">
<constraints nullable="false"/>
</column>
<column name="date_changed" type="DATETIME" />
<column name="changed_by" type="int"/>
<column name="retired" type="smallint" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="date_retired" type="DATETIME"/>
<column name="retired_by" type="int"/>
<column name="retire_reason" type="varchar(1000)"/>
</createTable>
<addForeignKeyConstraint constraintName="serialized_object_creator"
baseTableName="serialized_object" baseColumnNames="creator"
referencedTableName="users" referencedColumnNames="user_id"/>
<addForeignKeyConstraint constraintName="serialized_object_changed_by"
baseTableName="serialized_object" baseColumnNames="changed_by"
referencedTableName="users" referencedColumnNames="user_id"/>
<addForeignKeyConstraint constraintName="serialized_object_retired_by"
baseTableName="serialized_object" baseColumnNames="retired_by"
referencedTableName="users" referencedColumnNames="user_id"/>
</changeSet>
<changeSet id="200903210905-fix" author="sunbiz" dbms="mysql">
<preConditions onFail="MARK_RAN">
<tableExists tableName="serialized_object"/>
</preConditions>
<comment>(Fixed)Add a table to enable generic storage of serialized objects</comment>
<ext:modifyColumn tableName="serialized_object">
<column name="retired" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</ext:modifyColumn>
</changeSet>
<changeSet id="200904091023" author="bwolfe" dbms="mysql">
<comment>
Remove Manage Tribes and View Tribes privileges from the privilege table and role_privilege table.
The privileges will be recreated by the Tribe module if it is installed.
</comment>
<delete tableName="role_privilege">
<where>privilege='Manage Tribes'</where>
</delete>
<delete tableName="role_privilege">
<where>privilege='View Tribes'</where>
</delete>
<delete tableName="privilege">
<where>privilege='Manage Tribes'</where>
</delete>
<delete tableName="privilege">
<where>privilege='View Tribes'</where>
</delete>
</changeSet>
<changeSet author="Cory McCarthy" id="20090408-1298" dbms="mysql">
<comment>Changed the datatype for encounter_type to 'text' instead of just 50 chars</comment>
<ext:modifyColumn tableName="encounter_type">
<column name="description" type="text" />
</ext:modifyColumn>
</changeSet>
<changeSet id="200905150814" author="bwolfe" dbms="mysql">
<comment>Deleting invalid concept words</comment>
<delete tableName="concept_word">
<where>concept_name_id = 0</where>
</delete>
</changeSet>
<changeSet id="200905071626" author="bwolfe" failOnError="false" dbms="mysql">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="concept_word_concept_idx"/>
</not>
</preConditions>
<comment>
Add an index to the concept_word.concept_id column (This update may fail if it already exists)
</comment>
<createIndex tableName="concept_word" indexName="concept_word_concept_idx">
<column name="concept_id" />
</createIndex>
</changeSet>
<changeSet id="20090402-1515-38-cohort" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="cohort" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to cohort table</comment>
<addColumn tableName="cohort">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept table</comment>
<addColumn tableName="concept">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_answer" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_answer" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_answer table</comment>
<addColumn tableName="concept_answer">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_class" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_class" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_class table</comment>
<addColumn tableName="concept_class">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_datatype" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_datatype" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_datatype table</comment>
<addColumn tableName="concept_datatype">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_description" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_description" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_description table</comment>
<addColumn tableName="concept_description">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_map" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_map" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_map table</comment>
<addColumn tableName="concept_map">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_name" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_name" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_name table</comment>
<addColumn tableName="concept_name">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_name_tag" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_name_tag" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_name_tag table</comment>
<addColumn tableName="concept_name_tag">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_proposal" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_proposal" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_proposal table</comment>
<addColumn tableName="concept_proposal">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_set" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_set" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_set table</comment>
<addColumn tableName="concept_set">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_source" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_source" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_source table</comment>
<addColumn tableName="concept_source">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-concept_state_conversion" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="concept_state_conversion" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to concept_state_conversion table</comment>
<addColumn tableName="concept_state_conversion">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-drug" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="drug" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to drug table</comment>
<addColumn tableName="drug">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-encounter" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="encounter" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to encounter table</comment>
<addColumn tableName="encounter">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-encounter_type" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="encounter_type" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to encounter_type table</comment>
<addColumn tableName="encounter_type">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-field" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="field" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to field table</comment>
<addColumn tableName="field">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-field_answer" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="field_answer" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to field_answer table</comment>
<addColumn tableName="field_answer">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-field_type" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="field_type" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to field_type table</comment>
<addColumn tableName="field_type">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-form" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="form" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to form table</comment>
<addColumn tableName="form">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-form_field" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="form_field" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to form_field table</comment>
<addColumn tableName="form_field">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-global_property" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="global_property" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to global_property table</comment>
<addColumn tableName="global_property">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-hl7_in_archive" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="hl7_in_archive" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to hl7_in_archive table</comment>
<addColumn tableName="hl7_in_archive">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-hl7_in_error" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="hl7_in_error" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to hl7_in_error table</comment>
<addColumn tableName="hl7_in_error">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-hl7_in_queue" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="hl7_in_queue" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to hl7_in_queue table</comment>
<addColumn tableName="hl7_in_queue">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-hl7_source" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="hl7_source" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to hl7_source table</comment>
<addColumn tableName="hl7_source">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-location" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="location" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to location table</comment>
<addColumn tableName="location">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-location_tag" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="location_tag" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to location_tag table</comment>
<addColumn tableName="location_tag">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-note" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="note" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to note table</comment>
<addColumn tableName="note">
<column name="uuid" type="char(38)" />
</addColumn>
</changeSet>
<changeSet id="20090402-1515-38-notification_alert" author="bwolfe" dbms="mysql">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="notification_alert" columnName="uuid"/></not></preConditions>
<comment>Adding "uuid" column to notification_alert table</comment>
<addColumn tableName="notification_alert">
<column name="uuid" type="char(38)" />
</addColumn>