candidhealth 0.39.1 → 0.39.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.
@@ -0,0 +1,627 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../encounter_providers/v_2/types/billing_provider"
4
+ require_relative "../../../encounter_providers/v_2/types/rendering_provider"
5
+ require_relative "../../../encounter_providers/v_2/types/initial_referring_provider"
6
+ require_relative "../../../encounter_providers/v_2/types/supervising_provider"
7
+ require_relative "../../../service_facility/types/encounter_service_facility_base"
8
+ require_relative "../../../diagnoses/types/diagnosis_create"
9
+ require_relative "clinical_note_category_create"
10
+ require_relative "../../../billing_notes/v_2/types/billing_note_base"
11
+ require_relative "../../../commons/types/facility_type_code"
12
+ require_relative "patient_history_category"
13
+ require_relative "../../../service_lines/v_2/types/service_line_create"
14
+ require_relative "../../../claim_submission/v_1/types/external_claim_submission_create"
15
+ require_relative "../../../custom_schemas/v_1/types/schema_instance"
16
+ require "date"
17
+ require_relative "medication"
18
+ require_relative "vitals"
19
+ require_relative "intervention"
20
+ require_relative "../../../commons/types/street_address_long_zip"
21
+ require_relative "synchronicity_type"
22
+ require_relative "billable_status_type"
23
+ require_relative "service_authorization_exception_code"
24
+ require_relative "../../../commons/types/delay_reason_code"
25
+ require "ostruct"
26
+ require "json"
27
+
28
+ module CandidApiClient
29
+ module Encounters
30
+ module V4
31
+ module Types
32
+ class EncounterCreateFromPreEncounter
33
+ # @return [String]
34
+ attr_reader :pre_encounter_patient_id
35
+ # @return [Array<String>]
36
+ attr_reader :pre_encounter_appointment_ids
37
+ # @return [CandidApiClient::EncounterProviders::V2::Types::BillingProvider] The billing provider is the provider or business entity submitting the claim.
38
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
39
+ # rendering provider. From a payer's perspective, this represents the person or
40
+ # entity being reimbursed. When a contract exists with the target payer, the
41
+ # billing provider should be the entity contracted with the payer. In some
42
+ # circumstances, this will be an individual provider. In that case, submit that
43
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
44
+ # contracting. In other cases, the billing entity will be a medical group. If so,
45
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
46
+ attr_reader :billing_provider
47
+ # @return [CandidApiClient::EncounterProviders::V2::Types::RenderingProvider] The rendering provider is the practitioner -- physician, nurse practitioner,
48
+ # etc. -- performing the service.
49
+ # For telehealth services, the rendering provider performs the visit, asynchronous
50
+ # communication, or other service. The rendering provider address should generally
51
+ # be the same as the service facility address.
52
+ attr_reader :rendering_provider
53
+ # @return [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
54
+ # this loop to
55
+ # indicate the initial referral from the primary care provider or whatever
56
+ # provider wrote the initial referral for this patient's episode of care being
57
+ # billed/reported in this transaction.
58
+ attr_reader :initial_referring_provider
59
+ # @return [CandidApiClient::EncounterProviders::V2::Types::SupervisingProvider] Required when the rendering provider is supervised by a physician. If not
60
+ # required by this implementation guide, do not send.
61
+ attr_reader :supervising_provider
62
+ # @return [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityBase] Encounter Service facility is typically the location a medical service was
63
+ # rendered, such as a provider office or hospital. For telehealth, service
64
+ # facility can represent the provider's location when the service was delivered
65
+ # (e.g., home), or the location where an in-person visit would have taken place,
66
+ # whichever is easier to identify. If the provider is in-network, service facility
67
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
68
+ # for an in-network claim to be successfully adjudicated, the service facility
69
+ # address listed on claims must match what was provided to the payer during the
70
+ # credentialing process.
71
+ attr_reader :service_facility
72
+ # @return [Array<CandidApiClient::Diagnoses::Types::DiagnosisCreate>] Ideally, this field should contain no more than 12 diagnoses. However, more
73
+ # diagnoses
74
+ # may be submitted at this time, and coders will later prioritize the 12 that will
75
+ # be
76
+ # submitted to the payor.
77
+ attr_reader :diagnoses
78
+ # @return [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate>] Holds a collection of clinical observations made by healthcare providers during
79
+ # patient encounters.
80
+ attr_reader :clinical_notes
81
+ # @return [Array<CandidApiClient::BillingNotes::V2::Types::BillingNoteBase>] Spot to store misc, human-readable, notes about this encounter to be used
82
+ # in the billing process.
83
+ attr_reader :billing_notes
84
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
85
+ # telemedicine, 11 for in-person. Full list [here](https://www.cms
86
+ # .gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
87
+ attr_reader :place_of_service_code
88
+ # @return [Array<CandidApiClient::Encounters::V4::Types::PatientHistoryCategory>]
89
+ attr_reader :patient_histories
90
+ # @return [Array<CandidApiClient::ServiceLines::V2::Types::ServiceLineCreate>] Each service line must be linked to a diagnosis. Concretely,
91
+ # `service_line.diagnosis_pointers`must contain at least one entry which should be
92
+ # in bounds of the diagnoses list field.
93
+ attr_reader :service_lines
94
+ # @return [CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreate] To be included for claims that have been submitted outside of Candid.
95
+ # Candid supports posting remits and payments to these claims and working them
96
+ # in-platform (e.g. editing, resubmitting).
97
+ attr_reader :external_claim_submission
98
+ # @return [Array<String>] Names of tags that should be on the encounter.
99
+ attr_reader :tag_ids
100
+ # @return [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstance>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
101
+ # Multiple schema
102
+ # instances cannot be created for the same schema on an encounter.
103
+ attr_reader :schema_instances
104
+ # @return [String] A client-specified unique ID to associate with this encounter;
105
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
106
+ # This field should not contain PHI.
107
+ attr_reader :external_id
108
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
109
+ # This date must be the local date in the timezone where the service occurred.
110
+ # Box 24a on the CMS-1500 claim form.
111
+ # If service occurred over a range of dates, this should be the start date.
112
+ # date_of_service must be defined on either the encounter or the service lines but
113
+ # not both.
114
+ # If there are greater than zero service lines, it is recommended to specify
115
+ # date_of_service on the service_line instead of on the encounter to prepare for
116
+ # future API versions.
117
+ attr_reader :date_of_service
118
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
119
+ # This date must be the local date in the timezone where the service occurred.
120
+ # If omitted, the Encounter is assumed to be for a single day.
121
+ # Must not be temporally before the date_of_service field.
122
+ # If there are greater than zero service lines, it is recommended to specify
123
+ # end_date_of_service on the service_line instead of on the encounter to prepare
124
+ # for future API versions.
125
+ attr_reader :end_date_of_service
126
+ # @return [Boolean] Whether this patient has authorized the release of medical information
127
+ # for billing purpose.
128
+ # Box 12 on the CMS-1500 claim form.
129
+ attr_reader :patient_authorized_release
130
+ # @return [Boolean] Whether this patient has authorized insurance payments to be made to you,
131
+ # not them. If false, patient may receive reimbursement.
132
+ # Box 13 on the CMS-1500 claim form.
133
+ attr_reader :benefits_assigned_to_provider
134
+ # @return [Boolean] Whether you have accepted the patient's authorization for insurance payments
135
+ # to be made to you, not them.
136
+ # Box 27 on the CMS-1500 claim form.
137
+ attr_reader :provider_accepts_assignment
138
+ # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
139
+ # Headaches").
140
+ attr_reader :appointment_type
141
+ # @return [Array<CandidApiClient::Encounters::V4::Types::Medication>]
142
+ attr_reader :existing_medications
143
+ # @return [CandidApiClient::Encounters::V4::Types::Vitals]
144
+ attr_reader :vitals
145
+ # @return [Array<CandidApiClient::Encounters::V4::Types::Intervention>]
146
+ attr_reader :interventions
147
+ # @return [CandidApiClient::Commons::Types::StreetAddressLongZip] Specifies the address to which payments for the claim should be sent.
148
+ attr_reader :pay_to_address
149
+ # @return [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter.
150
+ # Asynchronous encounters occur when providers and patients communicate online
151
+ # using
152
+ # forms, instant messaging, or other pre-recorded digital mediums.
153
+ # Synchronous encounters occur in live, real-time settings where the patient
154
+ # interacts
155
+ # directly with the provider, such as over video or a phone call.
156
+ attr_reader :synchronicity
157
+ # @return [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
158
+ # Examples for when this should be set to NOT_BILLABLE include
159
+ # if the Encounter has not occurred yet or if there is no intention of ever
160
+ # billing the responsible_party.
161
+ attr_reader :billable_status
162
+ # @return [String] Defines additional information on the claim needed by the payer.
163
+ # Box 19 on the CMS-1500 claim form.
164
+ attr_reader :additional_information
165
+ # @return [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
166
+ # Required when mandated by government law or regulation to obtain authorization
167
+ # for specific service(s) but, for the
168
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
169
+ # the service was performed without
170
+ # obtaining the authorization.
171
+ attr_reader :service_authorization_exception_code
172
+ # @return [Date] 837p Loop2300 DTP\*435, CMS-1500 Box 18
173
+ # Required on all ambulance claims when the patient was known to be admitted to
174
+ # the hospital.
175
+ # OR
176
+ # Required on all claims involving inpatient medical visits.
177
+ attr_reader :admission_date
178
+ # @return [Date] 837p Loop2300 DTP\*096, CMS-1500 Box 18
179
+ # Required for inpatient claims when the patient was discharged from the facility
180
+ # and the discharge date is known.
181
+ attr_reader :discharge_date
182
+ # @return [Date] 837p Loop2300 DTP\*431, CMS-1500 Box 14
183
+ # Required for the initial medical service or visit performed in response to a
184
+ # medical emergency when the date is available and is different than the date of
185
+ # service.
186
+ # OR
187
+ # This date is the onset of acute symptoms for the current illness or condition.
188
+ attr_reader :onset_of_current_illness_or_symptom_date
189
+ # @return [Date] 837p Loop2300 DTP\*484, CMS-1500 Box 14
190
+ # Required when, in the judgment of the provider, the services on this claim are
191
+ # related to the patient's pregnancy.
192
+ attr_reader :last_menstrual_period_date
193
+ # @return [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
194
+ # Code indicating the reason why a request was delayed
195
+ attr_reader :delay_reason_code
196
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
197
+ attr_reader :additional_properties
198
+ # @return [Object]
199
+ attr_reader :_field_set
200
+ protected :_field_set
201
+
202
+ OMIT = Object.new
203
+
204
+ # @param pre_encounter_patient_id [String]
205
+ # @param pre_encounter_appointment_ids [Array<String>]
206
+ # @param billing_provider [CandidApiClient::EncounterProviders::V2::Types::BillingProvider] The billing provider is the provider or business entity submitting the claim.
207
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
208
+ # rendering provider. From a payer's perspective, this represents the person or
209
+ # entity being reimbursed. When a contract exists with the target payer, the
210
+ # billing provider should be the entity contracted with the payer. In some
211
+ # circumstances, this will be an individual provider. In that case, submit that
212
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
213
+ # contracting. In other cases, the billing entity will be a medical group. If so,
214
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
215
+ # @param rendering_provider [CandidApiClient::EncounterProviders::V2::Types::RenderingProvider] The rendering provider is the practitioner -- physician, nurse practitioner,
216
+ # etc. -- performing the service.
217
+ # For telehealth services, the rendering provider performs the visit, asynchronous
218
+ # communication, or other service. The rendering provider address should generally
219
+ # be the same as the service facility address.
220
+ # @param initial_referring_provider [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
221
+ # this loop to
222
+ # indicate the initial referral from the primary care provider or whatever
223
+ # provider wrote the initial referral for this patient's episode of care being
224
+ # billed/reported in this transaction.
225
+ # @param supervising_provider [CandidApiClient::EncounterProviders::V2::Types::SupervisingProvider] Required when the rendering provider is supervised by a physician. If not
226
+ # required by this implementation guide, do not send.
227
+ # @param service_facility [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityBase] Encounter Service facility is typically the location a medical service was
228
+ # rendered, such as a provider office or hospital. For telehealth, service
229
+ # facility can represent the provider's location when the service was delivered
230
+ # (e.g., home), or the location where an in-person visit would have taken place,
231
+ # whichever is easier to identify. If the provider is in-network, service facility
232
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
233
+ # for an in-network claim to be successfully adjudicated, the service facility
234
+ # address listed on claims must match what was provided to the payer during the
235
+ # credentialing process.
236
+ # @param diagnoses [Array<CandidApiClient::Diagnoses::Types::DiagnosisCreate>] Ideally, this field should contain no more than 12 diagnoses. However, more
237
+ # diagnoses
238
+ # may be submitted at this time, and coders will later prioritize the 12 that will
239
+ # be
240
+ # submitted to the payor.
241
+ # @param clinical_notes [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate>] Holds a collection of clinical observations made by healthcare providers during
242
+ # patient encounters.
243
+ # @param billing_notes [Array<CandidApiClient::BillingNotes::V2::Types::BillingNoteBase>] Spot to store misc, human-readable, notes about this encounter to be used
244
+ # in the billing process.
245
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
246
+ # telemedicine, 11 for in-person. Full list [here](https://www.cms
247
+ # .gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
248
+ # @param patient_histories [Array<CandidApiClient::Encounters::V4::Types::PatientHistoryCategory>]
249
+ # @param service_lines [Array<CandidApiClient::ServiceLines::V2::Types::ServiceLineCreate>] Each service line must be linked to a diagnosis. Concretely,
250
+ # `service_line.diagnosis_pointers`must contain at least one entry which should be
251
+ # in bounds of the diagnoses list field.
252
+ # @param external_claim_submission [CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreate] To be included for claims that have been submitted outside of Candid.
253
+ # Candid supports posting remits and payments to these claims and working them
254
+ # in-platform (e.g. editing, resubmitting).
255
+ # @param tag_ids [Array<String>] Names of tags that should be on the encounter.
256
+ # @param schema_instances [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstance>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
257
+ # Multiple schema
258
+ # instances cannot be created for the same schema on an encounter.
259
+ # @param external_id [String] A client-specified unique ID to associate with this encounter;
260
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
261
+ # This field should not contain PHI.
262
+ # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
263
+ # This date must be the local date in the timezone where the service occurred.
264
+ # Box 24a on the CMS-1500 claim form.
265
+ # If service occurred over a range of dates, this should be the start date.
266
+ # date_of_service must be defined on either the encounter or the service lines but
267
+ # not both.
268
+ # If there are greater than zero service lines, it is recommended to specify
269
+ # date_of_service on the service_line instead of on the encounter to prepare for
270
+ # future API versions.
271
+ # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
272
+ # This date must be the local date in the timezone where the service occurred.
273
+ # If omitted, the Encounter is assumed to be for a single day.
274
+ # Must not be temporally before the date_of_service field.
275
+ # If there are greater than zero service lines, it is recommended to specify
276
+ # end_date_of_service on the service_line instead of on the encounter to prepare
277
+ # for future API versions.
278
+ # @param patient_authorized_release [Boolean] Whether this patient has authorized the release of medical information
279
+ # for billing purpose.
280
+ # Box 12 on the CMS-1500 claim form.
281
+ # @param benefits_assigned_to_provider [Boolean] Whether this patient has authorized insurance payments to be made to you,
282
+ # not them. If false, patient may receive reimbursement.
283
+ # Box 13 on the CMS-1500 claim form.
284
+ # @param provider_accepts_assignment [Boolean] Whether you have accepted the patient's authorization for insurance payments
285
+ # to be made to you, not them.
286
+ # Box 27 on the CMS-1500 claim form.
287
+ # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
288
+ # Headaches").
289
+ # @param existing_medications [Array<CandidApiClient::Encounters::V4::Types::Medication>]
290
+ # @param vitals [CandidApiClient::Encounters::V4::Types::Vitals]
291
+ # @param interventions [Array<CandidApiClient::Encounters::V4::Types::Intervention>]
292
+ # @param pay_to_address [CandidApiClient::Commons::Types::StreetAddressLongZip] Specifies the address to which payments for the claim should be sent.
293
+ # @param synchronicity [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter.
294
+ # Asynchronous encounters occur when providers and patients communicate online
295
+ # using
296
+ # forms, instant messaging, or other pre-recorded digital mediums.
297
+ # Synchronous encounters occur in live, real-time settings where the patient
298
+ # interacts
299
+ # directly with the provider, such as over video or a phone call.
300
+ # @param billable_status [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
301
+ # Examples for when this should be set to NOT_BILLABLE include
302
+ # if the Encounter has not occurred yet or if there is no intention of ever
303
+ # billing the responsible_party.
304
+ # @param additional_information [String] Defines additional information on the claim needed by the payer.
305
+ # Box 19 on the CMS-1500 claim form.
306
+ # @param service_authorization_exception_code [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
307
+ # Required when mandated by government law or regulation to obtain authorization
308
+ # for specific service(s) but, for the
309
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
310
+ # the service was performed without
311
+ # obtaining the authorization.
312
+ # @param admission_date [Date] 837p Loop2300 DTP\*435, CMS-1500 Box 18
313
+ # Required on all ambulance claims when the patient was known to be admitted to
314
+ # the hospital.
315
+ # OR
316
+ # Required on all claims involving inpatient medical visits.
317
+ # @param discharge_date [Date] 837p Loop2300 DTP\*096, CMS-1500 Box 18
318
+ # Required for inpatient claims when the patient was discharged from the facility
319
+ # and the discharge date is known.
320
+ # @param onset_of_current_illness_or_symptom_date [Date] 837p Loop2300 DTP\*431, CMS-1500 Box 14
321
+ # Required for the initial medical service or visit performed in response to a
322
+ # medical emergency when the date is available and is different than the date of
323
+ # service.
324
+ # OR
325
+ # This date is the onset of acute symptoms for the current illness or condition.
326
+ # @param last_menstrual_period_date [Date] 837p Loop2300 DTP\*484, CMS-1500 Box 14
327
+ # Required when, in the judgment of the provider, the services on this claim are
328
+ # related to the patient's pregnancy.
329
+ # @param delay_reason_code [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
330
+ # Code indicating the reason why a request was delayed
331
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
332
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterCreateFromPreEncounter]
333
+ def initialize(pre_encounter_patient_id:, pre_encounter_appointment_ids:, billing_provider:,
334
+ rendering_provider:, diagnoses:, place_of_service_code:, external_id:, patient_authorized_release:, benefits_assigned_to_provider:, provider_accepts_assignment:, billable_status:, initial_referring_provider: OMIT, supervising_provider: OMIT, service_facility: OMIT, clinical_notes: OMIT, billing_notes: OMIT, patient_histories: OMIT, service_lines: OMIT, external_claim_submission: OMIT, tag_ids: OMIT, schema_instances: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, appointment_type: OMIT, existing_medications: OMIT, vitals: OMIT, interventions: OMIT, pay_to_address: OMIT, synchronicity: OMIT, additional_information: OMIT, service_authorization_exception_code: OMIT, admission_date: OMIT, discharge_date: OMIT, onset_of_current_illness_or_symptom_date: OMIT, last_menstrual_period_date: OMIT, delay_reason_code: OMIT, additional_properties: nil)
335
+ @pre_encounter_patient_id = pre_encounter_patient_id
336
+ @pre_encounter_appointment_ids = pre_encounter_appointment_ids
337
+ @billing_provider = billing_provider
338
+ @rendering_provider = rendering_provider
339
+ @initial_referring_provider = initial_referring_provider if initial_referring_provider != OMIT
340
+ @supervising_provider = supervising_provider if supervising_provider != OMIT
341
+ @service_facility = service_facility if service_facility != OMIT
342
+ @diagnoses = diagnoses
343
+ @clinical_notes = clinical_notes if clinical_notes != OMIT
344
+ @billing_notes = billing_notes if billing_notes != OMIT
345
+ @place_of_service_code = place_of_service_code
346
+ @patient_histories = patient_histories if patient_histories != OMIT
347
+ @service_lines = service_lines if service_lines != OMIT
348
+ @external_claim_submission = external_claim_submission if external_claim_submission != OMIT
349
+ @tag_ids = tag_ids if tag_ids != OMIT
350
+ @schema_instances = schema_instances if schema_instances != OMIT
351
+ @external_id = external_id
352
+ @date_of_service = date_of_service if date_of_service != OMIT
353
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
354
+ @patient_authorized_release = patient_authorized_release
355
+ @benefits_assigned_to_provider = benefits_assigned_to_provider
356
+ @provider_accepts_assignment = provider_accepts_assignment
357
+ @appointment_type = appointment_type if appointment_type != OMIT
358
+ @existing_medications = existing_medications if existing_medications != OMIT
359
+ @vitals = vitals if vitals != OMIT
360
+ @interventions = interventions if interventions != OMIT
361
+ @pay_to_address = pay_to_address if pay_to_address != OMIT
362
+ @synchronicity = synchronicity if synchronicity != OMIT
363
+ @billable_status = billable_status
364
+ @additional_information = additional_information if additional_information != OMIT
365
+ if service_authorization_exception_code != OMIT
366
+ @service_authorization_exception_code = service_authorization_exception_code
367
+ end
368
+ @admission_date = admission_date if admission_date != OMIT
369
+ @discharge_date = discharge_date if discharge_date != OMIT
370
+ if onset_of_current_illness_or_symptom_date != OMIT
371
+ @onset_of_current_illness_or_symptom_date = onset_of_current_illness_or_symptom_date
372
+ end
373
+ @last_menstrual_period_date = last_menstrual_period_date if last_menstrual_period_date != OMIT
374
+ @delay_reason_code = delay_reason_code if delay_reason_code != OMIT
375
+ @additional_properties = additional_properties
376
+ @_field_set = {
377
+ "pre_encounter_patient_id": pre_encounter_patient_id,
378
+ "pre_encounter_appointment_ids": pre_encounter_appointment_ids,
379
+ "billing_provider": billing_provider,
380
+ "rendering_provider": rendering_provider,
381
+ "initial_referring_provider": initial_referring_provider,
382
+ "supervising_provider": supervising_provider,
383
+ "service_facility": service_facility,
384
+ "diagnoses": diagnoses,
385
+ "clinical_notes": clinical_notes,
386
+ "billing_notes": billing_notes,
387
+ "place_of_service_code": place_of_service_code,
388
+ "patient_histories": patient_histories,
389
+ "service_lines": service_lines,
390
+ "external_claim_submission": external_claim_submission,
391
+ "tag_ids": tag_ids,
392
+ "schema_instances": schema_instances,
393
+ "external_id": external_id,
394
+ "date_of_service": date_of_service,
395
+ "end_date_of_service": end_date_of_service,
396
+ "patient_authorized_release": patient_authorized_release,
397
+ "benefits_assigned_to_provider": benefits_assigned_to_provider,
398
+ "provider_accepts_assignment": provider_accepts_assignment,
399
+ "appointment_type": appointment_type,
400
+ "existing_medications": existing_medications,
401
+ "vitals": vitals,
402
+ "interventions": interventions,
403
+ "pay_to_address": pay_to_address,
404
+ "synchronicity": synchronicity,
405
+ "billable_status": billable_status,
406
+ "additional_information": additional_information,
407
+ "service_authorization_exception_code": service_authorization_exception_code,
408
+ "admission_date": admission_date,
409
+ "discharge_date": discharge_date,
410
+ "onset_of_current_illness_or_symptom_date": onset_of_current_illness_or_symptom_date,
411
+ "last_menstrual_period_date": last_menstrual_period_date,
412
+ "delay_reason_code": delay_reason_code
413
+ }.reject do |_k, v|
414
+ v == OMIT
415
+ end
416
+ end
417
+
418
+ # Deserialize a JSON object to an instance of EncounterCreateFromPreEncounter
419
+ #
420
+ # @param json_object [String]
421
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterCreateFromPreEncounter]
422
+ def self.from_json(json_object:)
423
+ struct = JSON.parse(json_object, object_class: OpenStruct)
424
+ parsed_json = JSON.parse(json_object)
425
+ pre_encounter_patient_id = struct["pre_encounter_patient_id"]
426
+ pre_encounter_appointment_ids = struct["pre_encounter_appointment_ids"]
427
+ if parsed_json["billing_provider"].nil?
428
+ billing_provider = nil
429
+ else
430
+ billing_provider = parsed_json["billing_provider"].to_json
431
+ billing_provider = CandidApiClient::EncounterProviders::V2::Types::BillingProvider.from_json(json_object: billing_provider)
432
+ end
433
+ if parsed_json["rendering_provider"].nil?
434
+ rendering_provider = nil
435
+ else
436
+ rendering_provider = parsed_json["rendering_provider"].to_json
437
+ rendering_provider = CandidApiClient::EncounterProviders::V2::Types::RenderingProvider.from_json(json_object: rendering_provider)
438
+ end
439
+ if parsed_json["initial_referring_provider"].nil?
440
+ initial_referring_provider = nil
441
+ else
442
+ initial_referring_provider = parsed_json["initial_referring_provider"].to_json
443
+ initial_referring_provider = CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider.from_json(json_object: initial_referring_provider)
444
+ end
445
+ if parsed_json["supervising_provider"].nil?
446
+ supervising_provider = nil
447
+ else
448
+ supervising_provider = parsed_json["supervising_provider"].to_json
449
+ supervising_provider = CandidApiClient::EncounterProviders::V2::Types::SupervisingProvider.from_json(json_object: supervising_provider)
450
+ end
451
+ if parsed_json["service_facility"].nil?
452
+ service_facility = nil
453
+ else
454
+ service_facility = parsed_json["service_facility"].to_json
455
+ service_facility = CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityBase.from_json(json_object: service_facility)
456
+ end
457
+ diagnoses = parsed_json["diagnoses"]&.map do |item|
458
+ item = item.to_json
459
+ CandidApiClient::Diagnoses::Types::DiagnosisCreate.from_json(json_object: item)
460
+ end
461
+ clinical_notes = parsed_json["clinical_notes"]&.map do |item|
462
+ item = item.to_json
463
+ CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate.from_json(json_object: item)
464
+ end
465
+ billing_notes = parsed_json["billing_notes"]&.map do |item|
466
+ item = item.to_json
467
+ CandidApiClient::BillingNotes::V2::Types::BillingNoteBase.from_json(json_object: item)
468
+ end
469
+ place_of_service_code = struct["place_of_service_code"]
470
+ patient_histories = parsed_json["patient_histories"]&.map do |item|
471
+ item = item.to_json
472
+ CandidApiClient::Encounters::V4::Types::PatientHistoryCategory.from_json(json_object: item)
473
+ end
474
+ service_lines = parsed_json["service_lines"]&.map do |item|
475
+ item = item.to_json
476
+ CandidApiClient::ServiceLines::V2::Types::ServiceLineCreate.from_json(json_object: item)
477
+ end
478
+ if parsed_json["external_claim_submission"].nil?
479
+ external_claim_submission = nil
480
+ else
481
+ external_claim_submission = parsed_json["external_claim_submission"].to_json
482
+ external_claim_submission = CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreate.from_json(json_object: external_claim_submission)
483
+ end
484
+ tag_ids = struct["tag_ids"]
485
+ schema_instances = parsed_json["schema_instances"]&.map do |item|
486
+ item = item.to_json
487
+ CandidApiClient::CustomSchemas::V1::Types::SchemaInstance.from_json(json_object: item)
488
+ end
489
+ external_id = struct["external_id"]
490
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
491
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
492
+ Date.parse(parsed_json["end_date_of_service"])
493
+ end
494
+ patient_authorized_release = struct["patient_authorized_release"]
495
+ benefits_assigned_to_provider = struct["benefits_assigned_to_provider"]
496
+ provider_accepts_assignment = struct["provider_accepts_assignment"]
497
+ appointment_type = struct["appointment_type"]
498
+ existing_medications = parsed_json["existing_medications"]&.map do |item|
499
+ item = item.to_json
500
+ CandidApiClient::Encounters::V4::Types::Medication.from_json(json_object: item)
501
+ end
502
+ if parsed_json["vitals"].nil?
503
+ vitals = nil
504
+ else
505
+ vitals = parsed_json["vitals"].to_json
506
+ vitals = CandidApiClient::Encounters::V4::Types::Vitals.from_json(json_object: vitals)
507
+ end
508
+ interventions = parsed_json["interventions"]&.map do |item|
509
+ item = item.to_json
510
+ CandidApiClient::Encounters::V4::Types::Intervention.from_json(json_object: item)
511
+ end
512
+ if parsed_json["pay_to_address"].nil?
513
+ pay_to_address = nil
514
+ else
515
+ pay_to_address = parsed_json["pay_to_address"].to_json
516
+ pay_to_address = CandidApiClient::Commons::Types::StreetAddressLongZip.from_json(json_object: pay_to_address)
517
+ end
518
+ synchronicity = struct["synchronicity"]
519
+ billable_status = struct["billable_status"]
520
+ additional_information = struct["additional_information"]
521
+ service_authorization_exception_code = struct["service_authorization_exception_code"]
522
+ admission_date = (Date.parse(parsed_json["admission_date"]) unless parsed_json["admission_date"].nil?)
523
+ discharge_date = (Date.parse(parsed_json["discharge_date"]) unless parsed_json["discharge_date"].nil?)
524
+ onset_of_current_illness_or_symptom_date = unless parsed_json["onset_of_current_illness_or_symptom_date"].nil?
525
+ Date.parse(parsed_json["onset_of_current_illness_or_symptom_date"])
526
+ end
527
+ last_menstrual_period_date = unless parsed_json["last_menstrual_period_date"].nil?
528
+ Date.parse(parsed_json["last_menstrual_period_date"])
529
+ end
530
+ delay_reason_code = struct["delay_reason_code"]
531
+ new(
532
+ pre_encounter_patient_id: pre_encounter_patient_id,
533
+ pre_encounter_appointment_ids: pre_encounter_appointment_ids,
534
+ billing_provider: billing_provider,
535
+ rendering_provider: rendering_provider,
536
+ initial_referring_provider: initial_referring_provider,
537
+ supervising_provider: supervising_provider,
538
+ service_facility: service_facility,
539
+ diagnoses: diagnoses,
540
+ clinical_notes: clinical_notes,
541
+ billing_notes: billing_notes,
542
+ place_of_service_code: place_of_service_code,
543
+ patient_histories: patient_histories,
544
+ service_lines: service_lines,
545
+ external_claim_submission: external_claim_submission,
546
+ tag_ids: tag_ids,
547
+ schema_instances: schema_instances,
548
+ external_id: external_id,
549
+ date_of_service: date_of_service,
550
+ end_date_of_service: end_date_of_service,
551
+ patient_authorized_release: patient_authorized_release,
552
+ benefits_assigned_to_provider: benefits_assigned_to_provider,
553
+ provider_accepts_assignment: provider_accepts_assignment,
554
+ appointment_type: appointment_type,
555
+ existing_medications: existing_medications,
556
+ vitals: vitals,
557
+ interventions: interventions,
558
+ pay_to_address: pay_to_address,
559
+ synchronicity: synchronicity,
560
+ billable_status: billable_status,
561
+ additional_information: additional_information,
562
+ service_authorization_exception_code: service_authorization_exception_code,
563
+ admission_date: admission_date,
564
+ discharge_date: discharge_date,
565
+ onset_of_current_illness_or_symptom_date: onset_of_current_illness_or_symptom_date,
566
+ last_menstrual_period_date: last_menstrual_period_date,
567
+ delay_reason_code: delay_reason_code,
568
+ additional_properties: struct
569
+ )
570
+ end
571
+
572
+ # Serialize an instance of EncounterCreateFromPreEncounter to a JSON object
573
+ #
574
+ # @return [String]
575
+ def to_json(*_args)
576
+ @_field_set&.to_json
577
+ end
578
+
579
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
580
+ # hash and check each fields type against the current object's property
581
+ # definitions.
582
+ #
583
+ # @param obj [Object]
584
+ # @return [Void]
585
+ def self.validate_raw(obj:)
586
+ obj.pre_encounter_patient_id.is_a?(String) != false || raise("Passed value for field obj.pre_encounter_patient_id is not the expected type, validation failed.")
587
+ obj.pre_encounter_appointment_ids.is_a?(Array) != false || raise("Passed value for field obj.pre_encounter_appointment_ids is not the expected type, validation failed.")
588
+ CandidApiClient::EncounterProviders::V2::Types::BillingProvider.validate_raw(obj: obj.billing_provider)
589
+ CandidApiClient::EncounterProviders::V2::Types::RenderingProvider.validate_raw(obj: obj.rendering_provider)
590
+ obj.initial_referring_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider.validate_raw(obj: obj.initial_referring_provider)
591
+ obj.supervising_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::SupervisingProvider.validate_raw(obj: obj.supervising_provider)
592
+ obj.service_facility.nil? || CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityBase.validate_raw(obj: obj.service_facility)
593
+ obj.diagnoses.is_a?(Array) != false || raise("Passed value for field obj.diagnoses is not the expected type, validation failed.")
594
+ obj.clinical_notes&.is_a?(Array) != false || raise("Passed value for field obj.clinical_notes is not the expected type, validation failed.")
595
+ obj.billing_notes&.is_a?(Array) != false || raise("Passed value for field obj.billing_notes is not the expected type, validation failed.")
596
+ obj.place_of_service_code.is_a?(CandidApiClient::Commons::Types::FacilityTypeCode) != false || raise("Passed value for field obj.place_of_service_code is not the expected type, validation failed.")
597
+ obj.patient_histories&.is_a?(Array) != false || raise("Passed value for field obj.patient_histories is not the expected type, validation failed.")
598
+ obj.service_lines&.is_a?(Array) != false || raise("Passed value for field obj.service_lines is not the expected type, validation failed.")
599
+ obj.external_claim_submission.nil? || CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreate.validate_raw(obj: obj.external_claim_submission)
600
+ obj.tag_ids&.is_a?(Array) != false || raise("Passed value for field obj.tag_ids is not the expected type, validation failed.")
601
+ obj.schema_instances&.is_a?(Array) != false || raise("Passed value for field obj.schema_instances is not the expected type, validation failed.")
602
+ obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
603
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
604
+ obj.end_date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.end_date_of_service is not the expected type, validation failed.")
605
+ obj.patient_authorized_release.is_a?(Boolean) != false || raise("Passed value for field obj.patient_authorized_release is not the expected type, validation failed.")
606
+ obj.benefits_assigned_to_provider.is_a?(Boolean) != false || raise("Passed value for field obj.benefits_assigned_to_provider is not the expected type, validation failed.")
607
+ obj.provider_accepts_assignment.is_a?(Boolean) != false || raise("Passed value for field obj.provider_accepts_assignment is not the expected type, validation failed.")
608
+ obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
609
+ obj.existing_medications&.is_a?(Array) != false || raise("Passed value for field obj.existing_medications is not the expected type, validation failed.")
610
+ obj.vitals.nil? || CandidApiClient::Encounters::V4::Types::Vitals.validate_raw(obj: obj.vitals)
611
+ obj.interventions&.is_a?(Array) != false || raise("Passed value for field obj.interventions is not the expected type, validation failed.")
612
+ obj.pay_to_address.nil? || CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.pay_to_address)
613
+ obj.synchronicity&.is_a?(CandidApiClient::Encounters::V4::Types::SynchronicityType) != false || raise("Passed value for field obj.synchronicity is not the expected type, validation failed.")
614
+ obj.billable_status.is_a?(CandidApiClient::Encounters::V4::Types::BillableStatusType) != false || raise("Passed value for field obj.billable_status is not the expected type, validation failed.")
615
+ obj.additional_information&.is_a?(String) != false || raise("Passed value for field obj.additional_information is not the expected type, validation failed.")
616
+ obj.service_authorization_exception_code&.is_a?(CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode) != false || raise("Passed value for field obj.service_authorization_exception_code is not the expected type, validation failed.")
617
+ obj.admission_date&.is_a?(Date) != false || raise("Passed value for field obj.admission_date is not the expected type, validation failed.")
618
+ obj.discharge_date&.is_a?(Date) != false || raise("Passed value for field obj.discharge_date is not the expected type, validation failed.")
619
+ obj.onset_of_current_illness_or_symptom_date&.is_a?(Date) != false || raise("Passed value for field obj.onset_of_current_illness_or_symptom_date is not the expected type, validation failed.")
620
+ obj.last_menstrual_period_date&.is_a?(Date) != false || raise("Passed value for field obj.last_menstrual_period_date is not the expected type, validation failed.")
621
+ obj.delay_reason_code&.is_a?(CandidApiClient::Commons::Types::DelayReasonCode) != false || raise("Passed value for field obj.delay_reason_code is not the expected type, validation failed.")
622
+ end
623
+ end
624
+ end
625
+ end
626
+ end
627
+ end