This commit is contained in:
2024-07-18 16:47:11 +08:00
parent 4cf74c6efd
commit fb5f583da5
12 changed files with 442 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
namespace app\admin\controller;
use app\common\controller\Backend;
use think\Db;
/**
* 疼痛科病历报告(听译问诊)
@@ -34,4 +35,55 @@ class Ttmedicalreport extends Backend
*/
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
//查询随访记录
$followup = Db::table('fa_tt_followup')->where('report_dataid', $row['id'])->select();
$this->view->assign('follow_record', $followup);
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace app\admin\controller\tt;
use app\common\controller\Backend;
use think\Db;
use wanghua\general_utility_tools_php\Mmodel;
use wanghua\general_utility_tools_php\tool\Tools;
/**
* 疼痛科随访记录
*
* @icon fa fa-circle-o
*/
class Followup extends Backend
{
/**
* Followup模型对象
* @var \app\admin\model\tt\Followup
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\tt\Followup;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 添加页面
*
* @return string
* @throws \think\Exception
*/
public function addfollowup()
{
//报告数据id
$report_dataid = input('report_dataid');
$report = Db::table('fa_tt_medical_report')->where('id',$report_dataid)->find();
//$user = Db::table('fa_tt_users')->where('username',$report['username'])->find();
$userbaseinfo = Db::table('fa_tt_userbaseinfo')->where('id',$report['id'])->find();
$this->assign('user',$userbaseinfo);
$html = view('add')->getContent();
return json(Tools::set_ok('ok',$html));
}
function submitfollowup(){
return Mmodel::catchJson(function (){
$content = input('content');
if(empty($content)){
return Tools::set_fail( '请填写随访内容');
}
$report_dataid = input('report_dataid');
if(empty($report_dataid)){
return Tools::set_fail( '请选择诊断报告');
}
$data = [
'report_dataid'=>$report_dataid,
'content'=>$content,
'create_time'=>date('Y-m-d H:i:s')
];
Db::table('fa_tt_followup')->insert($data);
return Tools::set_ok('添加成功');
});
}
//function getfollowup(){
//
// //设置过滤方法
// //$this->request->filter(['strip_tags', 'trim']);
// //if (false === $this->request->isAjax()) {
// // return $this->view->fetch();
// //}
// ////如果发送的来源是 Selectpage则转发到 Selectpage
// //if ($this->request->request('keyField')) {
// // return $this->selectpage();
// //}
// //[$where, $sort, $order, $offset, $limit] = $this->buildparams();
// //$list = $this->model
// // ->where($where)
// // ->order($sort, $order)
// // ->paginate($limit);
// //$result = ['total' => $list->total(), 'rows' => $list->items()];
// //return json($result);
//
// //报告数据id
// $report_dataid = input('report_dataid');
// $report = Db::table('fa_tt_followup')->where('id',$report_dataid)->select();
//
// $this->assign('rows',$report);
// $html = view('index')->getContent();
// return json(Tools::set_ok('ok',$html));
//}
}

View File

@@ -0,0 +1,9 @@
<?php
return [
'Id' => 'ID',
'Name' => '姓名',
'Phone' => '电话',
'Content' => '随访内容',
'Create_time' => '随访时间'
];

View File

@@ -0,0 +1,40 @@
<?php
namespace app\admin\model\tt;
use think\Model;
class Followup extends Model
{
// 表名
protected $name = 'tt_followup';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\tt;
use think\Validate;
class Followup extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@@ -0,0 +1,33 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{:isset($user)?$user['name']:''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-phone" class="form-control" name="row[phone]" type="text" value="{:isset($user)?$user['phone']:''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-create_time" readonly class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,33 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-phone" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:$row.create_time?datetime($row.create_time):''}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,29 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('tt/followup/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('tt/followup/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('tt/followup/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('tt/followup/edit')}"
data-operate-del="{:$auth->check('tt/followup/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,11 +1,11 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Doctor')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-doctor" class="form-control" name="row[doctor]" type="text" value="{$row.doctor|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Doctor')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-doctor" class="form-control" name="row[doctor]" type="text" value="{$row.doctor|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
<div class="col-xs-12 col-sm-8">
@@ -24,13 +24,23 @@
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:$row.create_time?datetime($row.create_time):''}">
</div>
</div>
{volist name='follow_record' key='k' id='vo' empty='没有随访记录'}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{$k==1?'初诊':'复诊'}随访:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control editor" rows="5" cols="50">{$vo.content}</textarea>
</div>
</div>
{/volist}
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('tt/followup/add')?'':'hide'}" title="添加随访" ><i class="fa fa-plus"></i> 添加随访</a>-->
<button type="button" id="add_follow_report" class="btn btn-danger btn-embossed " data-id="{:$row.id}">添加随访</button>
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
<button type="submit" class="btn btn-primary btn-embossed disabled">修改病历报告</button>
<!-- <button type="button" id="get_follow_report" class="btn btn-danger btn-embossed " data-id="{:$row.id}">查阅随访</button>-->
</div>
</div>
</form>

View File

@@ -0,0 +1,53 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'tt/followup/index' + location.search,
add_url: 'tt/followup/add',
edit_url: 'tt/followup/edit',
del_url: 'tt/followup/del',
multi_url: 'tt/followup/multi',
import_url: 'tt/followup/import',
table: 'tt_followup',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -28,7 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'doctor', title: __('Doctor'), operate: 'LIKE'},
// {field: 'doctor', title: __('Doctor'), operate: 'LIKE'},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'gender', title: __('Gender'), operate: 'LIKE'},
{field: 'age', title: __('Age')},

View File

@@ -62,6 +62,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
$.post(url,{content:content,report_dataid:report_dataid},function (res) {
layer.msg(res.msg);
if(res.code==200){
layer.close(index);
location.href = '';
}
},'json');
},
btn2: function(index, layero){
@@ -78,6 +82,44 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},'json');
});
//查询随访报告
$('#get_follow_report').on('click',function () {
let report_dataid = $('#add_follow_report').attr('data-id');
//添加随访记录
let url = 'tt/Followup/getfollowup';
$.post(url,{report_dataid:report_dataid},function (res) {
layer.open({
type: 1,
title:'添加随访',
area: '80%',
content:res.data,
btn: ['确定', '取消'],
yes: function(index, layero){
//按钮【按钮一】的回调
// let content = $('#c-content').val();
//
// let url = 'tt/Followup/submitfollowup';
// $.post(url,{content:content,report_dataid:report_dataid},function (res) {
//
// layer.msg(res.msg);
// },'json');
},
btn2: function(index, layero){
//按钮【按钮二】的回调
//return false 开启该代码可禁止点击该按钮关闭
},
cancel: function(){
//右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭
}
});
},'json');
});
Controller.api.bindevent();
},
api: {