Determine if a patient is accompanied by one or more caregivers

Determine if a patient is accompanied by one or more caregivers

tee_hiett
Not applicable
16 Views
7 Replies
Message 1 of 8

Determine if a patient is accompanied by one or more caregivers

tee_hiett
Not applicable

[ FlexSim HC 5.3.4 ]

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

Thanks,

Tee

0 Likes
Accepted solutions (1)
17 Views
7 Replies
Replies (7)
Message 2 of 8

Matthew_Gillespie
Autodesk
Autodesk

@Cliff King



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 3 of 8

cliff_king
Not applicable
if(objectexists(getcompanion(patient,1))
{
	// do this if patient has at least one companion
}
0 Likes
Message 4 of 8

cliff_king
Not applicable

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
Message 5 of 8

tee_hiett
Not applicable

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
Message 6 of 8

cliff_king
Not applicable
Accepted solution

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?

0 Likes
Message 7 of 8

tee_hiett
Not applicable

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

Thanks Tee

0 Likes
Message 8 of 8

cliff_king
Not applicable

getkeepingpatient(thestaffmember)

0 Likes