4 * CcdaNewpatientImport class.
7 * @link https://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2022 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 namespace OpenEMR\Common\Command
;
15 use Carecoordination\Model\CarecoordinationTable
;
16 use Symfony\Component\Console\Command\Command
;
17 use Symfony\Component\Console\Input\InputDefinition
;
18 use Symfony\Component\Console\Input\InputInterface
;
19 use Symfony\Component\Console\Input\InputOption
;
20 use Symfony\Component\Console\Output\OutputInterface
;
22 class CcdaNewpatientImport
extends Command
24 protected function configure(): void
27 ->setName('openemr:ccda-newpatient-import')
28 ->setDescription('Import a new patient ccda directly from ccda')
29 ->addUsage('--site=default --document=/file/path/file.xml')
32 new InputOption('document', null, InputOption
::VALUE_REQUIRED
, 'File (path) that will be imported to create the new patient'),
33 new InputOption('site', null, InputOption
::VALUE_REQUIRED
, 'Name of site', 'default'),
39 protected function execute(InputInterface
$input, OutputInterface
$output): int
41 if (empty($input->getOption('document'))) {
42 $output->writeln('document parameter is missing (required), so exiting');
45 if (!is_file($input->getOption('document'))) {
46 $output->writeln('document does not exist, so exiting');
50 // get around a large ccda data array
51 ini_set("memory_limit", -1);
53 $GLOBALS['modules_application']->getServiceManager()->build(CarecoordinationTable
::class)->importNewPatient($input->getOption('document'));