liyinglin 2 years ago
parent ea461a5e68
commit 19ac21a543

@ -0,0 +1,61 @@
<?php
namespace App\Forms;
use App\Models\Project;
use Kris\LaravelFormBuilder\Form;
use Kris\LaravelFormBuilder\Field;
class AskSubmitForm extends Form
{
public function buildForm()
{
$this->add("name", Field::TEXT, ["label" => "名称", "rules" => "required"]);
$this->add("project_id", Field::HIDDEN, ["label" => "所属项目/医院", "rules" => "required"]);
$this->add("poster", Field::TEXT, ["label" => "产品图标", "attr" => ["data-plugin" => "uploader"]]);
// $this->add("profile", Field::TEXT, ["label" => "简介"]);
$this->add("fee_type", Field::SELECT, ["label" => "管理费模式", "choices" => [
"factor" => "按产品型号",
"patient_quantity" => "按陪护数量",
"price_level" => "按价格阶梯"
]]);
$this->add('productItems', 'collection', [
'type' => 'form',
'label' => "产品定价",
'options' => [
'class' => 'App\Forms\ProductItemForm',
'label' => false
]
]);
$this->add('productParamedicLevels', 'collection', [
'type' => 'form',
'label' => "护工级别价格因素",
'options' => [
'class' => 'App\Forms\ProductParamedicLevelForm',
'label' => false
]
]);
$this->add("factors", Field::STATIC, ["label" => "产品型号"]);
$this->add('productFeeLevels', 'collection', [
'type' => 'form',
'label' => "管理费阶梯",
'options' => [
'class' => 'App\Forms\ProductFeeLevelForm',
'label' => false
]
]);
$this->add('lastdayCheckoutRules', 'collection', [
'type' => 'form',
'label' => "出院日结算规则",
'options' => [
'class' => 'App\Forms\LastdayCheckoutRuleForm',
'label' => false
]
]);
$this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [
["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]],
["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]]
]]);
}
}

@ -0,0 +1,79 @@
<?php
/**
* Created by PhpStorm.
* User: weizongsong
* Date: 2019-04-12
* Time: 22:34
*/
namespace App\Http\Controllers\Admin;
use App\Admin;
use App\Events\ProjectSaved;
use App\Exports\CommonExport;
use App\Forms\AskSubmitForm;
use App\Forms\ProjectForm;
use App\Models\AdminAreaLink;
use App\Models\Area;
use App\Models\AskSubmit;
use App\Models\Bed;
use App\Models\Building;
use App\Models\ParamedicLevel;
use App\Models\Project;
use App\Models\Room;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Kris\LaravelFormBuilder\FormBuilder;
use Maatwebsite\Excel\Facades\Excel;
use Spatie\Permission\Models\Role;
class AskSubmitController extends CommonController
{
public $bladePath = "admin.project";
public $urlPrefix = "admin/project";
public $modelName = "满意度调查";
public $modelClass = AskSubmit::class;
public $formClass = AskSubmitForm::class;
public function index(Request $request)
{
$userId = auth()->id();
// 判断是否护士长
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
$data = AskSubmit::with("admin", "project")
->where(function ($qeury) use ($hushizhang, $userId) {
if ($hushizhang) {
$qeury->where('admin_id', $userId);
}
})->paginate(10);
return view($this->bladePath . ".index", compact("data"));
}
public function edit($id = null, Request $request, FormBuilder $formBuilder)
{
$vo = (new Project())->with("paramedicLevels")->find($id ?: $request->id);
$form = $formBuilder->create($this->formClass, [
"method" => "POST",
"id" => "fm",
"url" => url($this->urlPrefix . "/update/" . $vo->id),
"class" => "form form-horizontal validate-form",
"model" => $vo
]);
$form->add("_previous", "hidden", ["value" => (url()->previous())]);
return view($this->bladePath . ".create", compact("form"));
}
public function updated($model)
{
event(new ProjectSaved($model));
}
}

@ -280,27 +280,4 @@ class ProjectController extends CommonController
return Excel::download(new CommonExport($data), "beds.xlsx");
}
/**
* 满意度调查
*/
public function askSubmit()
{
$userId = auth()->id();
// 判断是否护士长
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
$data = AskSubmit::with("admin", "project")
->where(function ($qeury) use ($hushizhang, $userId) {
if ($hushizhang) {
$qeury->where('admin_id', $userId);
}
})->paginate(10);
return view($this->bladePath . ".ask_submit", compact("data"));
}
}

@ -0,0 +1,114 @@
@extends("admin.layouts.layout")
@php
$pageTitle = __("actions.".last(explode("/",request()->url()))).$modelName;
@endphp
@section("content")
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
{!! form_start($form) !!}
@foreach($form->getFields() as $field)
{!! form_row($form->{$field->getName()},isset($vo[$field->getName()]) ? ["value"=>$vo[$field->getName()],"selected"=>$vo[$field->getName()]] : []) !!}
@if($field->getName()=="address")
<div class="mapimg" id="mapimg-box" style="position: relative">
<img style="position: absolute;top: 43%;left: 53%;transform: translate(-50%, -50%);z-index: 1;"
src="https://3gimg.qq.com/lightmap/api_v2/2/4/117/theme/default/imgs/marker.png"
alt="">
<div id="mapcontainer" style="height:200px; width: 100%;"></div>
</div>
@endif
@endforeach
{!!form_end($form)!!}
</div>
</div>
</div>
</div>
@endsection
@push("footer")
<script type="text/javascript"
src="https://map.qq.com/api/js?v=2.exp&key=D3HBZ-RAMHJ-KFHFR-KLK5H-OGWJ7-RNB63"></script>
<script>
function uploaderCallback(file, data, index) {
$('input[data-uploader-index=' + index + ']').val("/storage/" + (data.folder ? data.folder + "/" : "") + data.name);
return true;
}
$(function () {
if ($("#address").length) {
var mapimgBox = $("#mapimg-box");
$("#address").before(mapimgBox.clone());
mapimgBox.remove();
initMap();
$("#mapcontainer").bind("DOMNodeInserted", function (e) {
var tempCount = 0;
$("#mapcontainer .smnoprint").siblings().each(function () {
tempCount++;
if (tempCount == 2 || tempCount == 3) {
$(this).remove();
}
});
});
$("#address").blur(codeAddress);
}
});
var citylocation, map, geocoder = null;
var initMap = function () {
var latitude = $("input[name=latitude]").val();
var longitude = $("input[name=longitude]").val();
map = new qq.maps.Map(document.getElementById('mapcontainer'), {
// center: center,
zoom: 16,
});
if (latitude != "" && longitude != "") {
var center = new qq.maps.LatLng(latitude, longitude);
} else {
var center = new qq.maps.LatLng(31.835727, 119.905098);
}
map.panTo(center);
qq.maps.event.addListener(map, 'dragend', function () {
//地图移动停止后 获取经纬度
$('#latitude').val(map.getCenter().lat);
$('#longitude').val(map.getCenter().lng);
var coord = new qq.maps.LatLng(map.getCenter().lat, map.getCenter().lng);
geocoder.getAddress(coord);
});
//获取城市列表接口设置中心点
citylocation = new qq.maps.CityService({
complete: function (result) {
map.setCenter(result.detail.latLng);
}
});
//调用地址解析类
geocoder = new qq.maps.Geocoder({
complete: function (result) {
map.setCenter(result.detail.location);
//请求成功后 给经纬度赋值
$('#address').val(result.detail.address);
$('input[name=latitude]').val(result.detail.location.lat);
$('input[name=longitude]').val(result.detail.location.lng);
}
});
//调用searchLocalCity();方法 根据用户IP查询城市信息。
if (latitude == "" && longitude == "") {
citylocation.searchLocalCity();
}
};
function codeAddress() {
var address = $("#address").val();
//通过getLocation();方法获取位置信息值
if (address != "") {
geocoder.getLocation(address);
} else {
$.NotificationApp.send("提示", "请输入地址以查询坐标!", 'top-center', '#ffbc00', 'warning');
}
}
</script>
@endpush

@ -45,6 +45,11 @@ Route::group(["namespace" => "Admin", "prefix" => "admin"], function () {
Route::get("project/get-subs", 'ProjectController@getSubs');
Route::post("project/create-sub", 'ProjectController@createSub');
Route::get("project/get-head", 'ProjectController@getHeadList');
Route::post("project/ask_submit_create", 'ProjectController@askSubmitCreate');
// 满意度调查
\App\Models\CommonModel::generateCurdRouter("AskSubmitController", "ask_submit");
Route::post("project/edit-department", 'ProjectController@editDepartment');
Route::post("project/delete-department", 'ProjectController@deleteDepartment');

Loading…
Cancel
Save