question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Cliff King answered

Determine if a patient is accompanied by one or more caregivers

How do I write a command to determine if a patient is accompanied by one or more caregivers?

Thanks,

Tee

FlexSim HC 5.3.4
commandspatient caregivers
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
0 Likes 0 ·
Cliff King avatar image
0 Likes"
Cliff King answered

Tell me what your "real life" definition of "accompanied" is, because I'm still struggling to determine if your definition of "accompanied" fits with any standard definitions within the software. In the software, a staff member can be "allocated" to one specific activity on one specific patient at a time, and a staff member can be "kept" by one specific patient over a period of time that may span two or more activities on the same or diferent patients. These states of "allocated" or "kept' can be queried with commands. If your definition of "accompanied" doesn't fit within these two software specific situations, then you will need to continue to use a user-defined label as you've been doing.

I'm curious why you want to know whether a staff member is "accompanied" or not. Is it to make a processing decision,a bed placement decision, or are you maybe interested in capturing some kind of custom statistic?

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Tee Hiett avatar image Tee Hiett commented ·

Kept is what I'm looking for. How can I query that?

Thanks Tee

0 Likes 0 ·
Cliff King avatar image Cliff King Tee Hiett commented ·

getkeepingpatient(thestaffmember)

0 Likes 0 ·
Cliff King avatar image
0 Likes"
Cliff King answered Cliff King converted comment to answer
if(objectexists(getcompanion(patient,1))
{
	// do this if patient has at least one companion
}
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Cliff King avatar image Cliff King commented ·

I wasn't sure what you mean by "accompanied by one or more caregivers", so my answer above assumed you were refering to "companions".

If, instead, you want to get a reference to a staff member who was used on a particular activity of the patient, then you can use the getrequiredresource() command. To use this command, you need to specify a particular activity. For instance, the following command

getrequiredresource(patient,torownum(patient,40),STAFF,1)

will return a reference to the staff member who was allocated to the first requirement of activity ID 40 of "patient". Timing is everything here, because if no staff member has been allocated yet to that activity, then the command will return a reference to the group member associated with the staff requirement! So in other words, this command will always return a valid reference to an object: either a group object or a specific resource member of the group who was allocated. Therefore, you could not simply say

if(objectexists(getrequiredresource(patient,torownum(patient,40),STAFF,1)))
{
       // do this
}

but instead would need to maybe say something like this

if(getobjecttype(getrequiredresource(patient,torownum(patient,40),STAFF,1)) == OBJECT_Staff)
{
      // do this if a staff member was allocated to activity 40
}

Because I'm not sure of your actual use case, I'm not able to give much more than this. If I totally missed the mark, please give me more background on what you're trying to do, and I'll do my best to help!

0 Likes 0 ·
Tee Hiett avatar image Tee Hiett Cliff King commented ·

Right now, in one of my models I have a patient label named "Accompanied" which has a default value of zero. When a staff member is assigned to a patient accept the value of that label to 1. When the staff member is released, as set the value of that label to 0. This process works but it means I have to carefully assign the values to the label "Accompanied." Since a staff member may accompany a patient through several activities, keeping up with whether or not the patient is accompanied by a staff members can be time-consuming. I just thought that there is an easier way to examine a patient at any activity and see if there is a staff member associated with that patient.

Thanks for your help with this.

Tee

0 Likes 0 ·