updateWorklistPatientFromMapping() public method

public updateWorklistPatientFromMapping ( WorklistPatient $worklist_patient, DateTime $when, array $attributes = [], boolean $allow_worklist_change = false ) : WorklistPatient | null
$worklist_patient WorklistPatient
$when DateTime
$attributes array
$allow_worklist_change boolean - only allow values to change that don't affect which worklist is mapped
return WorklistPatient | null
示例#1
0
 /**
  * @param \WorklistPatient $model
  *
  * @return bool|\WorklistPatient
  */
 public function saveModel(\WorklistPatient $model)
 {
     // extract the values to be passed to the manager instance for mapping
     $patient = $this->mapPatient($model);
     $when = $this->mapWhen($model);
     $attributes = $this->mapAttributes($model);
     // allow the suppression of errors for appointments received prior to the ignore date
     if ($warning_limit = $this->worklist_manager->getWorklistIgnoreDate()) {
         if ($when < $warning_limit) {
             $this->warn_errors = true;
         }
     }
     if ($model->isNewRecord) {
         if (!($model = $this->worklist_manager->mapPatientToWorklistDefinition($patient, $when, $attributes))) {
             foreach ($this->worklist_manager->getErrors() as $err) {
                 $this->addError($err);
             }
             if ($this->warn_errors) {
                 return false;
             }
             throw new \Exception('Could not add patient to worklist');
         }
     } else {
         $model->patient_id = $patient->id;
         if (!$this->worklist_manager->updateWorklistPatientFromMapping($model, $when, $attributes, !$this->partial_record)) {
             foreach ($this->worklist_manager->getErrors() as $err) {
                 $this->addError($err);
             }
             if ($this->warn_errors) {
                 return false;
             }
             throw new \Exception('Could not update patient worklist entry');
         }
     }
     return $model;
 }