Skip to content

Commit

Permalink
fix to prior commit, php8 warnings (openemr#5356)
Browse files Browse the repository at this point in the history
* fix to prior commit, php8 warnings

* format

* ins php8 warnings on import from ccdaservice
  • Loading branch information
stephenwaite committed May 18, 2022
1 parent 74eb0cb commit 75d7974
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function importCore($xml_content)
// test if patient is deceased
if ($this->is_qrda_import) {
foreach ($components[2]["section"]["entry"] as $entry_search) {
if ($entry_search["observation"]["value"]["code"] == '419099009') {
if (($entry_search["observation"]["value"]["code"] ?? null) == '419099009') {
$deceased_date = $entry_search["observation"]["effectiveTime"]["low"]["value"];
$this->documentData['field_name_value_array']['patient_data'][1]['deceased_date'] = date('Y-m-d H:i:s', strtotime($deceased_date));
$this->documentData['field_name_value_array']['patient_data'][1]['deceased_reason'] = 'SNOMED-CT:419099009';
Expand Down
2 changes: 1 addition & 1 deletion sql/6_1_0-to-7_0_0_upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,6 @@ ALTER TABLE `insurance_companies` ADD `cqm_sop` int DEFAULT NULL COMMENT 'HL7 So
INSERT INTO list_options ( list_id, option_id, title, seq, is_default ) VALUES ('order_type','order','Order',90,0);
#EndIf

#IfNotColumnType procedure_type procedure_code varchar(63)
#IfNotColumnType procedure_type procedure_code varchar(64)
ALTER TABLE `procedure_type` MODIFY `procedure_code` varchar(64) NOT NULL DEFAULT '' COMMENT 'code identifying this procedure',
#EndIf
61 changes: 30 additions & 31 deletions src/Services/Cda/CdaTemplateParse.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,33 +326,32 @@ public function fetchEncounterPerformed($entry): void
$this->templateData['field_name_value_array']['encounter'][$i]['code_text'] = $code['code_text'];

$this->templateData['field_name_value_array']['encounter'][$i]['provider_npi'] = $entry['encounter']['performer']['assignedEntity']['id']['extension'] ?? null;
$this->templateData['field_name_value_array']['encounter'][$i]['provider_name'] = $entry['encounter']['performer']['assignedEntity']['assignedPerson']['name']['given']; // first
$this->templateData['field_name_value_array']['encounter'][$i]['provider_family'] = $entry['encounter']['performer']['assignedEntity']['assignedPerson']['name']['family']; // last
$this->templateData['field_name_value_array']['encounter'][$i]['provider_address'] = $entry['encounter']['performer']['assignedEntity']['addr']['streetAddressLine'];
$this->templateData['field_name_value_array']['encounter'][$i]['provider_city'] = $entry['encounter']['performer']['assignedEntity']['addr']['city'];
$this->templateData['field_name_value_array']['encounter'][$i]['provider_state'] = $entry['encounter']['performer']['assignedEntity']['addr']['state'];
$this->templateData['field_name_value_array']['encounter'][$i]['provider_postalCode'] = $entry['encounter']['performer']['assignedEntity']['addr']['postalCode'];
$this->templateData['field_name_value_array']['encounter'][$i]['provider_country'] = $entry['encounter']['performer']['assignedEntity']['addr']['country'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_name'] = $entry['encounter']['participant']['participantRole']['playingEntity']['name'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_address'] = $entry['encounter']['participant']['participantRole']['addr']['streetAddressLine'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_city'] = $entry['encounter']['participant']['participantRole']['addr']['city'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_state'] = $entry['encounter']['participant']['participantRole']['addr']['state'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_zip'] = $entry['encounter']['participant']['participantRole']['addr']['postalCode'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_country'] = $entry['encounter']['participant']['participantRole']['addr']['country'];
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_telecom'] = $entry['encounter']['participant']['participantRole']['telecom'];

$this->templateData['field_name_value_array']['encounter'][$i]['provider_name'] = $entry['encounter']['performer']['assignedEntity']['assignedPerson']['name']['given'] ?? ''; // first
$this->templateData['field_name_value_array']['encounter'][$i]['provider_family'] = $entry['encounter']['performer']['assignedEntity']['assignedPerson']['name']['family'] ?? ''; // last
$this->templateData['field_name_value_array']['encounter'][$i]['provider_address'] = $entry['encounter']['performer']['assignedEntity']['addr']['streetAddressLine'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['provider_city'] = $entry['encounter']['performer']['assignedEntity']['addr']['city'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['provider_state'] = $entry['encounter']['performer']['assignedEntity']['addr']['state'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['provider_postalCode'] = $entry['encounter']['performer']['assignedEntity']['addr']['postalCode'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['provider_country'] = $entry['encounter']['performer']['assignedEntity']['addr']['country'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_name'] = $entry['encounter']['participant']['participantRole']['playingEntity']['name'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_address'] = $entry['encounter']['participant']['participantRole']['addr']['streetAddressLine'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_city'] = $entry['encounter']['participant']['participantRole']['addr']['city'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_state'] = $entry['encounter']['participant']['participantRole']['addr']['state'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_zip'] = $entry['encounter']['participant']['participantRole']['addr']['postalCode'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_country'] = $entry['encounter']['participant']['participantRole']['addr']['country'] ?? '';
$this->templateData['field_name_value_array']['encounter'][$i]['represented_organization_telecom'] = $entry['encounter']['participant']['participantRole']['telecom'] ?? '';
// encounter diagnosis to issues list
$code = $this->codeService->resolveCode(
$entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['code'],
$entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['codeSystemName'] ?: $entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['codeSystem'] ?? '',
$entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['displayName']
$entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['code'] ?? '',
($entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['codeSystemName'] ?? '') ?: $entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['codeSystem'] ?? '',
$entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['value']['displayName'] ?? ''
);
$this->templateData['field_name_value_array']['encounter'][$i]['encounter_diagnosis_date'] = $entry['encounter']['entryRelationship'][1]['act']['entryRelationship']['observation']['effectiveTime']['low']['value'] ?? $this->templateData['field_name_value_array']['encounter'][$i]['date'] ?? null;
if (empty($code['code'])) {
$code = $this->codeService->resolveCode(
$entry["encounter"]["entryRelationship"]["observation"]["value"]["code"],
$entry["encounter"]["entryRelationship"]["observation"]["value"]['codeSystemName'] ?: $entry["encounter"]["entryRelationship"]["observation"]["value"]['codeSystem'] ?? '',
$entry["encounter"]["entryRelationship"]["observation"]["value"]['displayName']
$entry["encounter"]["entryRelationship"]["observation"]["value"]["code"] ?? '',
($entry["encounter"]["entryRelationship"]["observation"]["value"]['codeSystemName'] ?? '') ?: $entry["encounter"]["entryRelationship"]["observation"]["value"]['codeSystem'] ?? '',
$entry["encounter"]["entryRelationship"]["observation"]["value"]['displayName'] ?? ''
);
$this->templateData['field_name_value_array']['encounter'][$i]['encounter_diagnosis_date'] = $this->templateData['field_name_value_array']['encounter'][$i]['date'] ?? null;
}
Expand All @@ -371,7 +370,7 @@ public function fetchEncounterPerformed($entry): void
$option = $this->codeService->dischargeOptionIdFromCode($code) ?? '';
}
}
$this->templateData['field_name_value_array']['encounter'][$i]['encounter_discharge_code'] = $option;
$this->templateData['field_name_value_array']['encounter'][$i]['encounter_discharge_code'] = $option ?? '';

$this->templateData['entry_identification_array']['encounter'][$i] = $i;
}
Expand Down Expand Up @@ -1277,7 +1276,7 @@ public function fetchCarePlanData($entry)

$code = $this->codeService->resolveCode(
$entry['act']['code']['code'] ?? '',
$entry['act']['code']['codeSystemName'] ?: $entry['act']['code']['codeSystem'] ?? null,
($entry['act']['code']['codeSystemName'] ?? null) ?: $entry['act']['code']['codeSystem'] ?? null,
$entry['act']['code']['displayName'] ?? $entry['act']['text']
);
if (!empty($entry["act"]["code"]["nullFlavor"]) && !empty($entry['act']['code']["valueSet"])) {
Expand All @@ -1286,8 +1285,8 @@ public function fetchCarePlanData($entry)
$code['code_text'] = $entry['act']['text'] ?? '';
}
$this->templateData['field_name_value_array']['care_plan'][$i]['plan_type'] = $plan_type;
$this->templateData['field_name_value_array']['care_plan'][$i]['extension'] = $entry['act']['templateId']['root'];
$this->templateData['field_name_value_array']['care_plan'][$i]['root'] = $entry['act']['templateId']['root'];
$this->templateData['field_name_value_array']['care_plan'][$i]['extension'] = $entry['act']['templateId']['root'] ?? '';
$this->templateData['field_name_value_array']['care_plan'][$i]['root'] = $entry['act']['templateId']['root'] ?? '';
$this->templateData['field_name_value_array']['care_plan'][$i]['code'] = $code['formatted_code'];
$this->templateData['field_name_value_array']['care_plan'][$i]['code_text'] = $code['code_text'];
$this->templateData['field_name_value_array']['care_plan'][$i]['description'] = $entry['act']['text'] ?? $code['code_text'];
Expand All @@ -1298,7 +1297,7 @@ public function fetchCarePlanData($entry)
$code = $this->codeService->resolveCode(
$entry['act']['entryRelationship']['observation']['value']['code'],
$entry['act']['entryRelationship']['observation']['value']['codeSystemName'] ?: $entry['act']['entryRelationship']['observation']['value']['codeSystem'] ?? '',
$entry['act']['entryRelationship']['observation']['value']['displayName']
$entry['act']['entryRelationship']['observation']['value']['displayName'] ?? ''
);
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_code'] = $code['formatted_code'];
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_code_text'] = $code['code_text'];
Expand Down Expand Up @@ -1361,9 +1360,9 @@ public function fetchCarePlanData($entry)

//$plan_type = 'substance_medication_order';
$code = $this->codeService->resolveCode(
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['code'],
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['codeSystemName'] ?? $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['codeSystem'],
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['displayName']
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['code'] ?? '',
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['codeSystemName'] ?? ($entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['codeSystem'] ?? ''),
$entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']['displayName'] ?? ''
);
if (!empty($entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']["nullFlavor"])) {
$code['code'] = $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['code']["valueSet"] ?? null;
Expand Down Expand Up @@ -1396,13 +1395,13 @@ public function fetchCarePlanData($entry)
$code = $this->codeService->resolveCode(
$entry['substanceAdministration']['entryRelationship']['observation']['value']['code'],
$entry['substanceAdministration']['entryRelationship']['observation']['value']['codeSystemName'] ?: $entry['substanceAdministration']['entryRelationship']['observation']['value']['codeSystem'] ?? '',
$entry['substanceAdministration']['entryRelationship']['observation']['value']['displayName']
$entry['substanceAdministration']['entryRelationship']['observation']['value']['displayName'] ?? ''
);
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_code'] = $code['formatted_code'];
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_code_text'] = $code['code_text'];
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_description'] = $code['code_text'] ?? $entry['observation']['text'];
$date_low = $entry['substanceAdministration']['entryRelationship']['observation']['effectiveTime']['low']['value'] ?? null;
$date_high = $entry['substanceAdministration']['entryRelationship']['observation']['effectiveTime']['high']['value'];
$date_high = $entry['substanceAdministration']['entryRelationship']['observation']['effectiveTime']['high']['value'] ?? null;
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_date_low'] = $date_low;
$this->templateData['field_name_value_array']['care_plan'][$i]['reason_date_high'] = $date_high;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/CodeTypesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public function dischargeOptionIdFromCode($formatted_code)
{
$listService = new ListService();
$ret = $listService->getOptionsByListName('discharge-disposition', ['codes' => $formatted_code]) ?? '';
return $ret[0]['option_id'];
return $ret[0]['option_id'] ?? '';
}

public function dischargeCodeFromOptionId($option_id)
Expand Down
48 changes: 24 additions & 24 deletions src/Services/InsuranceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,31 +330,31 @@ public function insert($pid, $type, $data)
array(
$type,
$data["provider"],
$data["plan_name"],
$data["policy_number"],
$data["group_number"],
$data["subscriber_lname"],
$data["subscriber_mname"],
$data["subscriber_fname"],
$data["subscriber_relationship"],
$data["subscriber_ss"],
$data["subscriber_DOB"],
$data["subscriber_street"],
$data["subscriber_postal_code"],
$data["subscriber_city"],
$data["subscriber_state"],
$data["subscriber_country"],
$data["subscriber_phone"],
$data["subscriber_employer"],
$data["subscriber_employer_street"],
$data["subscriber_employer_postal_code"],
$data["subscriber_employer_state"],
$data["subscriber_employer_country"],
$data["subscriber_employer_city"],
$data["copay"],
$data["date"],
$data["plan_name"] ?? '',
$data["policy_number"] ?? '',
$data["group_number"] ?? '',
$data["subscriber_lname"] ?? '',
$data["subscriber_mname"] ?? '',
$data["subscriber_fname"] ?? '',
$data["subscriber_relationship"] ?? '',
$data["subscriber_ss"] ?? '',
$data["subscriber_DOB"] ?? '',
$data["subscriber_street"] ?? '',
$data["subscriber_postal_code"] ?? '',
$data["subscriber_city"] ?? '',
$data["subscriber_state"] ?? '',
$data["subscriber_country"] ?? '',
$data["subscriber_phone"] ?? '',
$data["subscriber_employer"] ?? '',
$data["subscriber_employer_street"] ?? '',
$data["subscriber_employer_postal_code"] ?? '',
$data["subscriber_employer_state"] ?? '',
$data["subscriber_employer_country"] ?? '',
$data["subscriber_employer_city"] ?? '',
$data["copay"] ?? '',
$data["date"] ?? '',
$pid,
$data["subscriber_sex"],
$data["subscriber_sex"] ?? '',
$data["accept_assignment"] ?? '',
$data["policy_type"] ?? ''
)
Expand Down

0 comments on commit 75d7974

Please sign in to comment.