protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $preg = new Pregnancy();
     $preg->setEdd('20140809');
     $preg->setEthnicity(1);
     $preg->setParity(0);
     $preg->setMaternalheight(166);
     $preg->setMaternalweight(60);
     $preg->setGrowchartversion('NL2013');
     $measurement = new Measurement();
     $measurement->setDate('20140809');
     $measurement->setType('efw');
     $measurement->setValue(3000);
     $preg->setMeasurements(array($measurement, $measurement));
     $birth = new Birth();
     $birth->setAntenataliugrdetection(false);
     $birth->setBabydob('20140809');
     $preg->setBirth($birth);
     $chart = new Chart();
     $chart->setFirstname('Test');
     $chart->setHeight('750');
     $chart->setLanguage('en_US');
     $preg->setChart($chart);
     $baby = new Baby();
     $baby->setBabygender('M');
     $baby->setBabynr(1);
     $baby->setBabyName('Test baby');
     $babies = array($baby, $baby);
     $preg->setBabies($babies);
     $pregnancies = array($preg, $preg);
     $res = $this->client->registerPregnancies($pregnancies);
     print_r($res);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $dialog = $this->getHelperSet()->get('dialog');
     $firstname = $dialog->ask($output, '<info>Please entry the firstname:</info>');
     $lastname = $dialog->ask($output, '<info>Please entry the lastname:</info>');
     $maternaldob = $dialog->ask($output, '<info>Please entry maternal dob:</info>');
     $maternalreference = $dialog->ask($output, '<info>Please entry maternal reference:</info>');
     $babyname = $dialog->ask($output, '<info>Please entry the baby name:</info>');
     $babygestation = $dialog->ask($output, '<info>Please entry the baby gestation:</info>');
     $babygender = $dialog->select($output, '<info>Please entry the baby gender(M):</info>', array('M' => 'Male', 'F' => 'Female'), 'M');
     $babybirthweight = $dialog->ask($output, '<info>Pleae entry the baby weight when birth (g)</info>');
     $language = $dialog->select($output, '<info>Please entry the text language (en_UK):</info>', Chart::getSupportedLanguage(), '0');
     $pdf = new ChartPdf();
     $pdf->setBabybirthweight($babybirthweight);
     $pdf->setBabygender($babygender);
     $pdf->setBabygestation($babygestation);
     $pdf->setBabyname($babyname);
     $pdf->setFirstname($firstname);
     $pdf->setGrowchartid($growchartid);
     $pdf->setLanguage($language);
     $pdf->setLastname($lastname);
     $pdf->setMaternaldob($maternaldob);
     $pdf->setReference($maternalreference);
     try {
         $url = $this->client->getPDF($pdf);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
     }
     $output->writeln($url);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $uuid = $input->getArgument('measurementuuid');
     $dialog = $this->getHelperSet()->get('dialog');
     $measurementTypes = Measurement::getMeasurementTypes();
     $typeindex = $dialog->select($output, '<info>Please select the measurement type, default is 0:</info>', $measurementTypes, 0);
     $type = $measurementTypes[$typeindex];
     $date = $dialog->ask($output, '<info>Please entry the date (YYYYMMDD):</info>');
     $value = $dialog->ask($output, '<info>Please entry the value:</info>');
     $measurement = new Measurement();
     $measurement->setType($type);
     $measurement->setDate($date);
     $measurement->setValue($value);
     $measurement->setGrowchartid($growchartid);
     $measurement->setUuid($uuid);
     try {
         $res = $this->client->updateMeasurement($measurement);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
         exit;
     }
     $output->writeln($res);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $uuid = $input->getArgument('measurementuuid');
     $result = $this->client->removeMeasurement($growchartid, $uuid);
     $output->writeln($result);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     try {
         $data = $this->client->clearData($growchartid);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
         exit;
     }
     print_r(json_decode(json_encode($data), true));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $dialog = $this->getHelperSet()->get('dialog');
     $maternalheight = $dialog->askAndValidate($output, '<info>Please enter the maternal height (cm): </info>', function ($value) {
         if (trim($value) == '') {
             throw new InvalidArgumentException('The maternal height can not be empty');
         }
         return $value;
     });
     $maternalweight = $dialog->askAndValidate($output, '<info>Please enter the maternal weight (kg): </info>', function ($value) {
         if (trim($value) == '') {
             throw new InvalidArgumentException('The maternal weight can not be empty');
         }
         return $value;
     });
     $edd = $dialog->askAndValidate($output, '<info>Please enter the EDD (YYYYMMDD): </info>', function ($value) {
         if (trim($value) == '') {
             throw new InvalidArgumentException('The EDD can not be empty, and the format is YYYYMMDD');
         }
         return $value;
     });
     $parity = $dialog->askAndValidate($output, '<info>Please entry the parity: </info>', function ($value) {
         if (trim($value) === '') {
             throw new InvalidArgumentException('The parity can not be empty');
         }
         return $value;
     });
     $ethnicity = $dialog->select($output, '<info>Please entry the ethnic, default is 0: </info>', Ethnicity::getEthnicity(), 0);
     $version = array('NL2012', 'NL2013');
     $versionindex = $dialog->select($output, '<info>Please entry the GROW version, default is 1</info>', $version, 1);
     $growversion = $version[$versionindex];
     $preg = new Pregnancy();
     $preg->setEdd($edd);
     $preg->setEthnicity($ethnicity);
     $preg->setParity($parity);
     $preg->setMaternalheight($maternalheight);
     $preg->setMaternalweight($maternalweight);
     $preg->setGrowchartversion($growversion);
     $preg->setGrowchartid($growchartid);
     $client = $this->client;
     try {
         $res = $client->registerPregnancy($preg);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
         exit;
     }
     $output->writeln('<info>Growchartid: </info>' . $res);
 }
 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);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $growchartid = $input->getArgument('growchartid');
     $dialog = $this->getHelperSet()->get('dialog');
     $previousgrowchartid = $dialog->ask($output, '<info>Please entry the previous growchartid</info>');
     $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>');
     $birthgestation = $dialog->ask($output, '<info>Please entry birth gestation:</info>');
     $baby = new Baby();
     $baby->setBabydob($babydob);
     $baby->setBabygender($babygender);
     $baby->setBirthgestation($birthgestation);
     $baby->setBirthweight($birthweight);
     $baby->setGrowchartid($growchartid);
     $baby->setPreviousGrowchartid($previousgrowchartid);
     try {
         $res = $this->client->registerBaby($baby);
     } catch (Exception $ex) {
         $output->writeln('<error>' . $ex->getMessage() . '</error>');
     }
     $output->writeln($res);
 }