Class: ODDB::Doctor

Inherits:
Object show all
Includes:
AddressObserver, OddbYaml, Persistence
Defined in:
src/model/doctor.rb,
test/test_model/doctor.rb,
ext/export/src/oddb_yaml.rb,
src/custom/lookandfeelbase.rb

Constant Summary

ODBA_SERIALIZABLE =
[
  '@addresses', '@capabilities', '@specialities', '@ean13',
]
EXPORT_PROPERTIES =
[
  '@oid',
  '@ean13',
  '@email',
  '@language',
  '@firstname',
  '@name',
  '@exam',
  '@praxis',
  '@salutation',
  '@title',
  '@specialities',
  '@member',
  '@addresses',
]

Constants included from OddbYaml

EXPORT_PROPERTIES, YAML_URI

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from OddbYaml

#to_yaml_properties, #to_yaml_type

Methods included from AddressObserver

#address, #address_item, #create_address, #ydim_address_lines, #ydim_location

Methods included from PersistenceMethods

#checkout, #data_origin, #data_origins, #diff, #nil_if_empty, #parent, #structural_ancestors, #undiffable?, #update_values

Constructor Details

- (Doctor) initialize

A new instance of Doctor



23
24
25
26
# File 'src/model/doctor.rb', line 23

def initialize
  @addresses = []
  super
end

Instance Attribute Details

- (Object) addresses

Returns the value of attribute addresses



14
15
16
# File 'src/model/doctor.rb', line 14

def addresses
  @addresses
end

- (Object) capabilities

Returns the value of attribute capabilities



14
15
16
# File 'src/model/doctor.rb', line 14

def capabilities
  @capabilities
end

- (Object) ean13

Returns the value of attribute ean13



14
15
16
# File 'src/model/doctor.rb', line 14

def ean13
  @ean13
end

- (Object) email

Returns the value of attribute email



14
15
16
# File 'src/model/doctor.rb', line 14

def 
  @email
end

- (Object) exam

Returns the value of attribute exam



14
15
16
# File 'src/model/doctor.rb', line 14

def exam
  @exam
end

- (Object) firstname Also known as: name_first

Returns the value of attribute firstname



14
15
16
# File 'src/model/doctor.rb', line 14

def firstname
  @firstname
end

- (Object) language Also known as: correspondence

Returns the value of attribute language



14
15
16
# File 'src/model/doctor.rb', line 14

def language
  @language
end

- (Object) member

Returns the value of attribute member



14
15
16
# File 'src/model/doctor.rb', line 14

def member
  @member
end

- (Object) name

Returns the value of attribute name



14
15
16
# File 'src/model/doctor.rb', line 14

def name
  @name
end

- (Object) origin_db

Returns the value of attribute origin_db



14
15
16
# File 'src/model/doctor.rb', line 14

def origin_db
  @origin_db
end

- (Object) origin_id

Returns the value of attribute origin_id



14
15
16
# File 'src/model/doctor.rb', line 14

def origin_id
  @origin_id
end

- (Object) praxis

Returns the value of attribute praxis



14
15
16
# File 'src/model/doctor.rb', line 14

def praxis
  @praxis
end

- (Object) salutation

Returns the value of attribute salutation



14
15
16
# File 'src/model/doctor.rb', line 14

def salutation
  @salutation
end

- (Object) specialities

Returns the value of attribute specialities



14
15
16
# File 'src/model/doctor.rb', line 14

def specialities
  @specialities
end

- (Object) title

Returns the value of attribute title



14
15
16
# File 'src/model/doctor.rb', line 14

def title
  @title
end

Instance Method Details

- (Object) adjust_types(values, app = nil)



69
70
71
72
73
74
75
76
77
78
# File 'src/model/doctor.rb', line 69

def adjust_types(values, app=nil)
  values.each { |key, value|
    case key
    when :specialities, :capabilities
      values.store(key, value.to_s.split(/[\r\n]+/u))
    when :exam
      values.store(key, value.to_i)
    end
  }
end

- (Object) fullname



31
32
33
# File 'src/model/doctor.rb', line 31

def fullname
  [@firstname, @name].join(' ')
end

- (Object) init(app = nil)



27
28
29
30
# File 'src/model/doctor.rb', line 27

def init(app = nil)
  super
  @pointer.append(@oid)
end

- (Object) pointer_descr



34
35
36
# File 'src/model/doctor.rb', line 34

def pointer_descr
  [@title, @firstname, @name].compact.join(' ')
end

- (Object) praxis_address



37
38
39
40
41
# File 'src/model/doctor.rb', line 37

def praxis_address
  @addresses.find { |addr| 
    addr.type == 'at_praxis'
  }
end

- (Object) praxis_addresses



42
43
44
45
46
# File 'src/model/doctor.rb', line 42

def praxis_addresses  
  @addresses.select { |addr| 
    addr.type == 'at_praxis'
  }
end

- (Boolean) record_match?(origin_db, origin_id)

Returns:

  • (Boolean)


47
48
49
# File 'src/model/doctor.rb', line 47

def record_match?(origin_db, origin_id)
  @origin_db == origin_db && @origin_id == origin_id
end

- (Object) search_terms



50
51
52
53
54
55
56
57
58
59
# File 'src/model/doctor.rb', line 50

def search_terms
  ODDB.search_terms([
    @name, @firstname,  
    @email,
    @specialities,
    @ean13,
  ] + @addresses.collect { |addr| 
    addr.search_terms 
  })
end

- (Object) search_text



60
61
62
# File 'src/model/doctor.rb', line 60

def search_text
  search_terms.join(' ')
end

- (Object) work_addresses



63
64
65
66
67
# File 'src/model/doctor.rb', line 63

def work_addresses  
  @addresses.select { |addr| 
    addr.type == 'at_work'
  }
end