Add patient attributes INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('education', 'Education Details', 'org.openmrs.Concept', '1', 1, curdate(), 0, 6, uuid()); INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('occupation', 'Occupation', 'org.openmrs.Concept', '1', 1, curdate(), 0, 7, uuid()); select count(*) from concept_name where name = 'Education Details'; Adding Concept Education Details 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, 'Education Details', 'education', 'Coded', 'Misc', false); UPDATE person_attribute_type SET format = 'org.openmrs.Concept', foreign_key = @concept_id WHERE name = 'education'; select count(*) from concept_name where name = 'Occupation'; Adding Concept Occupation 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, 'Occupation', 'occupation', 'Coded', 'Misc', false); UPDATE person_attribute_type SET format = 'org.openmrs.Concept', foreign_key = @concept_id WHERE name = 'occupation'; Creating House Hold Code person attribute fields Creating Birth registration number and Unique id number person attribute feilds select count(*) from person_attribute_type where name = 'primaryContact'; Creating Primary Contact person attribute feilds select count(*) from concept_name where name = "uncategorized diagnoses"; 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, 'uncategorized diagnoses', 'uncategorized diagnoses', 'N/A', 'ConvSet', true); select count(*) from concept_name where name = "Diagnosis Answers"; 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, 'Diagnosis Answers', 'Diagnosis Answers', 'Coded', 'Misc', false); Deleting all the person attributes, referring to Unique Id or primaryContact delete from person_attribute where person_attribute_type_id = (select person_attribute_type_id from person_attribute_type where name = 'Unique Id'); delete from person_attribute where person_attribute_type_id = (select person_attribute_type_id from person_attribute_type where name = 'primaryContact'); select count(*) from person_attribute_type where name = 'Unique Id'; Removing Unique Id Attribute delete from person_attribute_type where name = 'Unique Id'; select count(*) from person_attribute_type where name = 'primaryContact'; Removing Primary Contact Attribute delete from person_attribute_type where name = 'primaryContact'; select count(*) from person_attribute_type where name = 'Phone Number'; Add Patient Phone Number Attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('Phone Number', 'Phone Number', 'java.lang.String', '1', 1, curdate(), 0, 8, uuid()); select count(*) from person_attribute_type where name = 'fatherName'; Add Father's name attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('fatherName', 'Father\'s Name', 'java.lang.String', '1', 1, now(), 0, 9, uuid()); select count(*) from person_attribute_type where name = 'spouseName'; Add Spouse's name attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('spouseName', 'Spouse\'s Name', 'java.lang.String', '1', 1, now(), 0, 10, uuid()); select count(*) from person_attribute_type where name = 'motherName'; Add Spouse's name attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('motherName', 'Mother\'s Name', 'java.lang.String', '1', 1, now(), 0, 10, uuid()); select count(*) from person_attribute_type where name = 'Birth Registration Id'; Updating the attribute Birth Registration ID UPDATE person_attribute_type SET name = 'birthRegistrationId' WHERE name = 'Birth Registration Id'; select count(*) from person_attribute_type where name = 'House Hold Code'; Updating the attribute House hold code UPDATE person_attribute_type SET name = 'householdCode' WHERE name = 'House Hold Code'; select count(*) from person_attribute_type where name = 'Occupation'; Updating the attribute Occupation UPDATE person_attribute_type SET name = 'occupation' WHERE name = 'Occupation'; select count(*) from person_attribute_type where name = 'Phone Number'; Updating the attribute Phone Number UPDATE person_attribute_type SET name = 'phoneNumber' WHERE name = 'Phone Number'; select count(*) from person_attribute_type where name = 'familyNameLocal'; Removing family Name Local Attribute UPDATE person_attribute_type SET retired = 1, retired_by = 1, date_retired=now(), retire_reason = 'Not required' WHERE name = 'familyNameLocal'; select count(*) from person_attribute_type where name = 'givenNameLocal'; Removing given Name Local Attribute UPDATE person_attribute_type SET retired = 1, retired_by = 1, date_retired=now(), retire_reason = 'Not required' WHERE name = 'givenNameLocal'; select count(*) from person_attribute_type where name = 'middleNameLocal'; Removing middle Name Local Attribute UPDATE person_attribute_type SET retired = 1, retired_by = 1, date_retired=now(), retire_reason = 'Not required' WHERE name = 'middleNameLocal'; select count(*) from person_attribute_type where name = 'fatherName'; Updating the sortweight of the attribute father Name UPDATE person_attribute_type SET sort_weight = '1' WHERE name = 'fatherName'; select count(*) from person_attribute_type where name = 'motherName'; Updating the sortweight of the attribute mother Name UPDATE person_attribute_type SET sort_weight = '2' WHERE name = 'motherName'; select count(*) from person_attribute_type where name = 'spouseName'; Updating the sortweight of the attribute spouse Name UPDATE person_attribute_type SET sort_weight = '3' WHERE name = 'spouseName'; select count(*) from person_attribute_type where name = 'birthRegistrationId'; Updating the sortweight of the attribute birthRegistrationId UPDATE person_attribute_type SET sort_weight = '6' WHERE name = 'birthRegistrationId'; select count(*) from person_attribute_type where name = 'motherName'; Updating the sortweight of the attribute mother Name UPDATE person_attribute_type SET retired = 0, retired_by = null, date_retired = null WHERE name = 'motherName'; SELECT COUNT(*) FROM person_attribute_type WHERE name = 'healthId'; Insert Health ID and National ID. Split from changeset BD-201406241630 INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('healthId', 'Unique Health ID', 'java.lang.String', '1', 1, curdate(), 0, 4, uuid()); SELECT COUNT(*) FROM person_attribute_type WHERE name = 'nationalId'; Insert Health ID and National ID. Split from changeset BD-201406241630 INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('nationalId', 'National ID', 'java.lang.String', '1', 1, curdate(), 0, 5, uuid()); select count(*) from person_attribute_type where name = 'givenNameLocal'; Add given name local attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('givenNameLocal', 'রোগীর নাম', 'java.lang.String', '1', 1, now(), 1, 3, uuid()); select count(*) from person_attribute_type where name = 'familyNameLocal'; Add family name local attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('familyNameLocal', 'পদবি', 'java.lang.String', '1', 1, now(), 1, 3, uuid()); select count(*) from person_attribute_type where name = 'middleNameLocal'; Add middle name local attribute INSERT INTO person_attribute_type (name, description, format, searchable, creator, date_created, retired, sort_weight, uuid) VALUES ('middleNameLocal', 'middleNameLocal', 'java.lang.String', '1', 1, now(), 1, 3, uuid());