server
parent
b05fd0aa27
commit
f694841a9c
|
|
@ -115,7 +115,7 @@ class PatientRecordController extends AdminController
|
|||
amisMake()->SelectControl()->options($this->getAdminUserOptions())->searchable()->name('notify_user_id')->label(__('patient-record.notify_user_id')),
|
||||
amisMake()->DateControl()->name('notify_at')->label(__('patient-record.notify_at')),
|
||||
// amisMake()->TextControl()->name('notify_remarks')->label(__('patient-record.notify_remarks')),
|
||||
amisMake()->TextControl()->label(__('patient-record.creator_id'))->name('creator_id')->value($this->user()->name)->readonly(),
|
||||
// amisMake()->TextControl()->label(__('patient-record.creator_id'))->name('creator_id')->value($this->user()->name)->readonly(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -143,8 +143,10 @@ class PatientRecordController extends AdminController
|
|||
['label' => __('patient-record.saler_ratio'), 'content' => '${saler_ratio}'],
|
||||
['label' => __('patient-record.saler_money'), 'content' => '${saler_money}'],
|
||||
|
||||
['label' => __('patient-record.content'), 'content' => amisMake()->TextareaControl()->name('content')->static(), 'span' => 3],
|
||||
['label' => __('patient-record.images'), 'content' => amisMake()->Images()->source('${images}'), 'span' => 3],
|
||||
['label' => __('patient-record.illness_type_id'), 'content' => '${illness_type.name}', 'span' => 3],
|
||||
|
||||
['label' => __('patient-record.content'), 'content' => amisMake()->Tpl()->tpl('${content | raw}'), 'span' => 3],
|
||||
['label' => __('patient-record.images'), 'content' => amisMake()->Images()->source('${images}')->defaultImage(null), 'span' => 3],
|
||||
|
||||
['label' => __('patient-record.next_treat_at'), 'content' => '${next_treat_at}'],
|
||||
['label' => __('patient-record.is_notified'), 'content' => amisMake()->Status()->value('${is_notified}')->source([
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Admin\Services\TotalIllnessTypeService;
|
|||
use App\Models\Keyword;
|
||||
use App\Models\PatientRecord;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Support\Excel\AdminExport;
|
||||
|
||||
/**
|
||||
* 病种统计
|
||||
|
|
@ -22,7 +23,9 @@ class TotalIllnessTypeController extends AdminController
|
|||
->filterTogglable(false)
|
||||
->columnsTogglable(false)
|
||||
->alwaysShowPagination()
|
||||
->headerToolbar([])
|
||||
->headerToolbar([
|
||||
$this->exportAction(),
|
||||
])
|
||||
->filter($this->baseFilter()->actions()->body([
|
||||
amisMake()->SelectControl()->options($this->getIllness())->name('id')->label(__('total-illness-type.id'))->size('md')->clearable(),
|
||||
amisMake()->DateRangeControl()->name('treat_range')->label(__('total-illness-type.treat_at'))->clearable()->size('md'),
|
||||
|
|
@ -50,4 +53,68 @@ class TotalIllnessTypeController extends AdminController
|
|||
|
||||
return $this->illness;
|
||||
}
|
||||
protected function exportAction($disableSelectedItem = false)
|
||||
{
|
||||
$event = fn($script) => ['click' => ['actions' => [['actionType' => 'custom', 'script' => $script]]]];
|
||||
$downloadPath = '/' . admin_url('_download_export', true);
|
||||
$exportPath = $this->getExportPath();
|
||||
$doAction = <<<JS
|
||||
doAction([
|
||||
{ actionType: "ajax", args: { api: { url: url.toString(), method: "get" } } },
|
||||
{
|
||||
actionType: "custom",
|
||||
expression: "\${event.data.responseResult.responseStatus === 0}",
|
||||
script: "window.open('{$downloadPath}?path='+event.data.responseResult.responseData.path)"
|
||||
}
|
||||
])
|
||||
JS;
|
||||
$buttons = [
|
||||
amisMake()->VanillaAction()->label(__('admin.export.all'))->onEvent(
|
||||
$event(<<<JS
|
||||
let url = new URL("{$exportPath}", window.location.origin)
|
||||
let param = window.location.href.split('?')[1]
|
||||
if (param) {
|
||||
url = url + '&' + param
|
||||
}
|
||||
{$doAction}
|
||||
JS
|
||||
|
||||
)
|
||||
),
|
||||
];
|
||||
return amisMake()
|
||||
->DropdownButton()
|
||||
->label(__('admin.export.title'))
|
||||
->set('icon', 'fa-solid fa-download')
|
||||
->buttons($buttons)
|
||||
->align('right')
|
||||
->closeOnClick();
|
||||
}
|
||||
|
||||
protected function export()
|
||||
{
|
||||
// 默认在 storage/app/ 下
|
||||
$path = sprintf('%s-%s.xlsx', $this->exportFileName(), date('YmdHis'));
|
||||
|
||||
// 导出本页和导出选中项都是通过 _ids 查询
|
||||
$ids = request()->input('_ids');
|
||||
|
||||
// listQuery() 为列表查询条件,与获取列表数据一致
|
||||
$query = $this->service->listQuery()
|
||||
->when($ids, fn($query) => $query->whereIn($this->service->primaryKey(), explode(',', $ids)));
|
||||
|
||||
// 此处使用 laravel-excel 导出,可自行修改
|
||||
AdminExport::make($query)
|
||||
->setHeadings([
|
||||
__('total-illness-type.id'),
|
||||
__('total-illness-type.count'),
|
||||
])
|
||||
->setMap(fn($row) => [
|
||||
$row->name,
|
||||
$row->illnessTypeRecords->count()
|
||||
])
|
||||
->store($path);
|
||||
|
||||
return $this->response()->success(compact('path'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|||
use App\Models\{Keyword, Patient, PatientRecord};
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Admin\Services\TotalPatientService;
|
||||
use Slowlyo\OwlAdmin\Support\Excel\AdminExport;
|
||||
|
||||
/**
|
||||
* 客户统计
|
||||
|
|
@ -24,7 +25,9 @@ class TotalPatientController extends AdminController
|
|||
->filterTogglable(false)
|
||||
->columnsTogglable(false)
|
||||
->alwaysShowPagination()
|
||||
->headerToolbar([])
|
||||
->headerToolbar([
|
||||
$this->exportAction(),
|
||||
])
|
||||
->filter($this->baseFilter()->actions()->body([
|
||||
amisMake()->SelectControl()->options($this->getPatientOptions())->searchable()->name('id')->label(__('total-record.name'))->size('md')->clearable(),
|
||||
amisMake()->SelectControl()->options($this->getTypeOptions())->name('type_id')->label(__('patient-record.type_id'))->size('md')->clearable(),
|
||||
|
|
@ -66,5 +69,77 @@ class TotalPatientController extends AdminController
|
|||
|
||||
return $this->typeOptions;
|
||||
}
|
||||
|
||||
protected function exportAction($disableSelectedItem = false)
|
||||
{
|
||||
$event = fn($script) => ['click' => ['actions' => [['actionType' => 'custom', 'script' => $script]]]];
|
||||
$downloadPath = '/' . admin_url('_download_export', true);
|
||||
$exportPath = $this->getExportPath();
|
||||
$doAction = <<<JS
|
||||
doAction([
|
||||
{ actionType: "ajax", args: { api: { url: url.toString(), method: "get" } } },
|
||||
{
|
||||
actionType: "custom",
|
||||
expression: "\${event.data.responseResult.responseStatus === 0}",
|
||||
script: "window.open('{$downloadPath}?path='+event.data.responseResult.responseData.path)"
|
||||
}
|
||||
])
|
||||
JS;
|
||||
$buttons = [
|
||||
amisMake()->VanillaAction()->label(__('admin.export.all'))->onEvent(
|
||||
$event(<<<JS
|
||||
let url = new URL("{$exportPath}", window.location.origin)
|
||||
let param = window.location.href.split('?')[1]
|
||||
if (param) {
|
||||
url = url + '&' + param
|
||||
}
|
||||
{$doAction}
|
||||
JS
|
||||
|
||||
)
|
||||
),
|
||||
];
|
||||
return amisMake()
|
||||
->DropdownButton()
|
||||
->label(__('admin.export.title'))
|
||||
->set('icon', 'fa-solid fa-download')
|
||||
->buttons($buttons)
|
||||
->align('right')
|
||||
->closeOnClick();
|
||||
}
|
||||
|
||||
protected function export()
|
||||
{
|
||||
// 默认在 storage/app/ 下
|
||||
$path = sprintf('%s-%s.xlsx', $this->exportFileName(), date('YmdHis'));
|
||||
|
||||
// 导出本页和导出选中项都是通过 _ids 查询
|
||||
$ids = request()->input('_ids');
|
||||
|
||||
// listQuery() 为列表查询条件,与获取列表数据一致
|
||||
$query = $this->service->listQuery()
|
||||
->when($ids, fn($query) => $query->whereIn($this->service->primaryKey(), explode(',', $ids)));
|
||||
|
||||
// 此处使用 laravel-excel 导出,可自行修改
|
||||
AdminExport::make($query)
|
||||
->setHeadings([
|
||||
__('total-record.name'),
|
||||
__('total-record.type_id'),
|
||||
__('total-record.records_count'),
|
||||
__('total-record.origin_price'),
|
||||
__('total-record.sell_price'),
|
||||
])
|
||||
->setMap(fn($row) => [
|
||||
$row->name,
|
||||
$row->type?->name,
|
||||
$row->records->count(),
|
||||
round($row->records->sum('sell_price'), 2, PHP_ROUND_HALF_DOWN),
|
||||
round($row->records->sum('origin_price'), 2, PHP_ROUND_HALF_DOWN),
|
||||
])
|
||||
->store($path);
|
||||
|
||||
return $this->response()->success(compact('path'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Admin\Services\TotalProfitService;
|
|||
use App\Models\Keyword;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Services\AdminUserService;
|
||||
use Slowlyo\OwlAdmin\Support\Excel\AdminExport;
|
||||
|
||||
/**
|
||||
* 提成统计
|
||||
|
|
@ -24,7 +25,9 @@ class TotalProfitController extends AdminController
|
|||
->filterTogglable(false)
|
||||
->columnsTogglable(false)
|
||||
->alwaysShowPagination()
|
||||
->headerToolbar([])
|
||||
->headerToolbar([
|
||||
$this->exportAction(),
|
||||
])
|
||||
->filter($this->baseFilter()->actions()->body([
|
||||
amisMake()->SelectControl()->options($this->getAdminUserOptions())->searchable()->name('id')->label(__('total-profit.id'))->clearable()->size('md'),
|
||||
amisMake()->SelectControl()->options($this->getTypeOptions())->name('type_id')->label(__('total-profit.type_id'))->size('md')->clearable(),
|
||||
|
|
@ -38,6 +41,7 @@ class TotalProfitController extends AdminController
|
|||
amisMake()->Column()->name('doctor_money')->label(__('total-profit.doctor_money')),
|
||||
amisMake()->Column()->name('inviter_money')->label(__('total-profit.inviter_money')),
|
||||
amisMake()->Column()->name('saler_money')->label(__('total-profit.saler_money')),
|
||||
amisMake()->Column()->name('total_money')->label(__('total-profit.total_money')),
|
||||
])
|
||||
->affixRowClassName('text-info-dk')
|
||||
->affixRow([
|
||||
|
|
@ -46,6 +50,7 @@ class TotalProfitController extends AdminController
|
|||
['type' => 'text', 'text' => __('total-profit.doctor_money'). ': ${doctor_money}'],
|
||||
['type' => 'text', 'text' => __('total-profit.inviter_money'). ': ${inviter_money}'],
|
||||
['type' => 'text', 'text' => __('total-profit.saler_money'). ': ${saler_money}'],
|
||||
['type' => 'text', 'text' => __('total-profit.total_money'). ': ${total_money}'],
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -68,4 +73,84 @@ class TotalProfitController extends AdminController
|
|||
|
||||
return $this->typeOptions;
|
||||
}
|
||||
|
||||
protected function exportAction($disableSelectedItem = false)
|
||||
{
|
||||
$event = fn($script) => ['click' => ['actions' => [['actionType' => 'custom', 'script' => $script]]]];
|
||||
$downloadPath = '/' . admin_url('_download_export', true);
|
||||
$exportPath = $this->getExportPath();
|
||||
$doAction = <<<JS
|
||||
doAction([
|
||||
{ actionType: "ajax", args: { api: { url: url.toString(), method: "get" } } },
|
||||
{
|
||||
actionType: "custom",
|
||||
expression: "\${event.data.responseResult.responseStatus === 0}",
|
||||
script: "window.open('{$downloadPath}?path='+event.data.responseResult.responseData.path)"
|
||||
}
|
||||
])
|
||||
JS;
|
||||
$buttons = [
|
||||
amisMake()->VanillaAction()->label(__('admin.export.all'))->onEvent(
|
||||
$event(<<<JS
|
||||
let url = new URL("{$exportPath}", window.location.origin)
|
||||
let param = window.location.href.split('?')[1]
|
||||
if (param) {
|
||||
url = url + '&' + param
|
||||
}
|
||||
{$doAction}
|
||||
JS
|
||||
|
||||
)
|
||||
),
|
||||
];
|
||||
return amisMake()
|
||||
->DropdownButton()
|
||||
->label(__('admin.export.title'))
|
||||
->set('icon', 'fa-solid fa-download')
|
||||
->buttons($buttons)
|
||||
->align('right')
|
||||
->closeOnClick();
|
||||
}
|
||||
|
||||
protected function export()
|
||||
{
|
||||
// 默认在 storage/app/ 下
|
||||
$path = sprintf('%s-%s.xlsx', $this->exportFileName(), date('YmdHis'));
|
||||
|
||||
// 导出本页和导出选中项都是通过 _ids 查询
|
||||
$ids = request()->input('_ids');
|
||||
|
||||
// listQuery() 为列表查询条件,与获取列表数据一致
|
||||
$query = $this->service->listQuery()
|
||||
->when($ids, fn($query) => $query->whereIn($this->service->primaryKey(), explode(',', $ids)));
|
||||
|
||||
// 此处使用 laravel-excel 导出,可自行修改
|
||||
AdminExport::make($query)
|
||||
->setHeadings([
|
||||
__('total-profit.id'),
|
||||
__('total-profit.records_count'),
|
||||
__('total-profit.doctor_money'),
|
||||
__('total-profit.inviter_money'),
|
||||
__('total-profit.saler_money'),
|
||||
__('total-profit.total_money'),
|
||||
])
|
||||
->setMap(function ($item) {
|
||||
$doctor_money = round($item->doctors->sum('doctor_money'), 2, PHP_ROUND_HALF_DOWN);
|
||||
$inviter_money = round($item->inviters->sum('inviter_money'), 2, PHP_ROUND_HALF_DOWN);
|
||||
$saler_money = round($item->salers->sum('saler_money'), 2, PHP_ROUND_HALF_DOWN);
|
||||
$records_count = floor($item->doctors->count() + $item->inviters->count() + $item->salers->count());
|
||||
$total_money = round($doctor_money + $inviter_money + $saler_money, 2, PHP_ROUND_HALF_DOWN);
|
||||
return [
|
||||
$item->name,
|
||||
$records_count,
|
||||
$doctor_money,
|
||||
$inviter_money,
|
||||
$saler_money,
|
||||
$total_money,
|
||||
];
|
||||
})
|
||||
->store($path);
|
||||
|
||||
return $this->response()->success(compact('path'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class TotalProfitService extends BaseService
|
|||
$item['inviter_money'] = round($item->inviters->sum('inviter_money'), 2, PHP_ROUND_HALF_DOWN);
|
||||
$item['saler_money'] = round($item->salers->sum('saler_money'), 2, PHP_ROUND_HALF_DOWN);
|
||||
$item['records_count'] = floor($item->doctors->count() + $item->inviters->count() + $item->salers->count());
|
||||
$item['total_money'] = round($item['doctor_money'] + $item['inviter_money'] + $item['saler_money'], 2, PHP_ROUND_HALF_DOWN);
|
||||
return $item;
|
||||
});
|
||||
$allList = (clone $query)->get();
|
||||
|
|
@ -55,10 +56,11 @@ class TotalProfitService extends BaseService
|
|||
$doctor_money = round($allList->sum(fn ($item) => $item->doctors->sum('doctor_money')), 2, PHP_ROUND_HALF_DOWN);
|
||||
$inviter_money = round($allList->sum(fn ($item) => $item->inviters->sum('inviter_money')), 2, PHP_ROUND_HALF_DOWN);
|
||||
$saler_money = round($allList->sum(fn ($item) => $item->salers->sum('saler_money')), 2, PHP_ROUND_HALF_DOWN);
|
||||
$total_money = round($allList->sum(fn ($item) => $item->salers->sum('saler_money') + $item->inviters->sum('inviter_money') + $item->doctors->sum('doctor_money')), 2, PHP_ROUND_HALF_DOWN);
|
||||
$total = $list->total();
|
||||
|
||||
$this->sortable($query);
|
||||
|
||||
return compact('items', 'total', 'records_count', 'doctor_money', 'inviter_money', 'saler_money');
|
||||
return compact('items', 'total', 'records_count', 'doctor_money', 'inviter_money', 'saler_money', 'total_money');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>宝芝堂</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel="stylesheet" href="/h5/static/index.5841170f.css"/><script defer="defer" src="/h5/static/js/chunk-vendors.7eabb1da.js"></script><script defer="defer" src="/h5/static/js/index.2acbe9ee.js"></script></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel="stylesheet" href="/h5/static/index.5841170f.css"/><script defer="defer" src="/h5/static/js/chunk-vendors.7eabb1da.js"></script><script defer="defer" src="/h5/static/js/index.db70b582.js"></script></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
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
Loading…
Reference in New Issue