mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 03:31:31 +00:00
resolved conflicts
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
if(!function_exists('sg_load')){$__v=phpversion();$__x=explode('.',$__v);$__v2=$__x[0].'.'.(int)$__x[1];$__u=strtolower(substr(php_uname(),0,3));$__ts=(@constant('PHP_ZTS') || @constant('ZEND_THREAD_SAFE')?'ts':'');$__f=$__f0='ixed.'.$__v2.$__ts.'.'.$__u;$__ff=$__ff0='ixed.'.$__v2.'.'.(int)$__x[2].$__ts.'.'.$__u;$__ed=@ini_get('extension_dir');$__e=$__e0=@realpath($__ed);$__dl=function_exists('dl') && function_exists('file_exists') && @ini_get('enable_dl') && !@ini_get('safe_mode');if($__dl && $__e && version_compare($__v,'5.2.5','<') && function_exists('getcwd') && function_exists('dirname')){$__d=$__d0=getcwd();if(@$__d[1]==':') {$__d=str_replace('\\','/',substr($__d,2));$__e=str_replace('\\','/',substr($__e,2));}$__e.=($__h=str_repeat('/..',substr_count($__e,'/')));$__f='/ixed/'.$__f0;$__ff='/ixed/'.$__ff0;while(!file_exists($__e.$__d.$__ff) && !file_exists($__e.$__d.$__f) && strlen($__d)>1){$__d=dirname($__d);}if(file_exists($__e.$__d.$__ff)) dl($__h.$__d.$__ff); else if(file_exists($__e.$__d.$__f)) dl($__h.$__d.$__f);}if(!function_exists('sg_load') && $__dl && $__e0){if(file_exists($__e0.'/'.$__ff0)) dl($__ff0); else if(file_exists($__e0.'/'.$__f0)) dl($__f0);}if(!function_exists('sg_load')){$__ixedurl='https://www.sourceguardian.com/loaders/download.php?php_v='.urlencode($__v).'&php_ts='.($__ts?'1':'0').'&php_is='.@constant('PHP_INT_SIZE').'&os_s='.urlencode(php_uname('s')).'&os_r='.urlencode(php_uname('r')).'&os_m='.urlencode(php_uname('m'));$__sapi=php_sapi_name();if(!$__e0) $__e0=$__ed;if(function_exists('php_ini_loaded_file')) $__ini=php_ini_loaded_file(); else $__ini='php.ini';if((substr($__sapi,0,3)=='cgi')||($__sapi=='cli')||($__sapi=='embed')){$__msg="\nPHP script '".__FILE__."' is protected by SourceGuardian and requires a SourceGuardian loader '".$__f0."' to be installed.\n\n1) Download the required loader '".$__f0."' from the SourceGuardian site: ".$__ixedurl."\n2) Install the loader to ";if(isset($__d0)){$__msg.=$__d0.DIRECTORY_SEPARATOR.'ixed';}else{$__msg.=$__e0;if(!$__dl){$__msg.="\n3) Edit ".$__ini." and add 'extension=".$__f0."' directive";}}$__msg.="\n\n";}else{$__msg="<html><body>PHP script '".__FILE__."' is protected by <a href=\"https://www.sourceguardian.com/\">SourceGuardian</a> and requires a SourceGuardian loader '".$__f0."' to be installed.<br><br>1) <a href=\"".$__ixedurl."\" target=\"_blank\">Click here</a> to download the required '".$__f0."' loader from the SourceGuardian site<br>2) Install the loader to ";if(isset($__d0)){$__msg.=$__d0.DIRECTORY_SEPARATOR.'ixed';}else{$__msg.=$__e0;if(!$__dl){$__msg.="<br>3) Edit ".$__ini." and add 'extension=".$__f0."' directive<br>4) Restart the web server";}}$__msg.="</body></html>";}die($__msg);exit();}}return sg_load('86EF549DC7C503B9AAQAAAAiAAAABMgAAACABAAAAAAAAAD/67Si1ByIJvL0RNign5p0t8jOATgMS+G44WO7/HU/eMUXpM4VCzAn/C74ShPqfBNp0gng97Ycc1UrDASo7WsFA8+lM8duTxpb8Rz39l2bC6G+ANqRrqjxAN2+kaqudtQn81QNB60U+nhdBPUaDW455QBBy0Ao2vI0zKQ0TZP3IXwVvZLd7gJ9yW13HjvdcoDwQOFz9fe2GgFBSJrrWSgONSaOyUFZvqQjd4dlWe6N0Tv3CqHmlyLioREFVBEXul0xfyOczzPOJJVSAAAAOAEAAIibdzkHvbXRGbS7TuTaEPacr1Zy/N7KvJtf/uct6L9ACmhYSlIjVzrK3ohhnpi8wNcTeNIjzrBd9DHpR8yNZuTj43iLtCCxLO1SpOwT+q/WHBmg3UrjIWG4SNc9TZzfJeSqTdzwoe/WVLo+x32kP8qSvDZLqvyiZWUVgRluIhrhN99InKjPXhwTVzVwbpBEAIyrRGcFaazBExHwRaAEsqYHuOx8ySFk5ORWyy/MkjHvTuM5sjbgO4hCAQSSUdcMYW6J2Vi08hZus7S+Idw6PGd2SAvfh1Y9WP49AioSLxfU0vfFEdsrWZ8M18vdNqmyQQiiUy/wuPROTmt+mKAkqe984U4d6NfeUbvISqfJvfEYjad/5ccm0aAvu5ay2WOHXj1R3zApI2XqcaVjIB99gKORrM1wVOBE8QAAAAA=');
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Services\WardManagement;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Streamline\Exceptions\ModelNotFoundException;
|
||||
use Streamline\Models\Drug;
|
||||
use Streamline\Models\WardTreatmentDispensation;
|
||||
|
||||
class WardTreatmentDispensationService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function saveDispensation(int $patient_id, int $episode_id, int $drug_id, int $quantity_given,
|
||||
int $ward_treatment_id, int $ward_id, $batch_id = null): bool|int
|
||||
{
|
||||
$drug_details = Drug::find($drug_id);
|
||||
|
||||
if (!$drug_details) {
|
||||
throw new ModelNotFoundException("Drug not found: ${$drug_id}");
|
||||
}
|
||||
|
||||
$drug_exists = WardTreatmentDispensation::where('episode_id', $episode_id)
|
||||
->where('drug_id', $drug_id)->first();
|
||||
|
||||
if (!$drug_exists) {
|
||||
$ward_treatments_dispensation = new WardTreatmentDispensation;
|
||||
$ward_treatments_dispensation->patient_id = $patient_id;
|
||||
$ward_treatments_dispensation->episode_id = $episode_id;
|
||||
$ward_treatments_dispensation->drug_id = $drug_id;
|
||||
$ward_treatments_dispensation->quantity_given = $quantity_given;
|
||||
$ward_treatments_dispensation->ward_treatment_id = $ward_treatment_id;
|
||||
$ward_treatments_dispensation->ward_id = $ward_id;
|
||||
$ward_treatments_dispensation->current_chart_of_account = $drug_details->account_id;
|
||||
$ward_treatments_dispensation->cost_price = $drug_details->cost_price;
|
||||
$ward_treatments_dispensation->inventory_account = $drug_details->inventory_account;
|
||||
$ward_treatments_dispensation->cost_of_goods_account = $drug_details->cost_of_goods_account;
|
||||
$ward_treatments_dispensation->batch_id = $batch_id;
|
||||
|
||||
if(patient_insurance_status($patient_id) == 1){
|
||||
$drug_insurance_details = get_item_insurance_pricing($patient_id, $drug_id, 4, true, $ward_id);
|
||||
$drug_selling_price = $drug_insurance_details[2];
|
||||
$ward_treatments_dispensation->chi_price = $drug_insurance_details[1];
|
||||
} else {
|
||||
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
|
||||
if ($price_list_id) {
|
||||
$drug_selling_price = get_price_list_category_price($price_list_id, 3, $drug_id);
|
||||
} else {
|
||||
$drug_selling_price = $drug_details->non_insured_price;
|
||||
}
|
||||
}
|
||||
|
||||
$ward_treatments_dispensation->price = $drug_selling_price;
|
||||
$ward_treatments_dispensation->created_by = Auth::id();
|
||||
$dispensation_history = [[
|
||||
'entered_at' => Carbon::now()->toDateTimeString(),
|
||||
'entered_by' => Auth::id()
|
||||
]];
|
||||
$ward_treatments_dispensation->dispensation_history = json_encode($dispensation_history);
|
||||
} else {
|
||||
$ward_treatments_dispensation = $drug_exists;
|
||||
$ward_treatments_dispensation->quantity_given = $ward_treatments_dispensation->quantity_given + $quantity_given;
|
||||
$ward_treatments_dispensation->updated_by = Auth::id();
|
||||
|
||||
$dispensation_history = json_decode($ward_treatments_dispensation->dispensation_history, true);
|
||||
|
||||
if (is_null($ward_treatments_dispensation->dispensation_history)) {
|
||||
$dispensation_history[] = [
|
||||
'entered_at' => $ward_treatments_dispensation->created_at->toDateTimeString(),
|
||||
'entered_by' => $ward_treatments_dispensation->created_by,
|
||||
];
|
||||
}
|
||||
|
||||
$dispensation_history[] = [
|
||||
'entered_at' => Carbon::now()->toDateTimeString(),
|
||||
'entered_by' => Auth::id(),
|
||||
];
|
||||
$ward_treatments_dispensation->dispensation_history = json_encode($dispensation_history);
|
||||
}
|
||||
|
||||
if ($ward_treatments_dispensation->save()) {
|
||||
return $ward_treatments_dispensation->id;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user