Cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of control patients for every week in the year

Dear all,

 

I have a question.

 

My model is an appointment system. I want to count the total number of control patients for every week of the year and put them in table. week 1 = 10 , week 2 = 15. 

 

But it doesn't work. 

 

I hope someon can help me with this. 

 

Martin

 

 

 

 

11 REPLIES

Re: Count number of control patients for every week in the year

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Martin,

 

the attached model uses the function CalendarWeek to calculate a sum of all parts arriving in a certain week and writes them to the corresponding row in a table file.

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Count number of control patients for every week in the year

Thans Ralf for your help!

 

And how how do i separate only the control patients in a column and not the total amount of patients?

 

Thank you advance,

 

Martin 

Re: Count number of control patients for every week in the year

Siemens Phenom Siemens Phenom
Siemens Phenom

You can put an if condition around the line which increments the number.

 

To differentiate the types you can define a custom attribute on the patient and set it to the correct type. Then you can check for the value of this attribute in the if condition.

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Count number of control patients for every week in the year

So when the state of the patient is Control_short and the table has the name Number_of_short_term then i can use the following formula?

 

is
do
local currentWeek := CalendarWeek(EventController.Date+EventController.SimTime);

Inspect @.state

When "Control_short" then Number_of_short_term[1, currentWeek] := Number_of_short_term[1, currentWeek] + 1;
end;

 

Or is this wrong?

Re: Count number of control patients for every week in the year

Siemens Phenom Siemens Phenom
Siemens Phenom

Your code is missing one "end;" at the end. But otherwise it looks fine.

 

Instead of the inspect statement you might want to use a simpler if statement:

if @.state = "Control_short" then
    Number_of_short_term[1,currentWeek] := Number_of_short_term[1,currentWeek] + 1;
end;
Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Count number of control patients for every week in the year

Dear Ralf,

 

Now I get the following error: unknow identifier see attachment.

 

Do you know what is wrong?

 

Kind regards,

 

Martinunknown indentifier.jpg

Re: Count number of control patients for every week in the year

Siemens Phenom Siemens Phenom
Siemens Phenom

It seems that the table Number_of_short_term cannot be found.

 

The method Slot_assignment is in the frame .Models.Main_Model.Planner.

 

The table has to be in this frame as well otherwise you have to specify the path to the table.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Count number of control patients for every week in the year

Dear Ralf,

 

Thank you!  this works.

 

Now I have one last question. Now i have the total nummber of control_short patients in the table file. But how do I get only the short-term control patients in that table that had an appointment in the specific weeks?( I have attached my model and maybe makes that is easier to take a look.)

 

I hope you can help me and then I'm really happy haha!

 

Martin

 

 

 

 

Re: Count number of control patients for every week in the year

Siemens Phenom Siemens Phenom
Siemens Phenom

You could add another custom attribute at the patient of type table where you collect all the weeks where the patient had an appointment.

Then you can check this attribute later.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.