forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FHIR Coverage Resource Added (openemr#4164)
* FHIR Coverage Resource added and associated changes * style fixes * add OrganizationService API * add uuid column to insurance_companies and insurance_data * PSR12 fixes * add insert update to Organization Service * add FHIR Coverage route * add orgtype while parsing resource * bug fix * remove orgType * fixed handling errors * add validation messages * modular functions * moved from 6.0.0 to 6.0.1 * style fixes * handling old api services data * fixed review suggestions * bug fix for php7.4+ * bug fix for php7.4 * bug fix for php7.4 * bug fix for php7.4 * add getOneById and getOneByPid functions * styling fix * some more fixes * add insurance organization identifier * checking for empty results fix * alphatize Coverage
- Loading branch information
Showing
19 changed files
with
883 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace OpenEMR\RestControllers\FHIR; | ||
|
||
use OpenEMR\Services\FHIR\FhirValidationService; | ||
use OpenEMR\Services\FHIR\FhirCoverageService; | ||
use OpenEMR\Services\FHIR\FhirResourcesService; | ||
use OpenEMR\RestControllers\RestControllerHelper; | ||
use OpenEMR\FHIR\R4\FHIRResource\FHIRBundle\FHIRBundleEntry; | ||
use OpenEMR\Validators\ProcessingResult; | ||
|
||
require_once(__DIR__ . '/../../../_rest_config.php'); | ||
/** | ||
* FHIR Organization Service | ||
* | ||
* @coversDefaultClass OpenEMR\Services\FHIR\FhirOrganizationService | ||
* @package OpenEMR | ||
* @link http://www.open-emr.org | ||
* @author Yash Bothra <yashrajbothra786@gmail.com> | ||
* @copyright Copyright (c) 2020 Yash Bothra <yashrajbothra786@gmail.com> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
* | ||
*/ | ||
class FhirCoverageRestController | ||
{ | ||
private $fhirCoverage; | ||
private $fhirService; | ||
private $fhirValidationService; | ||
|
||
public function __construct() | ||
{ | ||
$this->fhirService = new FhirResourcesService(); | ||
$this->fhirCoverage = new FhirCoverageService(); | ||
$this->fhirValidationService = new FhirValidationService(); | ||
} | ||
|
||
/** | ||
* Queries for FHIR Coverage resource using various search parameters. | ||
* Search parameters include: | ||
* - beneficiary | ||
* - patient | ||
* @return FHIR bundle with query results, if found | ||
*/ | ||
public function getAll($searchParams) | ||
{ | ||
$processingResult = $this->fhirCoverage->getAll($searchParams); | ||
$bundleEntries = array(); | ||
foreach ($processingResult->getData() as $index => $searchResult) { | ||
$bundleEntry = [ | ||
'fullUrl' => $GLOBALS['site_addr_oath'] . ($_SERVER['REDIRECT_URL'] ?? '') . '/' . $searchResult->getId(), | ||
'resource' => $searchResult | ||
]; | ||
$fhirBundleEntry = new FHIRBundleEntry($bundleEntry); | ||
array_push($bundleEntries, $fhirBundleEntry); | ||
} | ||
$bundleSearchResult = $this->fhirService->createBundle('Coverage', $bundleEntries, false); | ||
$searchResponseBody = RestControllerHelper::responseHandler($bundleSearchResult, null, 200); | ||
return $searchResponseBody; | ||
} | ||
|
||
|
||
/** | ||
* Queries for a single FHIR Coverage resource by FHIR id | ||
* @param $fhirId The FHIR Coverage resource id (uuid) | ||
* @returns 200 if the operation completes successfully | ||
*/ | ||
public function getOne($fhirId) | ||
{ | ||
$processingResult = $this->fhirCoverage->getOne($fhirId, true); | ||
return RestControllerHelper::handleFhirProcessingResult($processingResult, 200); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.