public function registerPregnancy(Pregnancy $pregnancy) { $url = $this->buildQuery('/json/pregnancy/'); $data = json_encode($pregnancy->toArray()); $res = $this->doRequest($url, $data, 'POST'); return $res->growchartid; }
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); $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); }
/** * Get the growchartid. * @param Pregnancy $pregnancy * @return string */ public function registerPregnancy(Pregnancy $pregnancy) { $obj = $this->call('registerPregnancy', $pregnancy->getSoapParams()); return $obj->growchartid; }
public function registerPregnancy(Pregnancy $pregnancy) { $res = $this->doRequest($this->buildQuery('/xml/registerpregnancy/'), $pregnancy->getXmlPayload()); return (string) $res->growchartid; }