4 * CcdaNewpatient 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 CcdaNewpatient
extends Command
24 protected function configure(): void
27 ->setName('openemr:ccda-newpatient')
28 ->setDescription('Import new patient from audit table id and ccda document id')
29 ->addUsage('--site=default --am_id=5 --document_id=7')
32 new InputOption('am_id', null, InputOption
::VALUE_REQUIRED
, 'The master audit table id of patient that will be imported as a new patient'),
33 new InputOption('document_id', null, InputOption
::VALUE_REQUIRED
, 'The ccda document id that was imported into the audit table'),
34 new InputOption('site', null, InputOption
::VALUE_REQUIRED
, 'Name of site', 'default'),
40 protected function execute(InputInterface
$input, OutputInterface
$output): int
42 if (empty($input->getOption('document_id'))) {
43 $output->writeln('document_id parameter is missing (required), so exiting');
46 if (empty($input->getOption('am_id'))) {
47 $output->writeln('am_id parameter is missing (required), so exiting');
51 $GLOBALS['modules_application']->getServiceManager()->build(CarecoordinationTable
::class)->insert_patient($input->getOption('am_id'), $input->getOption('document_id'));