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);
 }
 public function getChartImage(Chart $chart, $filename = null)
 {
     $res = $this->doRequest($this->buildQuery('/xml/getchartimage/'), $chart->getXmlPayload());
     $imageurl = (string) $res->url;
     if ($filename) {
         $content = $this->httpRequest($imageurl);
         file_put_contents($filename . '.' . $chart->getFormat(), $content);
     }
     return $imageurl;
 }
 public function getChartImage(Chart $chart, $filename = null)
 {
     $url = $this->buildQuery(sprintf('/json/pregnancy/%s/chartimage', $chart->getGrowchartid()));
     $res = $this->doRequest($url, $chart->toJson());
     $imageurl = (string) $res->url;
     if ($filename) {
         $content = $this->httpRequest($imageurl);
         file_put_contents($filename . '.' . $chart->getFormat(), $content);
     }
     return $imageurl;
 }
 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');
     $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);
 }
 public function getChartImage(Chart $chart, $filename = null)
 {
     $obj = $this->call('getChartImage', $chart->getSoapParams());
     return $obj->url;
 }