question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Tee Hiett published

At reset, count number of patients in appointment table by provider and day of week

In FlexSimHC, I have an appointment table more with more than 800 rows containing the appointments of patients for some 20 MDs. On reset, I want to count the number of patients by provider by day of the week and put this information into a global table. Any suggestions would be greatly appreciated. Thanks, Tee

FlexSim HC 5.1.0
global tablehealthcareappointments
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

Could you attach a sample of how your appointment table is set up?

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

appointments-table-adj.zip

thanks, Matthew

0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

Here's a model with the script and table: patientsperprovider.fsm

treenode arrivals = node("MODEL:/PatientArrivals1>variables/ScheduledArrivals");
string table = "GlobalTable1";

settablesize(table, 1, 7);
clearglobaltable(table);

for(int i = 1; i <= content(arrivals); i++)
{
	treenode arrival = rank(arrivals, i);
	string provider = gets(rank(arrival, 4));
	
	if(provider == "")
		continue;
		
	if(gettableheader(table, 1, 1) == "")
		settableheader(table, 1, 1, provider);
		
	int apptTime = get(first(first(arrival)));
	int col = (getday(apptTime) - 1) % 7 + 1;
	int row = 0;	
	
	for(int j = 1; j <= gettablerows(table); j++)
		if(gettableheader(table, 1, j) == provider)		
			row = j;	
	
	if(!row)
	{
		addtablerow(table);
		row = gettablerows(table);		
		settableheader(table, 1, row, provider);
	}
	
	settablenum(table, row, col, gettablenum(table, row, col) + 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.