I'm not sure it's possible in a couchdb view, at least not a single call or view. The best I can think of a view keyed on admission_time and another on discharge_time. You'd have to do the set subtraction yourself, though. couchdb-lucene obviously does this for you. I assume you're doing boolean queries using admission_time and discharge_time fields?
B. On 1 April 2013 10:38, Александр Опак <[email protected]> wrote: > Use Cron(http://en.wikipedia.org/wiki/Cron) for this =) > > > 2013/4/1 Manokaran K <[email protected]> > >> Hi, >> >> Am working on an hospital information system using couchdb and node.js. For >> this I need to get the list and number of patients in a given time period - >> usually a day. I can get the patients who were admitted or discharged in >> that time period. How to get the list of patients who were admitted earlier >> than the start of the period but who got discharged after the time period >> or who are not discharged yet? >> >> Am currently using couchdb-lucene to get this list but would like to know >> if there is a way where I can get it from a view - that way I can just >> reduce and get the number of patients in a given period. I was wondering if >> I should use a scheduler that will create a new 'under_treatment' doc for >> every day till the patient is discharged! Or is there a simpler way? >> >> Thanks in advance, >> mano >> >> -- >> Lord, give us the wisdom to utter words that are gentle and tender, for >> tomorrow we may have to eat them. >> -Sen. Morris Udall >>
