Browse Source

Merge branch 'master' of https://rav.triplestart.com/tigerphp/stagfe2

root 1 year ago
parent
commit
68a2d5f42c

+ 5 - 0
app/Helpers/helpers.php

@@ -1158,3 +1158,8 @@ if(!function_exists('get_custom_problems')) {
     }
 }
 
+if(!function_exists('camel_case')) {
+    function camel_case($string, $dontStrip = []) {
+        return lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-z0-9'.implode('',$dontStrip).']+/', ' ',$string))));
+    }
+}

+ 17 - 0
app/Http/Controllers/Controller.php

@@ -13,6 +13,7 @@ use Illuminate\Foundation\Validation\ValidatesRequests;
 use Illuminate\Http\Request;
 use Illuminate\Routing\Controller as BaseController;
 use Illuminate\Support\Facades\Cookie;
+use Illuminate\Support\Facades\Http;
 
 class Controller extends BaseController
 {
@@ -137,4 +138,20 @@ class Controller extends BaseController
             $query->where($columnName, $request->input($valueName));
         }
     }
+
+    // TODO move to utility
+    public function callJavaApi($endPoint, $data)
+    {
+        $sessionKey = Cookie::get('sessionKey');
+        $url =  config('stag.backendUrl') . $endPoint;
+        
+        $response = Http::asForm()
+            ->withHeaders([
+                'sessionKey' => $sessionKey
+            ])
+            ->post($url, $data)
+            ->json();
+        return $response;
+    }
+
 }

+ 36 - 2
app/Http/Controllers/PatientController.php

@@ -543,13 +543,47 @@ class PatientController extends Controller
         }
         return view('app.patient.tickets', compact('patient', 'pros', 'allPros', 'type', 'currentTicket'));
     }
-
+    protected function getDefaultFacility(){
+        $defaultFacility = Facility::where('name', 'Ultra Care Pharmacy')->where('address_city', 'Baltimore')->first();
+        return $defaultFacility;
+    }
     public function prescriptions(Request $request, Client $patient, String $type = '', String $currentErx = '') {
+        $this->updateDefaultPatientPharmacy($patient);
         if(!!$currentErx) {
             $currentErx = Erx::where('uid', $currentErx)->first();
         }
         $note = $patient->coreNote;
-        return view('app.patient.prescriptions.index', compact('patient', 'type', 'currentErx', 'note'));
+        $defaultFacility = $this->getDefaultFacility();
+        $patient->refresh();
+        return view('app.patient.prescriptions.index', compact('patient', 'type', 'currentErx', 'note', 'defaultFacility'));
+    }
+
+    protected function updateDefaultPatientPharmacy(Client $patient){
+        $prescriptions = $patient->prescriptions;
+        if(!count($prescriptions)) return;
+        $defaultFacility = $this->getDefaultFacility();
+        if(!$defaultFacility) return;
+
+        foreach($prescriptions as $prescription){
+            if($prescription->logistics_detail_json) continue;
+            $this->setPrescriptionDefaultPharmacy($prescription, $defaultFacility);
+        }
+    }
+
+    private function setPrescriptionDefaultPharmacy(Erx $prescription, Facility $facility){
+        $data = [
+            'uid' => $prescription->uid,
+            'logisticsDetailJson' => json_encode([
+                'facilityName' => $facility->name,
+                'facilityCity' => $facility->address_city,
+                'facilityState' => $facility->address_state,
+                'facilityAddressMemo' => '',
+                'facilityPhone' => $facility->phone,
+                'facilityFax' => $facility->fax,
+                'facilityZip' => $facility->address_zip,
+            ])
+        ];
+        $response = $this->callJavaApi('/erx/updateLogisticsDetail', $data);
     }
 
     public function prescriptionsPopup(Request $request, Client $patient, String $type = '', String $currentErx = '') {

BIN
public/db.zip


+ 2 - 2
resources/views/app/generic-invoices/index.blade.php

@@ -1,7 +1,7 @@
 <?php
 $invoices = \App\Models\Invoice::where($parentType === 'Note' ? 'note_id' : 'care_month_id', $parentID)->get();
 ?>
-<div id="generic-invoices-{{$parentType}}-{{$parentID}}">
+<div id="generic-invoices-{{camel_case($parentType)}}-{{$parentID}}">
     <div class="d-flex align-items-baseline pb-3">
         <h4 class="font-weight-bold m-0">Invoices</h4>
         <span class="text-secondary mx-2">|</span>
@@ -258,6 +258,6 @@ $invoices = \App\Models\Invoice::where($parentType === 'Note' ? 'note_id' : 'car
                     return false;
                 });
         }
-        addMCInitializer('generic-invoices-{{$parentType}}-{{$parentID}}', init, '#generic-invoices-{{$parentType}}-{{$parentID}}')
+        addMCInitializer('generic-invoices-{{camel_case($parentType)}}-{{$parentID}}', init, '#generic-invoices-{{camel_case($parentType)}}-{{$parentID}}')
     }).call(window);
 </script>

+ 6 - 12
resources/views/app/invoice-center/_ic-add-payment-method-moe.blade.php

@@ -4,11 +4,11 @@
         <input type="hidden" name="customerUid" value="{{$customer->uid}}">
         <p class="text-secondary font-weight-bold mb-1 text-nowrap">Add Payment Method</p>
         <div class="mb-2">
-            <lable class="mb-1 text-secondary text-sm">Card Number</lable>
+            <label class="mb-1 text-secondary text-sm">Card Number</label>
             <input type="text" name="cardNumber" value="" class="form-control form-control-sm min-width-200px" required>
         </div>
         <div class="mb-2">
-            <lable class="mb-1 text-secondary text-sm">Expiry Date</lable>
+            <label class="mb-1 text-secondary text-sm">Expiry Date</label>
             <div class="d-flex align-items-start">
                 <select class="form-control form-control-sm" name="expirationMonth" required>
                     <option value="">-- select --</option>
@@ -25,22 +25,16 @@
                     <option value="11">November</option>
                     <option value="12">December</option>
                 </select>
-                <select class="form-control form-control-sm ml-2" name="expirationYear" required>
-                    <option value="">-- select --</option>
-                    <option value="2022">2022</option>
-                    <option value="2023">2023</option>
-                    <option value="2024">2024</option>
-                    <option value="2025">2025</option>
-                    <option value="2026">2026</option>
-                </select>
+                <input type="number" name="expirationYear" class="form-control form-control-sm ml-2" placeholder="Expiry Year" required>
+                
             </div>
         </div>
         <div class="mb-2">
-            <lable class="mb-1 text-secondary text-sm">CVV/CCV Number</lable>
+            <label class="mb-1 text-secondary text-sm">CVV/CCV Number</label>
             <input type="text" name="ccv" value="" class="form-control form-control-sm min-width-200px" required>
         </div>
         <div class="mb-2">
-            <lable class="mb-1 text-secondary text-sm">Billing Zip</lable>
+            <label class="mb-1 text-secondary text-sm">Billing Zip</label>
             <input type="text" name="billingZip" value="" class="form-control form-control-sm min-width-200px">
         </div>
         <div class="d-flex align-items-center">

+ 32 - 30
resources/views/app/patient/create-patient/demographics-form.blade.php

@@ -13,15 +13,15 @@
 		</div>
 	</div>
 	<div class="col-md-12">
-		<div class="row form-group align-items-center">			
+		<div class="row form-group align-items-center">
 				<label class="col col-label font-weight-bold m-0">Email:</label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<input class='form-control' type='email' placeholder="Email Address" name='emailAddress'>
 			</div>
 		</div>
 	</div>
 	<div class="col-md-12">
-		<div class="row form-group align-items-center">			
+		<div class="row form-group align-items-center">
 				<label class="col-md-2 pr-0 font-weight-bold m-0">Gender:</label>
 				<div class="col-md-10">
 					<select class="form-control input-sm" name="patientSex" select2>
@@ -38,30 +38,30 @@
 	<div class="col-12">
 		<div class="row align-items-center form-group">
 			<label class="col-md-2 pr-0 font-weight-bold m-0">DOB: <span class="text-danger">*</span></label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<input type="date" required name="patientDob" value="" class="form-control input-sm" max="{{date('Y-m-d')}}">
 			</div>
 		</div>
 	</div>
 
 	<div class="col-12">
-		<div class="row align-items-center form-group">			
+		<div class="row align-items-center form-group">
 			<label class="col-md-2 pr-0 font-weight-bold m-0">Service:</label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<input type="date" name="dateOfService" value="{{date('Y-m-d')}}" class="form-control input-sm">
 			</div>
 		</div>
 	</div>
 
-	
-	
+
+
 </div>
 @if($pro->pro_type === 'ADMIN')
 <div class="row">
 	<div class="col-12">
-		<div class="row align-items-center form-group">			
+		<div class="row align-items-center form-group">
 			<label class="col-md-2 pr-0 font-weight-bold m-0">HCP Pro:</label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<select name="hcpProUid" class="form-control input-sm" provider-search provider-type="hcp">
 					<option value="">--select--</option>
 				</select>
@@ -69,7 +69,7 @@
 		</div>
 	</div>
 	<div class="col-12">
-		<div class="row align-items-center form-group">		
+		<div class="row align-items-center form-group">
 			<label class='col-md-2 pr-0 font-weight-bold m-0' style="font-size:10px !important;">Coordinator:</label>
 			<div class="col-md-10">
 				<select name="assistantProUid" class="form-control input-sm" provider-search provider-type="default-na">
@@ -77,14 +77,14 @@
 				</select>
 			</div>
 		</div>
-	</div>	
+	</div>
 </div>
 @elseif($pro->is_hcp === true)
 <div class="row">
 	<div class="col-md-12">
-		<div class='row form-group'>			
+		<div class='row form-group'>
 				<label class="col-md-2 pr-0 font-weight-bold m-0">HCP Pro:</label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<input type="text" class="form-control" readonly value="{{$pro->displayName()}}">
 				<input type="hidden" name="hcpProUid" value="{{$pro->uid}}">
 			</div>
@@ -104,7 +104,7 @@
 @elseif($pro->isDefaultNA())
 <div class="row">
 	<div class="col-12">
-		<div class="row align-items-center form-group">			
+		<div class="row align-items-center form-group">
 				<label class="col-md-2 pr-0 font-weight-bold m-0">HCP Pro:</label>
 				<div class="col-md-10">
 				<?php $teams = $pro->teamsWhereAssistant; ?>
@@ -121,16 +121,16 @@
 	</div>
 
 	<div class="col-12">
-		<div class="row align-items-center form-group">			
+		<div class="row align-items-center form-group">
 			<label class='col-md-2 pr-0 font-weight-bold m-0'>Coordinator:</label>
-			<div class="col-md-10">	
+			<div class="col-md-10">
 				<input type="text" class="form-control" readonly value="{{$pro->displayName()}}">
 				<input type="hidden" name="assistantProUid" value="{{$pro->uid}}">
 			</div>
 		</div>
 	</div>
-	
-	
+
+
 </div>
 @endif
 <div class="row">
@@ -169,16 +169,18 @@
 	<input class='form-control' type='text' name='source' />
 </div>
 
-<div class='form-group mb-3 checkbox'>
-	<label>
-		<input type='checkbox' name='forceNewChartCreation' />
-		Force New Chart Creation
-	</label>
-</div>
+<div class="row m-0">
+	<div class='form-group mb-3 checkbox'>
+		<label class="d-flex align-items-center">
+			<input type='checkbox' name='forceNewChartCreation' class="mr-2" />
+			Force New Chart Creation
+		</label>
+	</div>
 
-<div class='form-group mb-3 checkbox'>
-	<label>
-		<input type='checkbox' name='isTestRecord' />
-		This is a test record
-	</label>
+	<div class='form-group mb-3 ml-3 checkbox'>
+		<label class="d-flex align-items-center">
+			<input type='checkbox' name='isTestRecord' class="mr-2" />
+			<b>Test Record</b>
+		</label>
+	</div>
 </div>

+ 2 - 2
resources/views/app/patient/note/rm-setup.blade.php

@@ -334,9 +334,9 @@
                 </table>
             </div>
         @endif
-        {{--<div class="border-top mt-1 pt-2">
+       <div class="border-top mt-1 pt-2">
             @include('app.patient.partials.client_bp_weight_phone_number_status')
-        </div>--}}
+        </div>
 
     </div>
 

+ 1 - 5
resources/views/app/patient/partials/put-mcp-form.blade.php

@@ -6,12 +6,8 @@
             <option value=""> --select--</option>
         </select>
     </div>
-    <label class="mb-2 d-flex align-items-center">
-        <input type="checkbox" name="shouldUpdateMcpOnCurrentCareMonth">
-        <span class="ml-1 text-nowrap">Also set as the current care month's MCP?</span>
-    </label>
     <div>
         <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
         <button cancel class="btn btn-sm btn-default border">Cancel</button>
     </div>
-</form>
+</form>

+ 14 - 37
resources/views/app/patient/prescriptions/list.blade.php

@@ -510,13 +510,21 @@ GROUP BY erx_category");
 
         ?>
 
+        var DEFAULTLOGISTICSDETAILS = {
+                facilityName: '{{ @$defaultFacility->name ?? '' }}',
+                facilityCity: '{{ @$defaultFacility->address_city ?? '' }}',
+                facilityState: '{{ @$defaultFacility->address_state ?? '' }}',
+                facilityAddressMemo: '',
+                facilityPhone: '{{ @$defaultFacility->phone ?? '' }}',
+                facilityFax: '{{ @$defaultFacility->fax ?? '' }}',
+                facilityZip: '{{ @$defaultFacility->address_zip ?? '' }}',
+            };
         function init() {
 
             window.eRxApp = new Vue({
                 el: '#prescriptions-{{$patient->id}}',
                 delimiters: ['@{{', '}}'],
                 data: {
-
                     includeCancelled: '',
 
                     prescriptions: <?= json_encode($prescriptions) ?>,
@@ -695,28 +703,12 @@ GROUP BY erx_category");
                     // for editing logistics - common
                     currentPrescriptionLogistics: {
                         uid: '',
-                        logisticsDetailJson: {
-                            facilityName: '',
-                            facilityCity: '',
-                            facilityState: '',
-                            facilityAddressMemo: '',
-                            facilityPhone: '',
-                            facilityFax: '',
-                            facilityZip: '',
-                        }
+                        logisticsDetailJson: DEFAULTLOGISTICSDETAILS
                     },
 
                     newPrescriptionLogistics: {
                         uid: '',
-                        logisticsDetailJson: {
-                            facilityName: '',
-                            facilityCity: '',
-                            facilityState: '',
-                            facilityAddressMemo: '',
-                            facilityPhone: '',
-                            facilityFax: '',
-                            facilityZip: '',
-                        }
+                        logisticsDetailJson: DEFAULTLOGISTICSDETAILS
                     },
 
                     // for editing hcp, sign, pro status & client status - common
@@ -847,18 +839,11 @@ GROUP BY erx_category");
                             }
                             this.newPrescriptionLogistics = {
                                 uid: '',
-                                logisticsDetailJson: {
-                                    facilityName: '',
-                                    facilityCity: '',
-                                    facilityState: '',
-                                    facilityAddressMemo: '',
-                                    facilityPhone: '',
-                                    facilityFax: '',
-                                    facilityZip: '',
-                                }
+                                logisticsDetailJson: DEFAULTLOGISTICSDETAILS
                             };
                             this.currentPrescriptionType = _type;
                             Vue.nextTick(() => {
+                                console.log({n: this.newPrescriptionLogistics, DEFAULTLOGISTICSDETAILS});
                                 showStagPopup('new-prescription-popup-' + _type, true);
                                 $('[stag-popup-key="new-prescription-popup-' + _type + '"] [stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
                                 initStagSuggest();
@@ -1163,15 +1148,7 @@ GROUP BY erx_category");
                         this.currentPrescriptionAction = 'EDIT_LOGISTICS';
                         this.currentPrescriptionLogistics = {
                             uid: _prescription.uid,
-                            logisticsDetailJson: _prescription.logistics_detail_json ? JSON.parse(JSON.stringify(_prescription.logistics_detail_json)) : {
-                                facilityName: '',
-                                facilityCity: '',
-                                facilityState: '',
-                                facilityAddressMemo: '',
-                                facilityPhone: '',
-                                facilityFax: '',
-                                facilityZip: '',
-                            }
+                            logisticsDetailJson: _prescription.logistics_detail_json ? JSON.parse(JSON.stringify(_prescription.logistics_detail_json)) : DEFAULTLOGISTICSDETAILS
                         }
                         Vue.nextTick(() => {
                             showStagPopup('logistics-popup', true);

+ 3 - 3
resources/views/app/patient/pros.blade.php

@@ -52,7 +52,7 @@
                                     <a href="" show start>Update Reason</a>
                                     <form action="" url="/api/clientProAccess/updateReason">
                                         <input type="hidden" value="{{$aPro['clientProAccess']->uid}}" name="uid">
-                                       
+
                                         <div class="form-group">
                                             <label for="" class="control-label">Reason category</label>
                                             <input type="text" name="reasonCategory" class="form-control input-sm" value="{{$aPro['clientProAccess']->reason_category}}">
@@ -71,7 +71,7 @@
                                     <a href="" show start>Remove</a>
                                     <form action="" url="/api/clientProAccess/deactivate">
                                         <input type="hidden" value="{{$aPro['clientProAccess']->uid}}" name="uid">
-                                    
+
                                         <div class="form-group">
                                             <label for="" class="control-label">Memo</label>
                                             <textarea name="deactivationMemo" class="form-control input-sm"></textarea>
@@ -92,7 +92,7 @@
                             @endif
                         @endif
                         @php $prevPro = $aPro['pro']; @endphp
-                    
+
                     </tr>
                 @endforeach
                 </tbody>

+ 0 - 24
resources/views/layouts/patient.blade.php

@@ -87,30 +87,6 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 					<li class="nav-item">
 						<a class="nav-link {{ strpos($routeName, 'patients.view.rtm') === 0 ? 'active' : '' }}" href="{{ route('patients.view.rtm', $patient) }}">RTM</a>
 					</li>
-					<?php /* <li class="nav-item">
-							<a class="nav-link d-flex align-items-center {{ strpos($routeName, 'patients.view.action-items') === 0 ? 'active' : '' }}"
-							   native onclick="return false">
-								<span class="text-dark">ERx/Orders</span>
-							</a>
-							<ul class="m-0 p-0 nav-child-list">
-								<li class="nav-item">
-									<a class="nav-link {{ strpos($routeName, 'patients.view.action-items-erx') === 0 ? 'active' : '' }}"
-									   href="{{ route('patients.view.action-items-erx', ['patient' => $patient]) }}">ERx</a>
-								</li>
-								<li class="nav-item">
-									<a class="nav-link {{ strpos($routeName, 'patients.view.action-items-lab') === 0 ? 'active' : '' }}"
-									   href="{{ route('patients.view.action-items-lab', ['patient' => $patient]) }}">Lab</a>
-								</li>
-								<li class="nav-item">
-									<a class="nav-link {{ strpos($routeName, 'patients.view.action-items-imaging') === 0 ? 'active' : '' }}"
-									   href="{{ route('patients.view.action-items-imaging', ['patient' => $patient]) }}">Imaging</a>
-								</li>
-								<li class="nav-item">
-									<a class="nav-link {{ strpos($routeName, 'patients.view.action-items-equipment') === 0 ? 'active' : '' }}"
-									   href="{{ route('patients.view.action-items-equipment', ['patient' => $patient]) }}">Equipment</a>
-								</li>
-							</ul>
-						</li> */ ?>
 					<li class="nav-item">
 						<a class="nav-link {{ strpos($routeName, 'patients.view.patient-prescriptions') === 0 ? 'active' : '' }}" href="{{ route('patients.view.patient-prescriptions', ['patient' => $patient]) }}">ERx &amp; Orders</a>
 						<?php /*

+ 2 - 2
yemi.js

@@ -513,7 +513,7 @@ var initMoes = function() {
                             hideMoeFormMask();
                             hideMask();
                             runMCHook(hook);
-                        } else if(isDynamicStagPopupPresent()) {
+                        } else if(typeof isDynamicStagPopupPresent !== 'undefined' && isDynamicStagPopupPresent()) {
                             let targetUrl = false;
                             if (redir) {
                                 if (redir.indexOf('[data]') > -1) {
@@ -565,7 +565,7 @@ var initMoes = function() {
                             hideMoeFormMask();
                             hideMask();
                             runMCHook(hook);
-                        } else if(isDynamicStagPopupPresent()) {
+                        } else if(typeof isDynamicStagPopupPresent !== 'undefined' && isDynamicStagPopupPresent()) {
                             let targetUrl = false;
                             if (redir) {
                                 if (redir.indexOf('[data]') > -1) {