-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Cascading delete for patient record #380
Comments
I am working on this. |
I have written code to delete all of a patient's visits and models related to visits. However, I am having trouble getting a list of invoices for the patient being deleted so that I can delete them. If someone could provide a snippet of how to search the store for invoices for a patient that would help me finish this. The various ways I have tried to implemented this have all turned up zero invoices even though I have entered one for the patient. My current attempt is the following:
Thank you @tangollama |
@aboma in order to find invoices by patient, a new view needs to be added to the pouch/couch views by defining it in app/utils/pouch-views.js before the 'invoice_by_status' view: }, {
name: 'invoice_by_patient',
function: generateView('invoice',
'emit(doc.data.patient);'
),
version: 1
}..... Then to find: var patientId = patient.get('id');
return this.store.query('invoice', {
options: {
key: patientId
},
mapReduce: 'invoice_by_patient'
}); |
…te related records first and then patient record
@tangollama yes this is still outstanding. |
When deleting a patient, we need to delete all visits, invoices, etc.
The text was updated successfully, but these errors were encountered: