Here is the code for the provider(we have tried removing the distinct):
Select DISTINCT
prc.PAT_ID
, p.PERSON_ID
, pt.PERSON_TYPE_DESC
, rt.description
,cpt.description
, p.LAST_NAME
, p.FIRST_NAME
, p.SUFFIX
, p.PHONE_NUMBER
, p.FAX_NUMBER
from pat_ref_care prc
join PERSON p on prc.CARE_ID = p.PERSON_ID
left join PERSON_ASSIGNED_TYPES pat on p.PERSON_ID = pat.PERSON_ID
left join PERSON_TYPES pt on pat.PERSON_ID = pt.PERSON_TYPE_ID
left join REFERRING_TYPES rt on prc.REFERRING_TYPE = rt.referring_type
left join care_providers cp on prc.care_id = cp.care_id
left join CARE_PROVIDER_TYPES cpt on cp.CARE_PROVIDER_TYPE=cpt.care_provider_type
where prc.pat_id = {?PAT_ID}
Here is the code for the diagnosis:
Select pe.PAT_EVAL_ID
, pe.EVAL_DATE
, d.*
, d1.inactive_date
,d1.DIAG_COMMENT
from pat_evaluation pe
join EVAL_DIAGS ed on pe.PAT_ID = ed.PAT_ID and pe.PAT_EVAL_ID = ed.EVALUATION_ID
join diag_view d on ed.pat_id = d.pat_id and ed.diag_id = d.DIAG_ID
and ed.diag_date = d.diag_date and d.inactive = 0
join DIAGNOSIS d1 on d.pat_id = d1.pat_id and d.diag_id = d1.diag_id and d.diag_date = d1.diag_date
where ed.pat_id = {?PAT_ID}
and pe.PAT_EVAL_ID = {?PAT_EVAL_ID}
There is nothing out of the ordinary on these. One of my coworkers suggest we look at the version this was written in. Because we originally wrote it in Crystal XI and our client might have been editing it in a newer version. From what I have been told this can cause some weird things to happen with reports.
Edited by CrystalGump - 15 Apr 2014 at 4:57am