views:

69

answers:

1

Hi Guys,

i'm developing a site using codeigniter, in my app i have this scenario

  • each patient is assigned to a doctor unit and there are 6 doctor units operating in the hospital
  • some times one or two doctor units may be not operating
  • some doctor units are not operating is certain days, i.e one can operate on monday,wednesday and friday... like wise

so i have to auto generate the doctor unit number according to the arrival at the registration, how can i do this? how to track the previous unit assigned and assign the next one? query the operating units at the beginning keeping it in a array and auto generating, would that be appropriate? or using JavaScript to do it in the client side,would that be appropriate?

if suddenly doctor unit stops working, i will need to be dynamic enough to work on that condition also, how to achieve that kind of things using any approach?

regards, Rangana

+1  A: 

Well, you should obviously have a database table where you store your assigned units (and ideally the amount of time it'll take them to complete an operation). You also have a table or a combination of tables that hold each unit's timetable (on which days, between which hours they operate). This means you can always get the free units by whatever means necessary: usually a healthy mix of database queries and array operations.

Indeed, if you have a form open in front of multiple operators for a long time you could end up with double assigned doctor units - assuming the forms are populated with the available units at the time they are first opened. My suggestion is that from this form you should fire periodical (each 1 min?) AJAX requests over to the function described above which will ideally return the available doctor units and repopulate your form accordingly with the updated data. You should also check after the form's submission if the selected unit is really free, just to be sure.

I'm not sure I understood your question 100% so I hope this helps.

kitsched
got your idea, i have such kind of tables in my database, they contain the time tables of the doctor units, my problem is how to programmetically achieve the generation of the doctor unit? how to keep track of the previous doctor unit i have registered? and then assign a new one , next one after that?
ranganaMIT
Determine which are the ones currently assigned and assign to first free one, no?
kitsched