Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- drop program agc_floyd_common_fields go
- create program agc_floyd_common_fields
- prompt
- "Output to File/Printer/MINE" = "MINE" ;* Enter or select the printer or file name to send this report to.
- with OUTDEV
- declare all_canceled_cd = f8 with public, noconstant(0.0)
- set stat = uar_get_meaning_by_codeset(12025,"CANCELED",1,all_canceled_cd)
- ; visit list
- record vl (
- 1 list[*]
- 2 encntrid = n8
- 2 personid = n8
- 2 first_name = vc
- 2 last_name = vc
- 2 middle_name = vc
- 2 birth_date = vc
- 2 gender = vc
- 2 ethnicity = vc
- 2 language = vc
- 2 martial_status = vc
- 2 decease_date = vc
- 2 deceased_reason = vc
- 2 race = vc
- 2 religion = vc
- 2 vip = vc
- ;-person
- 2 patient_identifiers[*]
- 3 idtype = vc
- 3 source = vc
- 3 idvalue = vc
- 2 addresses[*]
- 3 type = vc
- 3 street1 = vc
- 3 street2 = vc
- 3 city = vc
- 3 state = vc
- 3 country = vc
- 3 postalcode = vc
- 2 phones[*]
- 3 type = vc
- 3 phonenbr = vc
- 2 allergies[*]
- 3 substance_nom_id = n8
- 3 substance = vc
- 3 onset_date = vc
- 3 allergy_id = n8
- 3 reaction = vc
- 3 reaction_nom_id = n8
- 3 substance_type = vc
- 3 severity = vc
- 3 cancel_date = vc
- 3 cancel_reason = vc
- 3 reaction_status = vc
- 3 source_identifier = vc
- 3 source_coding = vc
- 3 reviewed_date = vc
- 3 reviewed_by = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-allergy
- 2 payers[*]
- 3 effective_date = vc
- 3 payer = vc
- 3 financial_class = vc
- 3 group_name = vc
- 3 group_nbr = vc
- 3 plan_type = vc
- 3 policy_nbr = vc
- 3 service_coverage = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-payer
- 2 actors[*]
- 3 id = vc
- 3 role = vc
- 3 xml = vc
- 3 userid = n8
- 2 immunizations[*]
- 3 vaccine = vc
- 3 admin_date = vc
- 3 admin_dosage = vc
- 3 admin_dosage_unit = vc
- 3 note = vc
- 3 location = vc
- 3 route = vc
- 3 site = vc
- 3 strength = vc
- 3 strength_units = vc
- 3 type = vc
- 3 lot_number = vc
- 3 manufacturer = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-immunization
- 2 problems[*]
- 3 problem_nom_id = n8
- 3 problem = vc
- 3 problem_date = vc
- 3 annotation = vc
- 3 cancel_reason = vc
- 3 certainty = vc
- 3 classification = vc
- 3 pregnancy_indicator = vc
- 3 confirmation_status = vc
- 3 progress = vc
- 3 family_aware = vc
- 3 persistence = vc
- 3 prognosis = vc
- 3 ranking = vc
- 3 severity = vc
- 3 source_identifier = vc
- 3 source_coding = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-problem
- 2 diagnoses[*]
- 3 diagnosis_nom_id = n8
- 3 diagnosis = vc
- 3 diagnosis_date = vc
- 3 certainty = vc
- 3 classification = vc
- 3 clinical_priority = vc
- 3 service = vc
- 3 confirmation_status = vc
- 3 annotated_display = vc
- 3 category = vc
- 3 class = vc
- 3 priority = vc
- 3 type = vc
- 3 admission_diagnosis = vc
- 3 ranking = vc
- 3 severity = vc
- 3 source_identifier = vc
- 3 source_coding = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-diagnosis
- 2 procedures[*]
- 3 procedure_nom_id = n8
- 3 procedure = vc
- 3 procedure_date = vc
- 3 anesthesia = vc
- 3 service = vc
- 3 note = vc
- 3 location = vc
- 3 duration_minutes = vc
- 3 ranking = vc
- 3 source_identifier = vc
- 3 source_coding = vc
- 3 last_update_by = vc
- 3 last_updated = vc
- ;-procedure
- 2 medications[*]
- 3 medication = vc
- 3 instructions = vc
- 3 start_date = vc
- 3 order_item = vc
- 3 order_id = vc
- 3 clinical_display = vc
- 3 discontinue_indicator = vc
- 3 discontinue_type = vc
- 3 med_order_type = vc
- 3 ordered_as = vc
- 3 status = vc
- 3 order_date = vc
- 3 stop_date = vc
- 3 stop_type = vc
- ;-medication
- 3 volume_dose = vc
- 3 volume_dose_unit = vc
- 3 route = vc
- 3 frequency = vc
- 3 prn_yes_no = vc
- 3 dispense_quantity = vc
- 3 dispense_quantity_unit = vc
- 3 requested_start_date = vc
- ;-detailmedication
- )
- set stat = alterlist(vl->list, 1)
- set vl->list[1].encntrid = 5044789
- set x=0
- while (x < size(vl->list,5))
- call getActors(x, vl->list[x].encntrid)
- call getDemographics(x, vl->list[x].encntrid)
- call getAllergies(x, vl->list[x].encntrid)
- call getInsurance(x, vl->list[x].encntrid)
- call getImmunizations(x, vl->list[x].encntrid)
- call getProblems(x, vl->list[x].encntrid)
- call getDiagnoses(x, vl->list[x].encntrid)
- call getProcedures(x, vl->list[x].encntrid)
- call getMedications(x, vl->list[x].encntrid)
- set x = x +1
- endwhile;
- record tmp (
- 1 var = vc
- 1 actorid = vc
- )
- /** create actors **/
- /** get the actor id **/
- subroutine getActorId(index, actorRole)
- set tmp->actorid = "???"
- set x = 0
- while (x < size(vl->list[index].actors,5))
- if (vl->list[index].actors[x+1].role = actorRole)
- set tmp->actorid = vl->list[index].actors[x+1].id
- endif
- set x = x+1
- endwhile
- end;
- /** actors **/
- subroutine getActors(index, encntrid)
- ; patient actor
- set newsize = size(vl->list[index].actors,5)+1
- set stat = alterlist(vl->list[index].actors, newsize)
- set vl->list[index].actors[newsize].id = build("ACT",format(newsize,"0000;P0"))
- set vl->list[index].actors[newsize].role = "PATIENT"
- set vl->list[index].actors[newsize].xml = ""
- select into "nl:"
- from encntr_prsnl_reltn epr, prsnl p, code_value cv
- where epr.encntr_id = encntrid
- and epr.active_ind = 1
- and epr.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- and epr.beg_effective_dt_tm < cnvtdatetime(curdate, curtime3)
- and epr.prsnl_person_id = p.person_id
- and epr.encntr_prsnl_r_cd = cv.code_value
- and cv.display_key like "*PHYSICIAN*"
- head report
- cnt = size(vl->list[index].actors,5)
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].actors, cnt)
- vl->list[index].actors[cnt].id = build("ACT",format(cnt,"0000;P0"))
- vl->list[index].actors[cnt].role = build(uar_get_code_display(epr.encntr_prsnl_r_cd))
- vl->list[index].actors[cnt].xml = build("<CurrentName><Given>", p.name_first, "</Given><Family>", p.name_last,
- "</Family><Middle>",
- "</Middle></CurrentName><Role>", uar_get_code_display(epr.encntr_prsnl_r_cd), "</Role>")
- with check, nocounter
- end; getActors
- ; demographics
- subroutine getDemographics(index, encntrid)
- select into "nl:"
- from person p, encounter e
- where e.encntr_id = encntrid
- and e.person_id = p.person_id
- detail
- vl->list[index].first_name = build(p.name_first)
- vl->list[index].last_name = build(p.name_last)
- vl->list[index].middle_name = build(p.name_middle)
- vl->list[index].gender = build(uar_get_code_display(p.sex_cd))
- vl->list[index].birth_date = format(p.birth_dt_tm, "yyyy-MM-dd;;d")
- vl->list[index].ethnicity = build(uar_get_code_display(p.ethnic_grp_cd))
- vl->list[index].language = build(uar_get_code_display(p.language_cd))
- vl->list[index].martial_status = build(uar_get_code_display(p.marital_type_cd))
- vl->list[index].decease_date = format(p.deceased_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].deceased_reason = build(uar_get_code_display(p.deceased_cd))
- vl->list[index].race = build(uar_get_code_display(p.race_cd))
- vl->list[index].religion = build(uar_get_code_display(p.religion_cd))
- vl->list[index].vip = build(uar_get_code_display(p.vip_cd))
- ;!person
- with check, nocounter
- ; identifiers
- select into "nl:"
- from encounter e, person_alias pa
- where e.encntr_id = encntrid
- and e.person_id = pa.person_id
- and pa.active_ind = 1
- and pa.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = size(vl->list[index].patient_identifiers, 5)+1
- stat = alterlist(vl->list[index].patient_identifiers, cnt)
- vl->list[index].patient_identifiers[cnt].idvalue = pa.alias
- vl->list[index].patient_identifiers[cnt].idtype = build(uar_get_code_display(pa.person_alias_type_cd))
- vl->list[index].patient_identifiers[cnt].source = build(uar_get_code_display(pa.alias_pool_cd))
- with check, nocounter
- ; address
- select into "nl:"
- from encounter e, address a
- where e.encntr_id = encntrid
- and e.person_id = a.parent_entity_id
- and "PERSON" = a.parent_entity_name
- and a.active_ind = 1
- and a.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = size(vl->list[index].addresses, 5)+1
- stat = alterlist(vl->list[index].addresses, cnt)
- vl->list[index].addresses[cnt].street1 = a.street_addr
- vl->list[index].addresses[cnt].street2 = a.street_addr2
- if (a.city_cd > 0)
- vl->list[index].addresses[cnt].city = build(uar_get_code_display(a.city_cd))
- else
- vl->list[index].addresses[cnt].city = a.city
- endif
- if (a.country_cd > 0)
- vl->list[index].addresses[cnt].country = build(uar_get_code_display(a.country_cd))
- else
- vl->list[index].addresses[cnt].country = a.country
- endif
- vl->list[index].addresses[cnt].postalcode = a.zipcode
- vl->list[index].addresses[cnt].type = build(uar_get_code_display(a.address_type_cd))
- with check, nocounter
- ; telephone
- select into "nl:"
- from encounter e, phone p
- where e.encntr_id = encntrid
- and e.person_id = p.parent_entity_id
- and "PERSON" = p.parent_entity_name
- and p.active_ind = 1
- and p.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = size(vl->list[index].phones, 5)+1
- stat = alterlist(vl->list[index].phones, cnt)
- vl->list[index].phones[cnt].phonenbr = p.phone_num
- vl->list[index].phones[cnt].type = build(uar_get_code_display(p.phone_type_cd))
- with check, nocounter
- end; getDemographics
- ; Allergies
- subroutine getAllergies(index, encntrid)
- select into "nl:"
- a.onset_dt_tm,
- a.substance_ftdesc
- from
- encounter e,
- allergy a
- where e.encntr_id = encntrid
- and e.person_id = a.person_id
- and a.active_ind = 1
- and a.reaction_status_cd != all_canceled_cd
- and a.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].allergies, cnt)
- vl->list[index].allergies[cnt].onset_date = format(a.onset_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].allergies[cnt].substance = a.substance_ftdesc
- vl->list[index].allergies[cnt].substance_nom_id = a.substance_nom_id
- vl->list[index].allergies[cnt].allergy_id = a.allergy_id
- vl->list[index].allergies[cnt].substance_type = build(uar_get_code_display(a.substance_type_cd))
- vl->list[index].allergies[cnt].severity = build(uar_get_code_display(a.severity_cd))
- vl->list[index].allergies[cnt].cancel_date = format(a.cancel_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].allergies[cnt].cancel_reason = build(uar_get_code_display(a.cancel_reason_cd))
- vl->list[index].allergies[cnt].reaction_status = build(uar_get_code_display(a.reaction_status_cd))
- vl->list[index].allergies[cnt].source_identifier = build(a.rec_src_identifer)
- vl->list[index].allergies[cnt].source_coding = build(uar_get_code_display(a.rec_src_vocab_cd))
- vl->list[index].allergies[cnt].reviewed_date = format(a.reviewed_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].allergies[cnt].reviewed_by = build(a.reviewed_prsnl_id)
- vl->list[index].allergies[cnt].last_update_by = build(a.updt_id)
- vl->list[index].allergies[cnt].last_updated = format(a.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!allergy
- with check, nocounter
- ; coded substance
- select into "nl:"
- n.source_string
- from (dummyt d with seq = value(size(vl->list[index]->allergies,5))),
- nomenclature n
- plan d
- join n where vl->list[index]->allergies[d.seq].substance_nom_id = n.nomenclature_id
- detail
- if (vl->list[index].allergies[d.seq].substance_nom_id > 0)
- vl->list[index].allergies[d.seq].substance = n.source_string
- vl->list[index].allergies[d.seq].source_coding = uar_get_code_display(n.concept_source_cd)
- vl->list[index].allergies[d.seq].source_identifier = n.concept_identifier
- endif
- with check, noccounter
- ; reaction
- select into "nl:"
- from (dummyt d with seq = value(size(vl->list[index]->allergies,5))),
- reaction r
- plan d
- join r where vl->list[index]->allergies[d.seq].allergy_id = r.allergy_id
- detail
- vl->list[index].allergies[d.seq].reaction = r.reaction_ftdesc
- vl->list[index].allergies[d.seq].reaction_nom_id = r.reaction_nom_id
- with check, noccounter
- ; coded reaction
- select into "nl:"
- n.source_string
- from (dummyt d with seq = value(size(vl->list[index]->allergies,5))),
- nomenclature n
- plan d
- join n where vl->list[index]->allergies[d.seq].reaction_nom_id = n.nomenclature_id
- detail
- if (vl->list[index].allergies[d.seq].reaction_nom_id > 0)
- vl->list[index].allergies[d.seq].reaction = n.source_string
- endif
- with check, noccounter
- end; getAllergies
- ; Insurance
- subroutine getInsurance(index, encntrid)
- select into "nl:"
- from
- encntr_plan_reltn epr,
- health_plan hp,
- org_plan_reltn opr,
- organization o
- where epr.encntr_id = encntrid
- and epr.active_ind = 1
- and epr.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- and epr.beg_effective_dt_tm < cnvtdatetime(curdate, curtime3)
- and epr.health_plan_id = hp.health_plan_id
- and hp.active_ind = 1
- and hp.health_plan_id = opr.health_plan_id
- and opr.active_ind = 1
- and opr.beg_effective_dt_tm < cnvtdatetime(curdate, curtime3)
- and opr.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- and opr.organization_id = o.organization_id
- order by o.organization_id
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].payers, cnt)
- vl->list[index].payers[cnt].effective_date = format(epr.beg_effective_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].payers[cnt].payer = build(o.org_name)
- vl->list[index].payers[cnt].financial_class = build(uar_get_code_display(hp.financial_class_cd))
- vl->list[index].payers[cnt].group_name = build(hp.group_name)
- vl->list[index].payers[cnt].group_nbr = build(hp.group_nbr)
- vl->list[index].payers[cnt].plan_type = build(uar_get_code_display(hp.plan_type_cd))
- vl->list[index].payers[cnt].policy_nbr = build(hp.policy_nbr)
- vl->list[index].payers[cnt].service_coverage = build(uar_get_code_display(hp.service_type_cd))
- vl->list[index].payers[cnt].last_update_by = build(hp.updt_id)
- vl->list[index].payers[cnt].last_updated = format(hp.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!payer
- with check, nocounter
- end; getInsurance
- ; Immunizations
- subroutine getImmunizations(index, encntrid)
- select into "nl:"
- from
- code_value cv,
- clinical_event ce,
- ce_med_result cmr
- where cv.code_set = 72
- and cv.display_key like "*VACCINE*"
- and cv.code_value = ce.event_cd
- and ce.person_id = (select e.person_id from encounter e where e.encntr_id = encntrid)
- and ce.valid_from_dt_tm < cnvtdatetime(curdate, curtime3)
- and ce.valid_until_dt_tm > cnvtdatetime(curdate, curtime3)
- and ce.event_id = cmr.event_id
- and cmr.valid_from_dt_tm < cnvtdatetime(curdate, curtime3)
- and cmr.valid_until_dt_tm > cnvtdatetime(curdate, curtime3)
- order by cnvtdatetime(cmr.admin_start_dt_tm)
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].immunizations, cnt)
- vl->list[index].immunizations[cnt].vaccine = build(uar_get_code_display(ce.event_cd))
- vl->list[index].immunizations[cnt].admin_date = format(cmr.admin_start_dt_tm, "yyyy-mm-dd HH:mm;;d")
- vl->list[index].immunizations[cnt].admin_dosage = build(cmr.admin_dosage)
- vl->list[index].immunizations[cnt].admin_dosage_unit = build(uar_get_code_display(cmr.dosage_unit_cd))
- vl->list[index].immunizations[cnt].note = build(cmr.admin_note)
- vl->list[index].immunizations[cnt].location = build(uar_get_code_display(cmr.admin_pt_loc_cd))
- vl->list[index].immunizations[cnt].route = build(uar_get_code_display(cmr.admin_route_cd))
- vl->list[index].immunizations[cnt].site = build(uar_get_code_display(cmr.admin_site_cd))
- vl->list[index].immunizations[cnt].strength = build(cmr.admin_strength)
- vl->list[index].immunizations[cnt].strength_units = build(uar_get_code_display(cmr.admin_strength_unit_cd))
- vl->list[index].immunizations[cnt].type = build(uar_get_code_display(cmr.immunization_type_cd))
- vl->list[index].immunizations[cnt].lot_number = build(cmr.substance_lot_number)
- vl->list[index].immunizations[cnt].manufacturer = build(uar_get_code_display(cmr.substance_manufacturer_cd))
- vl->list[index].immunizations[cnt].last_update_by = build(cmr.updt_id)
- vl->list[index].immunizations[cnt].last_updated = format(cmr.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!immunization
- with check, nocounter
- end; getImmunizations
- ; Problems
- subroutine getProblems(index, encntrid)
- select into "nl:"
- p.nomenclature_id,
- p.problem_ftdesc
- from
- encounter e,
- problem p
- where e.encntr_id = encntrid
- and e.person_id = p.person_id
- and p.active_ind = 1
- and p.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].problems, cnt)
- vl->list[index].problems[cnt].problem_date = format(p.onset_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].problems[cnt].problem = p.problem_ftdesc
- vl->list[index].problems[cnt].problem_nom_id = p.nomenclature_id
- vl->list[index].problems[cnt].annotation = build(p.annotated_display)
- vl->list[index].problems[cnt].cancel_reason = build(uar_get_code_display(p.cancel_reason_cd))
- vl->list[index].problems[cnt].certainty = build(uar_get_code_display(p.certainty_cd))
- vl->list[index].problems[cnt].classification = build(uar_get_code_display(p.classification_cd))
- vl->list[index].problems[cnt].pregnancy_indicator = build(p.cond_type_flag)
- vl->list[index].problems[cnt].confirmation_status = build(uar_get_code_display(p.confirmation_status_cd))
- vl->list[index].problems[cnt].progress = build(uar_get_code_display(p.course_cd))
- vl->list[index].problems[cnt].family_aware = build(uar_get_code_display(p.family_aware_cd))
- vl->list[index].problems[cnt].persistence = build(uar_get_code_display(p.persistence_cd))
- vl->list[index].problems[cnt].prognosis = build(uar_get_code_display(p.prognosis_cd))
- vl->list[index].problems[cnt].ranking = build(uar_get_code_display(p.ranking_cd))
- vl->list[index].problems[cnt].severity = build(uar_get_code_display(p.severity_cd))
- vl->list[index].problems[cnt].last_update_by = build(p.updt_id)
- vl->list[index].problems[cnt].last_updated = format(p.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!problem
- with check, nocounter
- ; coded problem
- select into "nl:"
- n.source_string
- from (dummyt d with seq = value(size(vl->list[index]->problems,5))),
- nomenclature n
- plan d
- join n where vl->list[index]->problems[d.seq].problem_nom_id = n.nomenclature_id
- detail
- if (vl->list[index].problems[d.seq].problem_nom_id > 0)
- vl->list[index].problems[d.seq].problem = n.source_string
- vl->list[index].problems[d.seq].source_coding = uar_get_code_display(n.concept_source_cd)
- vl->list[index].problems[d.seq].source_identifier = n.concept_identifier
- endif
- with check, noccounter
- end; getProblems
- ; Diagnoses
- subroutine getDiagnoses(index, encntrid)
- select into "nl:"
- d.nomenclature_id,
- d.diag_ftdesc
- from
- encounter e,
- diagnosis d
- where e.encntr_id = encntrid
- and e.person_id = d.person_id
- and d.active_ind = 1
- and d.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].diagnoses, cnt)
- vl->list[index].diagnoses[cnt].diagnosis_date = format(d.diag_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].diagnoses[cnt].diagnosis = d.diag_ftdesc
- vl->list[index].diagnoses[cnt].diagnosis_nom_id = d.nomenclature_id
- vl->list[index].diagnoses[cnt].certainty = build(uar_get_code_display(d.certainty_cd))
- vl->list[index].diagnoses[cnt].classification = build(uar_get_code_display(d.classification_cd))
- vl->list[index].diagnoses[cnt].clinical_priority = build(d.clinical_diag_priority)
- vl->list[index].diagnoses[cnt].service = build(uar_get_code_display(d.clinical_service_cd))
- vl->list[index].diagnoses[cnt].confirmation_status = build(uar_get_code_display(d.confirmation_status_cd))
- vl->list[index].diagnoses[cnt].annotated_display = build(d.diagnosis_display)
- vl->list[index].diagnoses[cnt].category = build(uar_get_code_display(d.diagnostic_category_cd))
- vl->list[index].diagnoses[cnt].class = build(uar_get_code_display(d.diag_class_cd))
- vl->list[index].diagnoses[cnt].priority = build(d.diag_priority)
- vl->list[index].diagnoses[cnt].type = build(uar_get_code_display(d.diag_type_cd))
- vl->list[index].diagnoses[cnt].admission_diagnosis = build(uar_get_code_display(d.present_on_admit_cd))
- vl->list[index].diagnoses[cnt].ranking = build(uar_get_code_display(d.ranking_cd))
- vl->list[index].diagnoses[cnt].severity = build(uar_get_code_display(d.severity_cd))
- vl->list[index].diagnoses[cnt].last_update_by = build(d.updt_id)
- vl->list[index].diagnoses[cnt].last_updated = format(d.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!diagnosis
- with check, nocounter
- ; coded diagnosis
- select into "nl:"
- n.source_string
- from (dummyt d with seq = value(size(vl->list[index]->diagnoses,5))),
- nomenclature n
- plan d
- join n where vl->list[index]->diagnoses[d.seq].diagnosis_nom_id = n.nomenclature_id
- detail
- if (vl->list[index].diagnoses[d.seq].diagnosis_nom_id > 0)
- vl->list[index].diagnoses[d.seq].diagnosis = n.source_string
- vl->list[index].diagnoses[d.seq].source_coding = uar_get_code_display(n.concept_source_cd)
- vl->list[index].diagnoses[d.seq].source_identifier = n.concept_identifier
- endif
- with check, noccounter
- end; getDiagnoses
- ; Procedures
- subroutine getProcedures(index, encntrid)
- select into "nl:"
- p.nomenclature_id,
- p.proc_ftdesc
- from
- procedure p
- where p.encntr_id = encntrid
- and p.active_ind = 1
- and p.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
- head report
- cnt = 0
- detail
- cnt = cnt+1
- stat = alterlist(vl->list[index].procedures, cnt)
- vl->list[index].procedures[cnt].procedure_date = format(p.proc_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].procedures[cnt].procedure = p.proc_ftdesc
- vl->list[index].procedures[cnt].procedure_nom_id = p.nomenclature_id
- vl->list[index].procedures[cnt].anesthesia = build(uar_get_code_display(p.anesthesia_cd))
- vl->list[index].procedures[cnt].service = build(uar_get_code_display(p.clinical_service_cd))
- vl->list[index].procedures[cnt].note = build(p.procedure_note)
- vl->list[index].procedures[cnt].location = build(uar_get_code_display(p.proc_loc_cd))
- vl->list[index].procedures[cnt].duration_minutes = build(p.proc_minutes)
- vl->list[index].procedures[cnt].ranking = build(uar_get_code_display(p.ranking_cd))
- vl->list[index].procedures[cnt].last_update_by = build(p.updt_id)
- vl->list[index].procedures[cnt].last_updated = format(p.updt_dt_tm, "yyyy-MM-dd HH:mm;;d")
- ;!procedure
- with check, nocounter
- ; coded procedure
- select into "nl:"
- n.source_string
- from (dummyt d with seq = value(size(vl->list[index]->procedures,5))),
- nomenclature n
- plan d
- join n where vl->list[index]->procedures[d.seq].procedure_nom_id = n.nomenclature_id
- detail
- if (vl->list[index].procedures[d.seq].procedure_nom_id > 0)
- vl->list[index].procedures[d.seq].procedure = n.source_string
- vl->list[index].procedures[d.seq].source_coding = uar_get_code_display(n.concept_source_cd)
- vl->list[index].procedures[d.seq].source_identifier = n.concept_identifier
- endif
- with check, noccounter
- end; getProcedures
- ; Home meds
- subroutine getMedications(index, encntrid)
- select into "nl:"
- from
- encounter e,
- orders o,
- order_details od
- where e.encntr_id = encntrid
- and e.person_id = o.person_id
- and o.active_ind = 1
- and o.orig_ord_as_flag in (1,2)
- order by o.current_start_dt_tm, o.order_id
- head report
- cnt = 0
- head o.order_id
- cnt = cnt+1
- stat = alterlist(vl->list[index].medications, cnt)
- vl->list[index].medications[cnt].start_date = format(o.current_start_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].medications[cnt].medication = build(uar_get_code_display(o.catalog_cd))
- vl->list[index].medications[cnt].instructions = o.simplified_display_line
- vl->list[index].medications[cnt].order_item = build(uar_get_code_display(o.catalog_cd))
- vl->list[index].medications[cnt].order_id = build(o.order_id)
- vl->list[index].medications[cnt].clinical_display = build(o.clinical_display_line)
- vl->list[index].medications[cnt].discontinue_indicator = build(o.discontinue_ind)
- vl->list[index].medications[cnt].discontinue_type = build(uar_get_code_display(o.discontinue_type_cd))
- vl->list[index].medications[cnt].med_order_type = build(uar_get_code_display(o.med_order_type_cd))
- vl->list[index].medications[cnt].ordered_as = build(o.ordered_as_mnemonic)
- vl->list[index].medications[cnt].status = build(uar_get_code_display(o.order_status_cd))
- vl->list[index].medications[cnt].order_date = format(o.orig_order_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].medications[cnt].stop_date = format(o.projected_stop_dt_tm, "yyyy-MM-dd HH:mm;;d")
- vl->list[index].medications[cnt].stop_type = build(uar_get_code_display(o.stop_type_cd))
- ;!medication
- detail
- if (o.oe_field_meaning = "VOLUMEDOSE")
- vl->list[index].medications[cnt].volume_dose = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "VOLUMEDOSEUNIT")
- vl->list[index].medications[cnt].volume_dose_unit = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "RXROUTE")
- vl->list[index].medications[cnt].route = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "FREQ")
- vl->list[index].medications[cnt].frequency = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "SCH/PRN")
- vl->list[index].medications[cnt].prn_yes_no = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "DISPENSEQTY")
- vl->list[index].medications[cnt].dispense_quantity = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "DISPENSEQTYUNIT")
- vl->list[index].medications[cnt].dispense_quantity_unit = build(oe.field_display_value)
- endif
- if (o.oe_field_meaning = "REQSTARTDTTM")
- vl->list[index].medications[cnt].requested_start_date = build(oe.field_display_value)
- endif
- ;!detailmedication
- with check, nocounter
- end; getMedications
- select into $OUTDEV
- head report
- x=0
- id=0
- detail
- while (id < size(vl->list,5))
- col 0 ^<?xml version="1.0"?><?xml-stylesheet type="text/xsl"?>^
- row+1
- col 0 ^<ContinuityOfCareRecord>^
- row+1
- tmp->var = build(^<CCRDocumentObjectID>^, ^00000000000000^, ^</CCRDocumentObjectID>^)
- col 0 tmp->var
- row+1
- col 0 "<Version>V1.0</Version>"
- row+1
- tmp->var = concat("<DateTime><ExactDateTime>", format(cnvtdatetime(curdate, curtime3), "yyyy-MM-dd;;d"), "T"
- , format(cnvtdatetime(curdate, curtime3), "HH:mm:ss;;d") , "</ExactDateTime></DateTime>")
- col 0 tmp->var
- row+1
- call getActorId(id, "PATIENT")
- tmp->var = build("<Patient><ActorID>", tmp->actorid,"</ActorID></Patient>")
- col 0 tmp->var
- row+1
- tmp->var = build("<Event>Discharge</Event>")
- col 0 tmp->var
- row+1
- ; allergies
- col 0 "<Allergies>"
- row +1
- x = 1
- while (x <= size(vl->list[id].allergies, 5))
- tmp->var = build("<Allergy><CCRDataObjectID>ALL", format(x, "0000;p0"),
- "</CCRDataObjectID><Onset>", vl->list[id].allergies[x].onset_date, "</Onset><Substance>",
- vl->list[id].allergies[x].substance,
- "</Substance><Reaction>", vl->list[id].allergies[x].reaction ,"</Reaction>")
- col 0 tmp->var
- row+1
- tmp->var = build("<SubstanceType>",vl->list[id].allergies[x].substance_type,"</SubstanceType>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Severity>",vl->list[id].allergies[x].severity,"</Severity>")
- col 01 tmp->var
- row+1
- tmp->var = build("<CancelDate>",vl->list[id].allergies[x].cancel_date,"</CancelDate>")
- col 01 tmp->var
- row+1
- tmp->var = build("<CancelReason>",vl->list[id].allergies[x].cancel_reason,"</CancelReason>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ReactionStatus>",vl->list[id].allergies[x].reaction_status,"</ReactionStatus>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceIdentifier>",vl->list[id].allergies[x].source_identifier,"</SourceIdentifier>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceCoding>",vl->list[id].allergies[x].source_coding,"</SourceCoding>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ReviewedDate>",vl->list[id].allergies[x].reviewed_date,"</ReviewedDate>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ReviewedBy>",vl->list[id].allergies[x].reviewed_by,"</ReviewedBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].allergies[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].allergies[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;allergy
- tmp->var = "</Allergy>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Allergies>"
- row+1
- ; immunizations
- col 0 "<Immunizations>"
- row +1
- x = 1
- while (x <= size(vl->list[id].immunizations, 5))
- tmp->var = build("<Immunization><CCRDataObjectID>IMM", format(x, "0000;p0"),
- "</CCRDataObjectID><Administered>", vl->list[id].immunizations[x].admin_date, "</Administered><Vaccine>",
- vl->list[id].immunizations[x].vaccine,
- "</Vaccine>")
- col 0 tmp->var
- row+1
- tmp->var = build("<AdminDosage>",vl->list[id].immunizations[x].admin_dosage,"</AdminDosage>")
- col 01 tmp->var
- row+1
- tmp->var = build("<AdminDosageUnit>",vl->list[id].immunizations[x].admin_dosage_unit,"</AdminDosageUnit>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Note>",vl->list[id].immunizations[x].note,"</Note>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Location>",vl->list[id].immunizations[x].location,"</Location>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Route>",vl->list[id].immunizations[x].route,"</Route>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Site>",vl->list[id].immunizations[x].site,"</Site>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Strength>",vl->list[id].immunizations[x].strength,"</Strength>")
- col 01 tmp->var
- row+1
- tmp->var = build("<StrengthUnits>",vl->list[id].immunizations[x].strength_units,"</StrengthUnits>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Type>",vl->list[id].immunizations[x].type,"</Type>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LotNumber>",vl->list[id].immunizations[x].lot_number,"</LotNumber>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Manufacturer>",vl->list[id].immunizations[x].manufacturer,"</Manufacturer>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].immunizations[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].immunizations[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;immunization
- tmp->var = "</Immunization>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Immunizations>"
- row+1
- ; problems
- col 0 "<Problems>"
- row +1
- x = 1
- while (x <= size(vl->list[id].problems, 5))
- tmp->var = build("<Problem><CCRDataObjectID>PROB", format(x, "0000;p0"),
- "</CCRDataObjectID><Onset>", vl->list[id].problems[x].problem_date, "</Onset><Name>",
- vl->list[id].problems[x].problem,
- "</Name>")
- col 0 tmp->var
- row+1
- tmp->var = build("<Annotation>",vl->list[id].problems[x].annotation,"</Annotation>")
- col 01 tmp->var
- row+1
- tmp->var = build("<CancelReason>",vl->list[id].problems[x].cancel_reason,"</CancelReason>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Certainty>",vl->list[id].problems[x].certainty,"</Certainty>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Classification>",vl->list[id].problems[x].classification,"</Classification>")
- col 01 tmp->var
- row+1
- tmp->var = build("<PregnancyIndicator>",vl->list[id].problems[x].pregnancy_indicator,"</PregnancyIndicator>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ConfirmationStatus>",vl->list[id].problems[x].confirmation_status,"</ConfirmationStatus>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Progress>",vl->list[id].problems[x].progress,"</Progress>")
- col 01 tmp->var
- row+1
- tmp->var = build("<FamilyAware>",vl->list[id].problems[x].family_aware,"</FamilyAware>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Persistence>",vl->list[id].problems[x].persistence,"</Persistence>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Prognosis>",vl->list[id].problems[x].prognosis,"</Prognosis>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Ranking>",vl->list[id].problems[x].ranking,"</Ranking>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Severity>",vl->list[id].problems[x].severity,"</Severity>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceIdentifier>",vl->list[id].problems[x].source_identifier,"</SourceIdentifier>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceCoding>",vl->list[id].problems[x].source_coding,"</SourceCoding>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].problems[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].problems[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;problem
- tmp->var = "</Problem>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Problems>"
- row+1
- ; diagnoses
- col 0 "<Diagnoses>"
- row +1
- x = 1
- while (x <= size(vl->list[id].diagnoses, 5))
- tmp->var = build("<Diagnosis><CCRDataObjectID>DIAG", format(x, "0000;p0"),
- "</CCRDataObjectID><Onset>", vl->list[id].diagnoses[x].diagnosis_date, "</Onset><Name>",
- vl->list[id].diagnoses[x].diagnosis,
- "</Name>")
- col 0 tmp->var
- row+1
- tmp->var = build("<Certainty>",vl->list[id].diagnoses[x].certainty,"</Certainty>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Classification>",vl->list[id].diagnoses[x].classification,"</Classification>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ClinicalPriority>",vl->list[id].diagnoses[x].clinical_priority,"</ClinicalPriority>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Service>",vl->list[id].diagnoses[x].service,"</Service>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ConfirmationStatus>",vl->list[id].diagnoses[x].confirmation_status,"</ConfirmationStatus>")
- col 01 tmp->var
- row+1
- tmp->var = build("<AnnotatedDisplay>",vl->list[id].diagnoses[x].annotated_display,"</AnnotatedDisplay>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Category>",vl->list[id].diagnoses[x].category,"</Category>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Class>",vl->list[id].diagnoses[x].class,"</Class>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Priority>",vl->list[id].diagnoses[x].priority,"</Priority>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Type>",vl->list[id].diagnoses[x].type,"</Type>")
- col 01 tmp->var
- row+1
- tmp->var = build("<AdmissionDiagnosis>",vl->list[id].diagnoses[x].admission_diagnosis,"</AdmissionDiagnosis>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Ranking>",vl->list[id].diagnoses[x].ranking,"</Ranking>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Severity>",vl->list[id].diagnoses[x].severity,"</Severity>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceIdentifier>",vl->list[id].diagnoses[x].source_identifier,"</SourceIdentifier>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceCoding>",vl->list[id].diagnoses[x].source_coding,"</SourceCoding>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].diagnoses[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].diagnoses[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;diagnosis
- tmp->var = "</Diagnosis>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Diagnoses>"
- row+1
- ; procedures
- col 0 "<Procedures>"
- row +1
- x = 1
- while (x <= size(vl->list[id].procedures, 5))
- tmp->var = build("<Procedure><CCRDataObjectID>PROC", format(x, "0000;p0"),
- "</CCRDataObjectID><Date>", vl->list[id].procedures[x].procedure_date, "</Date><Name>",
- vl->list[id].procedures[x].procedure,
- "</Name>")
- col 0 tmp->var
- row+1
- tmp->var = build("<Anesthesia>",vl->list[id].procedures[x].anesthesia,"</Anesthesia>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Service>",vl->list[id].procedures[x].service,"</Service>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Note>",vl->list[id].procedures[x].note,"</Note>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Location>",vl->list[id].procedures[x].location,"</Location>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DurationMinutes>",vl->list[id].procedures[x].duration_minutes,"</DurationMinutes>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Ranking>",vl->list[id].procedures[x].ranking,"</Ranking>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceIdentifier>",vl->list[id].procedures[x].source_identifier,"</SourceIdentifier>")
- col 01 tmp->var
- row+1
- tmp->var = build("<SourceCoding>",vl->list[id].procedures[x].source_coding,"</SourceCoding>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].procedures[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].procedures[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;procedure
- tmp->var = "</Procedure>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Procedures>"
- row+1
- ; medications
- col 0 "<Medications>"
- row +1
- x = 1
- while (x <= size(vl->list[id].medications, 5))
- tmp->var = build("<Medication><CCRDataObjectID>MED", format(x, "0000;p0"),
- "</CCRDataObjectID><Start>", vl->list[id].medications[x].start_date, "</Start><Name>",
- vl->list[id].medications[x].medication,
- "</Name><Instructions>", vl->list[id].medications[x].instructions, "</Instructions>")
- col 0 tmp->var
- row+1
- tmp->var = build("<OrderItem>",vl->list[id].medications[x].order_item,"</OrderItem>")
- col 01 tmp->var
- row+1
- tmp->var = build("<OrderId>",vl->list[id].medications[x].order_id,"</OrderId>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ClinicalDisplay>",vl->list[id].medications[x].clinical_display,"</ClinicalDisplay>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DiscontinueIndicator>",vl->list[id].medications[x].discontinue_indicator,"</DiscontinueIndicator>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DiscontinueType>",vl->list[id].medications[x].discontinue_type,"</DiscontinueType>")
- col 01 tmp->var
- row+1
- tmp->var = build("<MedOrderType>",vl->list[id].medications[x].med_order_type,"</MedOrderType>")
- col 01 tmp->var
- row+1
- tmp->var = build("<OrderedAs>",vl->list[id].medications[x].ordered_as,"</OrderedAs>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Status>",vl->list[id].medications[x].status,"</Status>")
- col 01 tmp->var
- row+1
- tmp->var = build("<OrderDate>",vl->list[id].medications[x].order_date,"</OrderDate>")
- col 01 tmp->var
- row+1
- tmp->var = build("<StopDate>",vl->list[id].medications[x].stop_date,"</StopDate>")
- col 01 tmp->var
- row+1
- tmp->var = build("<StopType>",vl->list[id].medications[x].stop_type,"</StopType>")
- col 01 tmp->var
- row+1
- ;medication
- tmp->var = build("<VolumeDose>",vl->list[id].medications[x].volume_dose,"</VolumeDose>")
- col 01 tmp->var
- row+1
- tmp->var = build("<VolumeDoseUnit>",vl->list[id].medications[x].volume_dose_unit,"</VolumeDoseUnit>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Route>",vl->list[id].medications[x].route,"</Route>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Frequency>",vl->list[id].medications[x].frequency,"</Frequency>")
- col 01 tmp->var
- row+1
- tmp->var = build("<PrnYesNo>",vl->list[id].medications[x].prn_yes_no,"</PrnYesNo>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DispenseQuantity>",vl->list[id].medications[x].dispense_quantity,"</DispenseQuantity>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DispenseQuantityUnit>",vl->list[id].medications[x].dispense_quantity_unit,"</DispenseQuantityUnit>")
- col 01 tmp->var
- row+1
- tmp->var = build("<RequestedStartDate>",vl->list[id].medications[x].requested_start_date,"</RequestedStartDate>")
- col 01 tmp->var
- row+1
- ;detailmedication
- tmp->var = "</Medication>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Medications>"
- row+1
- ; payers
- col 0 "<Payers>"
- row +1
- x = 1
- while (x <= size(vl->list[id].payers, 5))
- tmp->var = build("<Payer><CCRDataObjectID>PAY", format(x, "0000;p0"),
- "</CCRDataObjectID><Effective>",
- vl->list[id].payers[x].effective_date, "</Effective><Name>",
- vl->list[id].payers[x].payer, "</Name>")
- col 0 tmp->var
- row+1
- tmp->var = build("<FinancialClass>",vl->list[id].payers[x].financial_class,"</FinancialClass>")
- col 01 tmp->var
- row+1
- tmp->var = build("<GroupName>",vl->list[id].payers[x].group_name,"</GroupName>")
- col 01 tmp->var
- row+1
- tmp->var = build("<GroupNbr>",vl->list[id].payers[x].group_nbr,"</GroupNbr>")
- col 01 tmp->var
- row+1
- tmp->var = build("<PlanType>",vl->list[id].payers[x].plan_type,"</PlanType>")
- col 01 tmp->var
- row+1
- tmp->var = build("<PolicyNbr>",vl->list[id].payers[x].policy_nbr,"</PolicyNbr>")
- col 01 tmp->var
- row+1
- tmp->var = build("<ServiceCoverage>",vl->list[id].payers[x].service_coverage,"</ServiceCoverage>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdateBy>",vl->list[id].payers[x].last_update_by,"</LastUpdateBy>")
- col 01 tmp->var
- row+1
- tmp->var = build("<LastUpdated>",vl->list[id].payers[x].last_updated,"</LastUpdated>")
- col 01 tmp->var
- row+1
- ;payer
- tmp->var = "</Payer>"
- col 01 tmp->var
- row+1
- x = x+1
- endwhile
- col 0 "</Payers>"
- row+1
- ; actors
- col 0 "<Actors>"
- row +1
- x = 1
- while (x <= size(vl->list[id].actors,5))
- if (vl->list[id].actors[x].role = "PATIENT")
- tmp->var = build("<Patient><ActorObjectID>", vl->list[id].actors[x].id, "</ActorObjectID>")
- col 0 tmp->var
- row+1
- else
- tmp->var = build("<Actor><ActorObjectID>", vl->list[id].actors[x].id, "</ActorObjectID>")
- col 0 tmp->var
- row+1
- endif
- if (vl->list[id].actors[x].role = "PATIENT")
- tmp->var = build("<Person><CurrentName><Given>", vl->list[id].first_name, "</Given><Family>", vl->list[id].last_name,
- "</Family><Middle>",vl->list[id].middle_name,"</Middle></CurrentName><DateOfBirth><ExactDateTime>",
- vl->list[id].birth_date,
- "</ExactDateTime></DateOfBirth><Gender>", vl->list[id].gender, "</Gender>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Ethnicity>",vl->list[id].ethnicity,"</Ethnicity>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Language>",vl->list[id].language,"</Language>")
- col 01 tmp->var
- row+1
- tmp->var = build("<MartialStatus>",vl->list[id].martial_status,"</MartialStatus>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DeceaseDate>",vl->list[id].decease_date,"</DeceaseDate>")
- col 01 tmp->var
- row+1
- tmp->var = build("<DeceasedReason>",vl->list[id].deceased_reason,"</DeceasedReason>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Race>",vl->list[id].race,"</Race>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Religion>",vl->list[id].religion,"</Religion>")
- col 01 tmp->var
- row+1
- tmp->var = build("<Vip>",vl->list[id].vip,"</Vip>")
- col 01 tmp->var
- row+1
- ;person
- tmp->var = "</Person>"
- col 01 tmp->var
- row+1
- x1 = 1
- while (x1 <= size(vl->list[id].patient_identifiers, 5))
- tmp->var = build("<IDs><Type>", vl->list[id].patient_identifiers[x1].idtype, "</Type><ID>",
- vl->list[id].patient_identifiers[x1].idvalue, "</ID><Source>", vl->list[id].patient_identifiers[x1].source,
- "</Source></IDs>")
- col 01 tmp->var
- row+1
- x1 = x1 + 1
- endwhile; patient identifiers
- x1 = 1
- while (x1 <= size(vl->list[id].addresses, 5))
- tmp->var = build("<Address><Type>", vl->list[id].addresses[x1].type, "</Type><Line1>",
- vl->list[id].addresses[x1].street1, "</Line1><Line2>", vl->list[id].addresses[x1].street2,
- "</Line2><City>", vl->list[id].addresses[x1].city,
- "</City><State>", vl->list[id].addresses[x1].state,
- "</State><Country>", vl->list[id].addresses[x1].country,
- "</Country><PostalCode>", vl->list[id].addresses[x1].postalcode,
- "</PostalCode></Address>")
- col 01 tmp->var
- row+1
- x1 = x1 + 1
- endwhile; addresses
- x1 = 1
- while (x1 <= size(vl->list[id].phones, 5))
- tmp->var = build("<Telephone><Type>", vl->list[id].phones[x1].type, "</Type><Number>",
- vl->list[id].phones[x1].phonenbr, "</Number></Telephone>")
- col 01 tmp->var
- row+1
- x1 = x1 + 1
- endwhile; phones
- elseif (vl->list[id].actors[x].role = "ATTENDING")
- ;tmp->var = build("<Person><Name><CurrentName><Given>")
- ;col 01 tmp->var
- row+1
- elseif (vl->list[id].actors[x].role = "PCP")
- ;tmp->var = build("<Person><Name><CurrentName><Given>")
- ;col 01 tmp->var
- row+1
- else
- col 01 vl->list[id].actors[x].xml
- row+1
- endif
- if (vl->list[id].actors[x].role = "PATIENT")
- col 0 "</Patient>"
- row+1
- else
- col 0 "</Actor>"
- row+1
- endif
- x = x+1
- endwhile
- col 0 "</Actors>"
- row+1
- col 0 "</ContinuityOfCareRecord>"
- row+1
- id = id +1
- endwhile; loop visits
- with check, format, maxcol=400, maxrow=0
- ; convert xml markup
- subroutine getXmlDisplay(s)
- set getXmlDisplay = build(s)
- end; getXmlDisplay
- end
- go
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement