mml-ruby 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +199 -10
- data/lib/mml.rb +288 -5
- data/lib/mml/common.rb +26 -268
- data/lib/mml/version.rb +1 -1
- data/lib/xml/address.xml.builder +12 -0
- data/lib/xml/baseclinic.xml.builder +36 -0
- data/lib/xml/creatorinfo.xml.builder +6 -0
- data/lib/xml/creatorlicense.xml.builder +3 -0
- data/lib/xml/department.xml.builder +8 -0
- data/lib/xml/extref.xml.builder +5 -0
- data/lib/xml/facility.xml.builder +8 -0
- data/lib/xml/firstclinic.xml.builder +47 -0
- data/lib/xml/id.xml.builder +4 -0
- data/lib/xml/insurance.xml.builder +82 -0
- data/lib/xml/lifestyle.xml.builder +6 -0
- data/lib/xml/name.xml.builder +10 -0
- data/lib/xml/patientinfo.xml.builder +51 -0
- data/lib/xml/personalizedinfo.xml.builder +25 -0
- data/lib/xml/phone.xml.builder +10 -0
- data/lib/xml/progresscourse.xml.builder +89 -0
- data/lib/xml/registereddiagnosis.xml.builder +27 -0
- data/lib/xml/staffinfo.xml.builder +6 -0
- data/lib/xml/summary.xml.builder +125 -0
- data/lib/xml/surgery.xml.builder +81 -0
- data/spec/mml/admission_spec.rb +45 -0
- data/spec/mml/allergy_item_spec.rb +35 -0
- data/spec/mml/anesthesia_procedure_spec.rb +15 -0
- data/spec/mml/anesthesiologist_spec.rb +22 -0
- data/spec/mml/base_clinic_module_spec.rb +58 -0
- data/spec/mml/birth_info_spec.rb +90 -0
- data/spec/mml/blood_type_spec.rb +40 -0
- data/spec/mml/clinical_record_spec.rb +37 -0
- data/spec/mml/creator_info_spec.rb +3 -3
- data/spec/mml/creator_license_spec.rb +7 -0
- data/spec/mml/death_flag_spec.rb +11 -0
- data/spec/mml/death_info_spec.rb +19 -0
- data/spec/mml/department_spec.rb +3 -3
- data/spec/mml/diagnostic_category_spec.rb +23 -0
- data/spec/mml/discharge_spec.rb +29 -0
- data/spec/mml/dx_item_spec.rb +19 -0
- data/spec/mml/family_history_item_spec.rb +36 -0
- data/spec/mml/first_clinic_module_spec.rb +105 -0
- data/spec/mml/infection_item_spec.rb +39 -0
- data/spec/mml/inpatient_item_spec.rb +49 -0
- data/spec/mml/insurance_class_spec.rb +24 -0
- data/spec/mml/insurance_client_spec.rb +36 -0
- data/spec/mml/insurance_spec.rb +182 -0
- data/spec/mml/lifestyle_module_spec.rb +50 -0
- data/spec/mml/nationality_spec.rb +19 -0
- data/spec/mml/objective_spec.rb +51 -0
- data/spec/mml/operation_element_item_spec.rb +31 -0
- data/spec/mml/organization_info_spec.rb +35 -0
- data/spec/mml/other_blood_type_spec.rb +31 -0
- data/spec/mml/outpatient_item_spec.rb +48 -0
- data/spec/mml/past_history_item_spec.rb +23 -0
- data/spec/mml/past_history_spec.rb +17 -0
- data/spec/mml/patient_info_spec.rb +126 -0
- data/spec/mml/phone_spec.rb +5 -1
- data/spec/mml/physical_exam_item_spec.rb +40 -0
- data/spec/mml/plan_spec.rb +45 -0
- data/spec/mml/problem_item_spec.rb +35 -0
- data/spec/mml/procedure_item_spec.rb +44 -0
- data/spec/mml/progress_course_module_spec.rb +79 -0
- data/spec/mml/public_insurance_item_spec.rb +64 -0
- data/spec/mml/race_spec.rb +19 -0
- data/spec/mml/registered_diagnosis_spec.rb +124 -0
- data/spec/mml/related_doc_spec.rb +15 -0
- data/spec/mml/service_history_spec.rb +53 -0
- data/spec/mml/staff_info_spec.rb +31 -0
- data/spec/mml/subject_spec.rb +16 -0
- data/spec/mml/subjective_item_spec.rb +23 -0
- data/spec/mml/summary_module_spec.rb +239 -0
- data/spec/mml/surgery_item_spec.rb +132 -0
- data/spec/mml/surgery_module_spec.rb +90 -0
- data/spec/mml/surgical_staff_spec.rb +34 -0
- data/spec/mml/test_result_spec.rb +24 -0
- data/spec/mml/vaccination_item_spec.rb +38 -0
- data/spec/mml/value_with_link_spec.rb +15 -0
- data/spec/spec_helper.rb +1 -1
- metadata +137 -5
- checksums.yaml +0 -7
@@ -0,0 +1,50 @@
|
|
1
|
+
describe MML::Lifestyle do
|
2
|
+
let(:lifestyle) {MML::Lifestyle.new(occupation: 'physician', tobacco: 'never', alcohol: 'social', other: 'no constipation')}
|
3
|
+
|
4
|
+
it 'is an instance of MML::Lifestyle' do
|
5
|
+
expect(lifestyle).to be_an_instance_of MML::Lifestyle
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'occupation should be assigned properly' do
|
9
|
+
expect(lifestyle.occupation).to eq 'physician'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'occupation is mandatory' do
|
13
|
+
expect{lifestyle.occupation = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'tobacco should be assigned properly' do
|
17
|
+
expect(lifestyle.tobacco).to eq 'never'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'tobacco is mandatory' do
|
21
|
+
expect{lifestyle.tobacco = nil}.to raise_error ArgumentError
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'alcohol should be assigned properly' do
|
25
|
+
expect(lifestyle.alcohol).to eq 'social'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'alcohol is mandatory' do
|
29
|
+
expect{lifestyle.alcohol=nil}.to raise_error ArgumentError
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'other should be assigned properly' do
|
33
|
+
expect(lifestyle.other).to eq 'no constipation'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'other is optional' do
|
37
|
+
expect{lifestyle.other=nil}.not_to raise_error
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#to_xml' do
|
41
|
+
subject {lifestyle.to_xml}
|
42
|
+
|
43
|
+
it {should match "<mmlLs:LifestyleModule>"}
|
44
|
+
it {should match '<mmlLs:occupation>physician</mmlLs:occupation>'}
|
45
|
+
it {should match '<mmlLs:tobacco>never</mmlLs:tobacco>'}
|
46
|
+
it {should match '<mmlLs:alcohol>social</mmlLs:alcohol>'}
|
47
|
+
it {should match '<mmlLs:other>no constipation</mmlLs:other>'}
|
48
|
+
it {should match "</mmlLs:LifestyleModule>"}
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe MML::Nationality do
|
2
|
+
let(:nationality) {MML::Nationality.new(value: 'JPN', subtype: 'USA') }
|
3
|
+
|
4
|
+
it 'should be an instance of MMLNationality' do
|
5
|
+
expect(nationality).to be_an_instance_of MML::Nationality
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'value should be assigned properly' do
|
9
|
+
expect(nationality.value).to eq 'JPN'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'value is mandatory' do
|
13
|
+
expect {nationality.value = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'subtype should be assgined properly' do
|
17
|
+
expect(nationality.subtype).to eq 'USA'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
describe MML::Objective do
|
2
|
+
let(:extref) {MML::ExtRef.new(href: 'snd://localhost/chest.wav')}
|
3
|
+
let(:physical_exam_item) {MML::PhysicalExamItem.new(title: 'Chest auscultation', result: 'Respiratory sounds vesicular', interpretation: 'no rale', referenceInfo: [extref])}
|
4
|
+
let(:test_extref) {MML::ExtRef.new(href: 'http://record.net/result')}
|
5
|
+
let(:test_result) {MML::ValueWithLink.new(value: 'WBC 9000/microl', link: [test_extref] )}
|
6
|
+
let(:rx_extref) { MML::ExtRef.new(href: 'http://druginfo/recipie')}
|
7
|
+
let(:rx_record) {MML::ValueWithLink.new(value: 'Ampcilin 1200mg/day', link: [rx_extref])}
|
8
|
+
let(:tx_extref) {MML::ExtRef.new(href: 'http://treatment/fig1')}
|
9
|
+
let(:tx_record) {MML::ValueWithLink.new(value: 'antibiotics, p.o.', link: [tx_extref])}
|
10
|
+
let(:objective) {MML::Objective.new(objectiveNotes: 'looks pale', physicalExam: [physical_exam_item], testResult: test_result, rxRecord: rx_record, txRecord: tx_record)}
|
11
|
+
|
12
|
+
it 'is an instance of MML::Objective' do
|
13
|
+
expect(objective).to be_an_instance_of MML::Objective
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'objectiveNotes should be assigned properly' do
|
17
|
+
expect(objective.objectiveNotes).to eq 'looks pale'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'physicalExam should be assigned properly' do
|
21
|
+
expect(objective.physicalExam[0].title).to eq 'Chest auscultation'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'physicalExam is optional' do
|
25
|
+
expect {objective.physicalExam = nil}.not_to raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'testResult should be assigned properly' do
|
29
|
+
expect(objective.testResult.value).to eq 'WBC 9000/microl'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'testResult is optional' do
|
33
|
+
expect {objective.testResult = nil}.not_to raise_error
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'rxRecord should be assigned properly' do
|
37
|
+
expect(objective.rxRecord.link[0].href).to eq 'http://druginfo/recipie'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'rxRecord is optional' do
|
41
|
+
expect {objective.rxRecord = nil}.not_to raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'txRexord should be assigned properly' do
|
45
|
+
expect(objective.txRecord.value).to eq 'antibiotics, p.o.'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'txRecord is optional' do
|
49
|
+
expect {objective.txRecord = nil}.not_to raise_error
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
describe MML::OperationElementItem do
|
2
|
+
let(:operation_element_item) {MML::OperationElementItem.new(title: 'coronary artery bipass grafting', code: 'K552', system: 'MHLW')}
|
3
|
+
|
4
|
+
it 'is an instance of MML::OperationElementItem' do
|
5
|
+
expect(operation_element_item).to be_an_instance_of MML::OperationElementItem
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'title should be assigned properly' do
|
9
|
+
expect(operation_element_item.title).to eq 'coronary artery bipass grafting'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'title is mandatory' do
|
13
|
+
expect {operation_element_item.title = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'code should be assgined properly' do
|
17
|
+
expect(operation_element_item.code).to eq 'K552'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'code is optional' do
|
21
|
+
expect {operation_element_item.code = nil}.not_to raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'system should be assigned properly' do
|
25
|
+
expect(operation_element_item.system).to eq 'MHLW'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'system is optional' do
|
29
|
+
expect {operation_element_item.system = nil}.not_to raise_error
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
describe MML::OrganizationInfo do
|
2
|
+
let(:facility_name) {double(MML::FacilityName, value: 'MML Hospital')}
|
3
|
+
let(:facility) {double(MML::Facility, name: [facility_name])}
|
4
|
+
let(:address) {double(MML::Address, city: 'Kyoto-city')}
|
5
|
+
let(:phone) {double(MML::Phone, area: '075')}
|
6
|
+
let(:organization) {MML::OrganizationInfo.new(facility: facility, addresses: [address], phones: [phone])}
|
7
|
+
|
8
|
+
it 'is an instance of MML::OrganizationInfo' do
|
9
|
+
expect(organization).to be_an_instance_of MML::OrganizationInfo
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'facility should be assigned properly' do
|
13
|
+
expect(organization.facility.name[0].value).to eq 'MML Hospital'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'facility is optional' do
|
17
|
+
expect{organization.facility = nil}.not_to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'addresses should be assigned properly' do
|
21
|
+
expect(organization.addresses[0].city).to eq 'Kyoto-city'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'addresses are optional' do
|
25
|
+
expect{organization.addresses = nil}.not_to raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'phones should be assigned properly' do
|
29
|
+
expect(organization.phones[0].area).to eq '075'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'phones are optional' do
|
33
|
+
expect{organization.phones = nil}.not_to raise_error
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
describe MML::OtherBloodType do
|
2
|
+
let(:other_blood_type) {MML::OtherBloodType.new(typeName: 'MNS blood type', typeJudgement: 'MN', description: 'examination at 2 years ago')}
|
3
|
+
|
4
|
+
it 'is an instance of MML::OtherBloodType' do
|
5
|
+
expect(other_blood_type).to be_an_instance_of MML::OtherBloodType
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'typeName should be assigned properly' do
|
9
|
+
expect(other_blood_type.typeName).to eq 'MNS blood type'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'typeName is mandatory' do
|
13
|
+
expect{other_blood_type.typeName = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'typeJudgement should be assigned properly' do
|
17
|
+
expect(other_blood_type.typeJudgement).to eq 'MN'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'typeJudgement is mandatory' do
|
21
|
+
expect {other_blood_type.typeJudgement = nil}.to raise_error ArgumentError
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'description should be assigned properly' do
|
25
|
+
expect(other_blood_type.description).to eq 'examination at 2 years ago'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'description is optional' do
|
29
|
+
expect {other_blood_type.description = nil}.not_to raise_error
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe MML::OutpatientItem do
|
2
|
+
let(:id) {MML::Id.new(type: 'facility', tableId: 'MML0024', value: '00123')}
|
3
|
+
let(:name) {MML::Name.new(repCode: 'A', fullname: 'Hiroyuki Yoshihara')}
|
4
|
+
let(:personalized_info) {MML::PersonalizedInfo.new(id: id, personName: [name])}
|
5
|
+
let(:creator_license) { MML::CreatorLicense.new(tableId: 'MML0026', value: 'doctor')}
|
6
|
+
let(:staff_info) {MML::StaffInfo.new(personalizedInfo: personalized_info, creatorLicense: [creator_license])}
|
7
|
+
let(:outpatient_item) {MML::OutpatientItem.new(date: '2013-08-25', first: true, emergency: true, outPatientCondition: '10A.M.the patient was put into the ambulance on a stretcher and driven to our hospital.', staffs: [staff_info])}
|
8
|
+
|
9
|
+
it 'is an instance of MML::OutpatientItem' do
|
10
|
+
expect(outpatient_item).to be_an_instance_of MML::OutpatientItem
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'date should be assigned properly' do
|
14
|
+
expect(outpatient_item.date).to eq '2013-08-25'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'date is mandatory' do
|
18
|
+
expect {outpatient_item.date = nil}.to raise_error ArgumentError
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'first should be assigned properly' do
|
22
|
+
expect(outpatient_item.first).to be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'first is optional' do
|
26
|
+
expect {outpatient_item.first = nil}.not_to raise_error
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'emergency should be assigned properly' do
|
30
|
+
expect(outpatient_item.emergency).to be_true
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'emergency is optional' do
|
34
|
+
expect {outpatient_item.emergency = nil}.not_to raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'outPatientCondition should be assigned properly' do
|
38
|
+
expect(outpatient_item.outPatientCondition).to eq '10A.M.the patient was put into the ambulance on a stretcher and driven to our hospital.'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'staffs should be assigned properly' do
|
42
|
+
expect(outpatient_item.staffs[0].creatorLicense[0].value).to eq 'doctor'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'staffs is optional' do
|
46
|
+
expect {outpatient_item.staffs = nil}.not_to raise_error
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe MML::PastHistoryItem do
|
2
|
+
let(:past_history_item) {MML::PastHistoryItem.new(timeExpression: '6 years old', eventExpression: ['appendectomy'])}
|
3
|
+
|
4
|
+
it 'is an instance of MML::PastHistoryItem' do
|
5
|
+
expect(past_history_item).to be_an_instance_of MML::PastHistoryItem
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'timeExpression should be assigned properly' do
|
9
|
+
expect(past_history_item.timeExpression).to eq '6 years old'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'timeExpression is mandatory' do
|
13
|
+
expect {past_history_item.timeExpression = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'eventExpression should be assigned properly' do
|
17
|
+
expect(past_history_item.eventExpression).to eq ['appendectomy']
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'eventExpression is optional' do
|
21
|
+
expect {past_history_item.eventExpression = nil}.not_to raise_error
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
describe MML::PastHistory do
|
2
|
+
let(:past_history_item1) {MML::PastHistoryItem.new(timeExpression: '6 years old', eventExpression: ['appendectomy'])}
|
3
|
+
let(:past_history_item2) {MML::PastHistoryItem.new(timeExpression: '5 years ago', eventExpression: ['hypertension'])}
|
4
|
+
let(:past_history) {MML::PastHistory.new(freeNote: 'Appendectomy (6 years old), hypertension (5 years ago)', pastHistoryItem: [past_history_item1, past_history_item2])}
|
5
|
+
|
6
|
+
it 'is an instance of MML::PastHistory' do
|
7
|
+
expect(past_history).to be_an_instance_of MML::PastHistory
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'freeNote shuld be assigned properly' do
|
11
|
+
expect(past_history.freeNote).to eq 'Appendectomy (6 years old), hypertension (5 years ago)'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'pastHistoryItem should be assigned properly' do
|
15
|
+
expect(past_history.pastHistoryItem.size).to eq 2
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
describe MML::PatientInfo do
|
2
|
+
let(:master_id) { MML::Id.new(value: '0001', type: 'facility', tableId: 'MML0024') }
|
3
|
+
let(:other_id) { MML::OtherId.new(type: 'spouseId', id: MML::Id.new(value: '000A', type: 'facility', tableId: 'MML0024')) }
|
4
|
+
let(:person_name) { MML::Name.new(repCode: 'A', fullname: 'Shinji KOBAYASHI')}
|
5
|
+
let(:nationality) { MML::Nationality.new(value: 'JPN', subtype: 'USA') } # for rspec, not real
|
6
|
+
let(:race) {MML::Race.new(value: 'Japanese', raceCode: '2039-6', raceCodeId: 'Race & Ethnicity - CDC')}
|
7
|
+
let(:address) { MML::Address.new(repCode: 'A', addressClass: 'business', tableId: 'MML0025', full: '506, Dept. 9, Kyoto Research Park (KRP), Awata-cho 91, Chudoji, Shimogyo-ku, Kyoto-city')}
|
8
|
+
let(:email) { 'skoba@mmlexample.net' }
|
9
|
+
let(:phone) { MML::Phone.new(telEquipType: 'PH', area: '075', city: '874', number: '7030') }
|
10
|
+
let(:death) { MML::Death.new(flag: false)}
|
11
|
+
let(:patient_info) { MML::PatientInfo.new(masterId: master_id, otherId: [other_id], personName: [person_name], birthday: '1970-04-19', sex: 'male', nationality: nationality, race: race, marital: 'married', addresses: [address], emailAddresses: [email], phones: [phone], accountNumber: 'ABC0123', socialIdentification: 'KYO4567', death: death) }
|
12
|
+
|
13
|
+
it 'should be an instance of MML::PatientInfo' do
|
14
|
+
expect(patient_info).to be_an_instance_of MML::PatientInfo
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'masterId should be assigned properly' do
|
18
|
+
expect(patient_info.masterId.value).to eq '0001'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'masterId is mandatory' do
|
22
|
+
expect {patient_info.masterId = nil}.to raise_error ArgumentError
|
23
|
+
end
|
24
|
+
it 'otherId should be assigned properly' do
|
25
|
+
expect(patient_info.otherId[0].id.value).to eq '000A'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'personName should be assigned properly' do
|
29
|
+
expect(patient_info.personName[0].fullname).to eq 'Shinji KOBAYASHI'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'personName is mandatory' do
|
33
|
+
expect { patient_info.personName = nil }.to raise_error ArgumentError
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'birthday should be assigned properly' do
|
37
|
+
expect(patient_info.birthday).to eq '1970-04-19'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'birthday is mandatory' do
|
41
|
+
expect {patient_info.birthday = nil}.to raise_error ArgumentError
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'sex(gender) should be described' do
|
45
|
+
expect(patient_info.sex).to eq 'male'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'nationality should be assigned properly' do
|
49
|
+
expect(patient_info.nationality.value).to eq 'JPN'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'race should be assigned properly' do
|
53
|
+
expect(patient_info.race.value).to eq 'Japanese'
|
54
|
+
end
|
55
|
+
it 'marital should be assigned properly. not real' do
|
56
|
+
expect(patient_info.marital).to eq 'married'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'address should be properly assigned' do
|
60
|
+
expect(patient_info.addresses[0].addressClass).to eq 'business'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'emailAddresses should be assigned properly' do
|
64
|
+
expect(patient_info.emailAddresses[0]).to eq 'skoba@mmlexample.net'
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'phones should be properly assigned' do
|
68
|
+
expect(patient_info.phones[0].city).to eq '874'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'accountNumber should be assigned properly' do
|
72
|
+
expect(patient_info.accountNumber).to eq 'ABC0123'
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'socialNumber should be assigned properly' do
|
76
|
+
expect(patient_info.socialIdentification).to eq 'KYO4567'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'death flag should be assigned porperly' do
|
80
|
+
expect(patient_info.death.flag).to be_false
|
81
|
+
end
|
82
|
+
|
83
|
+
context '#to_xml' do
|
84
|
+
subject { patient_info.to_xml }
|
85
|
+
|
86
|
+
it {should match '<mmlPi:PatientModule>'}
|
87
|
+
it {should match '<mmlPi:uniqueInfo>'}
|
88
|
+
it {should match '<mmlPi:masterId>'}
|
89
|
+
it {should match '<mmlCm:Id'}
|
90
|
+
it {should match '>0001</mmlCm:Id>'}
|
91
|
+
it {should match '</mmlPi:masterId>'}
|
92
|
+
it {should match '<mmlPi:otherId mmlPi:type="spouseId"'}
|
93
|
+
it {should match '>000A</mmlCm:Id>'}
|
94
|
+
it {should match '</mmlPi:uniqueInfo>'}
|
95
|
+
it {should match '<mmlPi:personName>'}
|
96
|
+
it {should match '<mmlNm:Name'}
|
97
|
+
it {should match '<mmlNm:fullname>Shinji KOBAYASHI</mmlNm:fullname>'}
|
98
|
+
it {should match '</mmlNm:Name>'}
|
99
|
+
it {should match '</mmlPi:personName>'}
|
100
|
+
it {should match '<mmlPi:birthday>1970-04-19</mmlPi:birthday>'}
|
101
|
+
it {should match '<mmlPi:sex>male</mmlPi:sex>'}
|
102
|
+
it {should match '<mmlPi:nationality mmlPi:subtype="USA"'}
|
103
|
+
it {should match '>JPN</mmlPi:nationality>'}
|
104
|
+
it {should match '<mmlPi:race'}
|
105
|
+
it {should match 'mmlPi:raceCode='}
|
106
|
+
it {should match '<mmlPi:marital>married</mmlPi:marital>'}
|
107
|
+
it {should match '<mmlPi:addresses>'}
|
108
|
+
it {should match '<mmlAd:Address'}
|
109
|
+
it {should match '<mmlAd:full>506, Dept.'}
|
110
|
+
it {should match 'Kyoto-city</mmlAd:full>'}
|
111
|
+
it {should match '</mmlAd:Address>'}
|
112
|
+
it {should match '</mmlPi:addresses>'}
|
113
|
+
it {should match '<mmlPi:emailAddresses>'}
|
114
|
+
it {should match '<mmlCm:email>skoba@mmlexample.net</mmlCm:email>'}
|
115
|
+
it {should match '</mmlPi:emailAddresses>'}
|
116
|
+
it {should match '<mmlPi:phones>'}
|
117
|
+
it {should match '<mmlPh:Phone mmlPh:telEquipType="PH">'}
|
118
|
+
it {should match '<mmlPh:area>075</mmlPh:area>'}
|
119
|
+
it {should match '</mmlPh:Phone>'}
|
120
|
+
it {should match '</mmlPi:phones>'}
|
121
|
+
it {should match '<mmlPi:accountNumber>ABC0123</mmlPi:accountNumber>'}
|
122
|
+
it {should match '<mmlPi:socialIdentification>KYO4567</mmlPi:socialIdentification>'}
|
123
|
+
it {should match '<mmlPi:death>false</mmlPi:death>'}
|
124
|
+
it {should match '</mmlPi:PatientModule>'}
|
125
|
+
end
|
126
|
+
end
|
data/spec/mml/phone_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe MML::Phone do
|
2
|
-
let(:phone) { MML::Phone.new(telEquipType: 'PH', area: '075', city: '874', number: '7030', extension: '123', country: '81', memo: 'daytime') }
|
2
|
+
let(:phone) { MML::Phone.new(telEquipType: 'PH', area: '075', city: '874', number: '7030', full: '078-874-7030(123)', extension: '123', country: '81', memo: 'daytime') }
|
3
3
|
|
4
4
|
it 'should be an instance of MML::Phone' do
|
5
5
|
expect(phone).to be_an_instance_of MML::Phone
|
@@ -25,6 +25,9 @@ describe MML::Phone do
|
|
25
25
|
expect(phone.extension).to eq '123'
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'full should be assigned properly' do
|
29
|
+
expect(phone.full).to eq '078-874-7030(123)'
|
30
|
+
end
|
28
31
|
it 'country code should be assigned properly' do
|
29
32
|
expect(phone.country).to eq '81'
|
30
33
|
end
|
@@ -41,6 +44,7 @@ describe MML::Phone do
|
|
41
44
|
it {should match '<mmlPh:city>874</mmlPh:city>'}
|
42
45
|
it {should match '<mmlPh:number>7030</mmlPh:number>'}
|
43
46
|
it {should match '<mmlPh:extension>123</mmlPh:extension>'}
|
47
|
+
it {should match '<mmlPh:full>078-874-7030\(123\)</mmlPh:full>'}
|
44
48
|
it {should match '<mmlPh:country>81</mmlPh:country>'}
|
45
49
|
it {should match '<mmlPh:memo>daytime</mmlPh:memo>'}
|
46
50
|
it {should match '</mmlPh:Phone>'}
|