If an observation record has a consid, join to the consultation table and take the consdate as the visit_detail_start_date. If no consid, take the obsdate as the visit_detail_start_date.
If consdate is null take the obsdate instead.
visit_detail_start_datetime
visit_detail_end_date
Set as visit_detail_start_date
visit_detail_end_datetime
visit_detail_type_concept_id
Use 32827 - EHR encounter record
provider_id
staffid
If an observation record has a consid, lookup the staffid from the consultation record and then assign the associated provider_id