question

fenia tseligka avatar image
0 Likes"
fenia tseligka asked Adrian Haws edited

Patient leaves early conditions

Regarding the patients that leave early without being seen, i would like to separate them into two categories, e.x. the former are those that their surgery was cancelled, while the latter are those who die. How is that possible? I am referring, in both cases, to patient that their waiting time is bigger than their tolerance. Thank you in advance.

FlexSim 16.1.1
waiting roompcievaluate patient conditionleave earlywaiting tolerance
· 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.

Adrian Haws avatar image Adrian Haws commented ·

@fenia tseligka How do you determine which of the two groups a patient belongs to? Do you want to set two different conditions for early exit? And do you want to set different labels on them? Please provide a bit more information.

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws commented ·

Similar question asked here.

0 Likes 0 ·

1 Answer

·
Adrian Haws avatar image
0 Likes"
Adrian Haws answered Adrian Haws edited

Hi Fenia,

It sounds like you might have a situation with two different PCI's-one for patients who leave early after a certain period of time, and another classification with a different waiting tolerance. In the "Patient Leaves Early" options in the Waiting Room there is only one option for a condition. I'm not completely sure how you want your model to work, but I've created an example of how you might do as I described by editing the code. You would want to replace the code under "PickOption Start" with the following:

if (getlabel(patient, "PCI") == 1) {
    if (time() - getcreationtime(patient) > normal(25,5,1)) {
        //Early Exit Location (where patients will be directed when leaving early):
        treenode lwbs_obj = PatientExit1
        set(var(patient, VAR_PatientDestination), tonum(lwbs_obj));
        //mark patient as LWBS
        set(var(patient, VAR_LWBS), 1);

        //Set the patient's label named
        string label_name = "LWBS";
	double label_value = 1;

	if(stringlen(label_name) > 1) {
	//create label if necessary, and set its value
	    set(assertlabel(patient, label_name, DATATYPE_NUMBER), label_value);
	}
	//connect to first location within the early exit area (if not already)
	int connected = 0;
	for(int curport = 1; curport <= nrop(current) && connected == 0; curport++) {
	if(outobject(current, curport) == lwbs_obj)
	connected = 1;
	}
	if(!connected) {
	contextdragconnection(current, lwbs_obj, "A");
	openallip(lwbs_obj);
	}

	// Change the patient's current activity's type to "Patient Travels Unattended" 
	// (regardless of what activity type it is supposed to be), so that the patient
	// will walk out rather than possibly be escorted out.
	int curActivityRow = getvarnum(patient, VAR_ActivityRow);
	settablenum(getvarnode(patient, VAR_ActivityTable), curActivityRow, COL_Activity		Type, ACTIVITY_PatientTravelsUnattended);
	//release patient so they can travel to exit now
	releaseitem(patient, findmatch(nrop(current), outobject(current, count) == lwbs_		obj));
    }
}

else if (getlabel(patient, "PCI") == 2) {
    if (time() - getcreationtime(patient) > normal(15,2,1)) {
	//Early Exit Location (where patients will be directed when leaving early):
	treenode lwbs_obj = /**/PatientExit1/**scriptpath:VIEW:/modules/HC/picklists/get		locations*/;
	//set the patient's destination to the
	set(var(patient, VAR_PatientDestination), tonum(lwbs_obj));
	//mark patient as LWBS
	set(var(patient, VAR_LWBS), 1);

	//Set the patient's label named 
	string label_name = "LWBS";
	//to the value
	double label_value = 1;
	//to identify the patient as an early exit.

	if(stringlen(label_name) > 1) {
	//create label if necessary, and set its value
	set(assertlabel(patient, label_name, DATATYPE_NUMBER), label_value);
	}

	//connect to first location within the early exit area (if not already)
	int connected = 0;
	for(int curport = 1; curport <= nrop(current) && connected == 0; curport++) {
	if(outobject(current, curport) == lwbs_obj)
	connected = 1;
	}
	if(!connected) {
	contextdragconnection(current, lwbs_obj, "A");
	openallip(lwbs_obj);
	}

	// Change the patient's current activity's type to "Patient Travels Unattended"		// (regardless of what activity type it is supposed to be), so that the patient 
	// will walk out rather than possibly be escorted out.
	int curActivityRow = getvarnum(patient, VAR_ActivityRow);
	settablenum(getvarnode(patient, VAR_ActivityTable), curActivityRow, COL_Activity		Type, ACTIVITY_PatientTravelsUnattended);
	//release patient so they can travel to exit now
	releaseitem(patient, findmatch(nrop(current), outobject(current, count) == lwbs_		obj));
    }

else {
    return 0;
}
/**\n\nOn every evaluation event, each patient in the queue will first have the Early Exit Condition evaluated for them. If the patient passes the condition (returns true), then the patient will leave the queue immediately and walk to the specified early exit location.*/

In this code, if a patient's PCI is 1 and he has been waiting more than normal(25,5,1) then he will leave, or if the PCI is 2 and she has been waiting more than normal(15,2,1) then she will leave.

Remember to set the field value for "Evaluate patients every" in the "Patient Condition" options for the Waiting Room. Also, within the code I've included you can change which labels you'll set on Early Exit, what those label values will be, the patient destination, the activity that the patient will be involved in, what PCI's will be involved, and how long each patient can wait.

See attached example model.


lwbs.fsm (102.8 KiB)
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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