-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FHIR Coverage Resource Added #4164
Changes from 28 commits
6749f87
63e04de
bd3dd1b
e874a33
9338f43
3ac2602
12cdce5
7b909af
3de6432
6ab5e8c
5cb31e3
d475121
8f50fc2
bffd64d
a38095b
6dbd6cd
6121ecb
7498ef1
027d0f1
b5e752e
752d8a8
b3daabb
ae7f9b9
9815306
f3afe10
dc35de7
e4370f9
d958941
344d402
5f9ba95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,24 @@ | |
-- #IfDocumentNamingNeeded | ||
-- desc: populate name field with document names. | ||
-- arguments: none | ||
#IfMissingColumn insurance_companies uuid | ||
ALTER TABLE `insurance_companies` ADD `uuid` binary(16) DEFAULT NULL; | ||
#EndIf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When adding a uuid in the upgrade, it should folllow the three steps (showing example of prior entry for users uuid):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. steps:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
#IfUuidNeedUpdate insurance_companies | ||
#EndIf | ||
|
||
#IfNotIndex insurance_companies uuid | ||
CREATE UNIQUE INDEX `uuid` ON `insurance_companies` (`uuid`); | ||
#EndIf | ||
|
||
#IfMissingColumn insurance_data uuid | ||
ALTER TABLE `insurance_data` ADD `uuid` binary(16) DEFAULT NULL; | ||
#EndIf | ||
|
||
#IfUuidNeedUpdate insurance_data | ||
#EndIf | ||
|
||
#IfNotIndex insurance_data uuid | ||
CREATE UNIQUE INDEX `uuid` ON `insurance_data` (`uuid`); | ||
#EndIf |
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); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ public function getAll() | |
|
||
public function getOne($iid) | ||
{ | ||
$serviceResult = $this->insuranceCompanyService->getOne($iid); | ||
$serviceResult = $this->insuranceCompanyService->getOneById($iid); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, that is a put. agree best thing to do here is to keep as is (changing to uuid for this restcontroller will require a bunch more more). so keep the getOneById call :) |
||
return RestControllerHelper::responseHandler($serviceResult, null, 200); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ public function getAll($pid) | |
|
||
public function getOne($pid, $type) | ||
{ | ||
$serviceResult = $this->insuranceService->getOne($pid, $type); | ||
$serviceResult = $this->insuranceService->getOneByPid($pid, $type); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, this is more complicated since the endpoint takes in pid and type. let me look into that to see best strategy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO for me: see above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, lets also keep this as is (getOneByPid). And just need to change one more instance of getOne (to getOneByPid) use in the interface/billing/sl_eob_process.php There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the functionname in interface/billing/sl_eob_process.php |
||
return RestControllerHelper::responseHandler($serviceResult, null, 200); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd usually let this go, but since there's another minor change to do, might as well alphabetize (place below Condition) this as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoping that my next PR will have less of these kind of mistakes :)