database.js
// when patient ID is changed, all medication Updates must be updated
when patient ID is changed, all medication Updates must be updated
when patient ID is changed all medication Updates must be updated
function updateMedicationUpdates(oldId, newId) {
  var results = medicationUpdates.chain().find({'pid':oldId}).data();
  for(var i = 0; i < results.length; i++) {
    results[i].pid = newId;
  } 
  medicationUpdates.update(results);
}
function updateMedicationUpdates ( oldId , newId ) { var results = medicationUpdates . chain ( ) . find ( { 'pid' : oldId } ) . data ( ) ; for ( var i = 0 ; i < results . length ; i ++ ) { results [ i ] . pid = newId ; } medicationUpdates . update ( results ) ; }
when patient ID is changed, all medication Updates must be updated
when patient ID is changed all medication Updates must be updated