Esempio n. 1
0
 public function toArray()
 {
     $params = array();
     $params['maternalheight'] = $this->getMaternalheight();
     $params['maternalweight'] = $this->getMaternalweight();
     $params['ethnicity'] = $this->getEthnicity();
     $params['parity'] = $this->getParity();
     $params['edd'] = $this->getEdd();
     $params['growversion'] = $this->getGrowchartversion();
     $params['growchartid'] = $this->getGrowchartid();
     $params['requestdate'] = $this->getRequestdate();
     $growchartid = $this->getGrowchartid();
     if ($this->birth) {
         $this->birth->setGrowchartid($growchartid);
         $params['birth'] = $this->birth->toArray();
     }
     if ($this->babies) {
         foreach ($this->babies as $baby) {
             $baby->setGrowchartid($growchartid);
             $params['babies'][] = $baby->toArray();
         }
     }
     if ($this->measurements) {
         foreach ($this->measurements as $m) {
             $m->setGrowchartid($growchartid);
             $params['measurements'][] = $m->toArray();
         }
     }
     if ($this->chart) {
         $this->chart->setGrowchartid($growchartid);
         $params['chart'] = $this->chart->toArray();
     }
     return $params;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $dialog = $this->getHelperSet()->get('dialog');
     $babydob = $dialog->ask($output, '<info>Please entry the baby birth (YYYYMMDD):</info>');
     $babygender = $dialog->select($output, '<info>Please entry the baby gender(M):</info>', array('M' => 'Male', 'F' => 'Female'), 'M');
     $birthweight = $dialog->ask($output, '<info>Please entry baby weight(g):</info>');
     $antenataliugrdetection = $dialog->select($output, '<info>Whether the baby is antenatal iugr detection?(N):</info>', array('Y' => 'Yes', 'N' => 'No'), 'N');
     $birth = new Birth();
     $birth->setAntenataliugrdetection($antenataliugrdetection);
     $birth->setBabydob($babydob);
     $birth->setBabygender($babygender);
     $birth->setBirthweight($birthweight);
     $birth->setGrowchartid($growchartid);
     try {
         $res = $this->client->registerBirth($birth);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
     }
     $output->writeln($res);
 }