简体   繁体   中英

Returning end times between 2 start times of the same patient?

Currently writing a clinical report in Cerner's CCL (derived from SQL). The start of a patient's central line insertion is posted on 1 form, and the end on another form. Patients may end up having more than 1 start time documented on the same encounter (separate insertion forms). I am trying to line up a patients start and end times in order.

Example, this patient has 4 start times with end times that fall between 2 of the start times; a total of 8 documents. It is not a good workflow but it is what I am stuck with.

If I try:

join ce4
    where ce4.parent_event_id = ce3.event_id
    and ce4.event_cd =      703852.00   ;Central IV Activity Type
    and ce4.result_val in ("Discontinue", "Deaccessed Port")
    and ce4.performed_dt_tm > cnvtdatetime(data->centr[d.seq].dev_start)

It will only show the last time on the return for all 4 start times. My question is how do I get them to return in order between start times.

If the data is captured on two separate forms, as you say, then I wouldn't imagine there's any linkage between the forms (unless they're associated with tasks that have a relationship between them) and so you're left with making assumptions regarding which "end" form should be considered for each "start" form. It's guesswork at best. For example, should you go on the date/time the form is charted or when the user says it's charted.

When there's not actual, definitive, linkage, the best you can do is present this to the requestor and ask that they define the logic to use.

Once they have, you could probably do it a few different ways but one would be to store all of the "start" forms in a list. In a second query, fetch all end forms and iterate over the list of start forms and, perhaps, write out what you considers to be a much into another list that you then output.

Sorry, this is a bit of a non-answer but when there's no linkage there's not much you can do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM