source: ruby/branches/0.5/lib/open_ehr/rm/ehr.rb@ 348

Last change on this file since 348 was 348, checked in by KOBAYASHI, Shinji, 14 years ago

refs #44

File size: 2.8 KB
Line 
1# rm::ehr
2# ehr module
3# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109004889781_854011_47Report.html
4# refs #44
5
6module OpenEHR
7 module RM
8 module EHR
9 class EHR
10 attr_reader :system_id, :ehr_id, :time_created, :contributions,
11 :ehr_access, :ehr_status, :compositions, :directory
12
13 def initialize(args = { })
14 self.system_id = args[:system_id]
15 self.ehr_id = args[:ehr_id]
16 self.time_created = args[:time_created]
17 self.contributions = args[:contributions]
18 self.ehr_access = args[:ehr_access]
19 self.ehr_status = args[:ehr_status]
20 self.compositions = args[:compositions]
21 self.directory = args[:directory]
22 end
23
24 def system_id=(system_id)
25 if system_id.nil?
26 raise ArgumentError, 'system_id is mandatory'
27 end
28 @system_id = system_id
29 end
30
31 def ehr_id=(ehr_id)
32 if ehr_id.nil?
33 raise ArgumentError, 'ehr_id is mandatory'
34 end
35 @ehr_id = ehr_id
36 end
37
38 def time_created=(time_created)
39 if time_created.nil?
40 raise ArgumentError, 'time_created is mandatory'
41 end
42 @time_created = time_created
43 end
44
45 def contributions=(contributions)
46 unless contributions.nil?
47 contributions.each do |contrib|
48 unless contrib.type == 'CONTRIBUTION'
49 raise ArgumentError, 'contribution type should be CONTRIBUTION'
50 end
51 end
52 @contributions = contributions
53 else
54 raise ArgumentError, 'contributions are mandatory'
55 end
56 end
57
58 def ehr_access=(ehr_access)
59 if ehr_access.nil? || ehr_access.type != 'VERSIONED_EHR_ACCESS'
60 raise ArgumentError, 'ehr_access is invalid'
61 end
62 @ehr_access = ehr_access
63 end
64
65 def ehr_status=(ehr_status)
66 if ehr_status.nil? || ehr_status.type != 'VERSIONED_EHR_STATUS'
67 raise ArgumentError, 'ehr_status is invalid'
68 end
69 @ehr_status = ehr_status
70 end
71
72 def compositions=(compositions)
73 unless compositions.nil?
74 compositions.each do |compo|
75 unless compo.type == 'VERSIONED_COMPOSITION'
76 raise ArgumentError, 'composition type should be VERSIONED_COMPOSITION'
77 end
78 end
79 @compositions = compositions
80 else
81 raise ArgumentError, 'compositions are mandatory'
82 end
83 end
84
85 def directory=(directory)
86 if !directory.nil? && directory.type != 'VERSIONED_FOLDER'
87 raise ArgumentError, 'invalid directory'
88 end
89 @directory = directory
90 end
91 end
92 end # of EHR
93 end # of RM
94end # of OpenEHR
Note: See TracBrowser for help on using the repository browser.