Skip to content

Commit

Permalink
fix: only send diagnosis with no enddate to newcrop
Browse files Browse the repository at this point in the history
* only send diagnosis with no enddate to newcrop

* only push active diag to newcrop

* fix extensions
  • Loading branch information
kchapple authored Oct 30, 2023
1 parent 221034a commit 355b5f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions interface/eRxStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ class eRxStore
*/
public static function sanitizeNumber($value)
{
return preg_replace('/[^-0-9.]/', '', $value);
$sanitized = '';
if ($value !== null) {
$sanitized = preg_replace('/[^-0-9.]/', '', $value);
}

return $sanitized;
}

/**
Expand Down Expand Up @@ -160,7 +165,7 @@ public function getPatientAllergiesByPatientId($patientId)
public function getPatientDiagnosisByPatientId($patientId)
{
return sqlStatement(
'SELECT diagnosis, begdate, title, date
'SELECT diagnosis, begdate, enddate, title, date
FROM lists
WHERE `type` = \'medical_problem\'
AND pid = ?
Expand Down
3 changes: 2 additions & 1 deletion interface/eRxXMLBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ public function getPatientDiagnosis($patientId)
// NewCrop only accepts ICD10 codes, so only add XML elements for diagnosis with ICD10 code types
if (
$codeType == 'ICD10' &&
!empty($diagnosisId)
!empty($diagnosisId) &&
empty($diagnosis['enddate'])
) {
$element = $this->getDocument()->createElement('PatientDiagnosis');
$element->appendChild($this->createElementText('diagnosisID', $diagnosisId));
Expand Down

0 comments on commit 355b5f0

Please sign in to comment.