<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no">
	<th:block th:include="include :: header('患者咨询')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse" >
					<div class="query-condition-container">
						<h4 class="query-condition-title">查询条件</h4>
						<div class="query-buttons">
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</div>
					</div>
					<form id="patientCounseling-form" class="customize-search-form">
						<div class="customize-form-group-container">
							<div class="customize-form-group">
								<label>患者信息:</label>
								<input type="text" class="styled-input" placeholder="请输入患者姓名或手机号" name="query"/>
							</div>
							<div class="customize-form-group">
								<label>疾病:</label>
								<input type="text" class="styled-input" placeholder="请输入疾病" name="disease"/>
							</div>
							<div class="customize-form-group">
								<label>咨询问题:</label>
								<input type="text"  class="styled-input"  style="width: 410px;" placeholder="请输入咨询问题" name="consultationQuestion"/>
							</div>
							<div class="customize-form-group">
								<label>问题类型:</label>
								<select name="questionType" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_hzzx_wtlx')}" >
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
								</select>
							</div>
							<div class="customize-form-group">
								<label>药品:</label>
								<input type="text"  placeholder="商品名,通用名或MDM编码" class="styled-input"  name="product"/>
							</div>
							<div class="customize-form-group select-time">
								<label>咨询时间:</label>
								<input type="text" class="time-input time-input2" id="beginTime" placeholder="开始时间" name="beginTime">
								<span>-</span>
								<input type="text" class="time-input time-input2" id="endTime" placeholder="结束时间" name="endTime">
							</div>
						</div>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">
		        	<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
		                <i class="fa fa-plus"></i> 新建咨询
		            </a>
		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
		                <i class="fa fa-remove"></i> 删除
		            </a>
					<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
						<i class="fa fa-download"></i> 导出
					</a>
		        </div>

				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: hidden;">
					<table id="bootstrap-table" class="fixed-layout-table"></table>
				</div>
			</div>
		</div>
	</div>

	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
	<th:block th:include="include :: ztree-js" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('dtp:pmService:edit')}]];
		var removeFlag = [[${@permission.hasPermi('dtp:pmService:remove')}]];
		var detailFlag = [[${@permission.hasPermi('dtp:print:view')}]];
		var prefix = ctx + "dtp/pmService";
		$(function() {
		    var panehHidden = false;
		    if ($(this).width() < 1590) {
		        panehHidden = true;
		    }
		    $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
	     	// 回到顶部绑定
	    	if ($.fn.toTop !== undefined) {
	    		var opt = {
	    			win:$('.ui-layout-center'),
	    			doc:$('.ui-layout-center')
	    		};
	    		$('#scroll-up').toTop(opt);
	    	}
			queryArchivesList();
		});

		function queryArchivesList() {
		    var options = {
		        url: prefix + "/patientCounselingList",
		        viewUrl: prefix + "/patientCounselingView/{id}",
		        createUrl: prefix + "/patientCounselingAdd",
		        updateUrl: prefix + "/patientCounselingEdit/{id}",
		        removeUrl: prefix + "/patientCounselingRemove",
		        exportUrl: prefix + "/export",
		        importUrl: prefix + "/importData",
		        importTemplateUrl: prefix + "/importTemplate",
		        modalName: "患者咨询",
				fitColumns: true,
				striped: true,
				autoRowHeight: true,
				rowNumbers: true,
				showFooter:true,  //是否显示表格底部区域。
				clickToSelect: true, //是否启用点击行时选中整行的功能。
				singleSelect: true, //是否仅允许选择一行
            fixedColumns: true,
            //fixedNumber: 3,
            fixedRightNumber: 1,
		        columns: [{
		            checkbox: true
		        },
				{ field: 'id', title: '主键', align: 'center' ,visible:false},
				{field: 'patientName', title: '患者姓名', align: 'center' },
				{ field: 'patientPhone', title: '患者手机号', align: 'center' },
				{ field: 'gender', title: '性别', align: 'center',
					formatter: function(value, row, index) {
						switch (value) {
							case 0:
								return "男";
								break;
							case 1:
								return "女";
								break;
							default:
								return "未知";
						}
					} },
				{ field: 'age', title: '年龄', align: 'center' },
				{ field: 'questionType', title: '问题类型', align: 'center' },
				{ field: 'consultationQuestion', title: '咨询问题', align: 'center' },
				{ field: 'pharmacistAnswer', title: '药师解答', align: 'center' },
				{ field: 'consultationTime', title: '咨询时间', align: 'center' },
				{ field: 'disease', title: '疾病', align: 'center' },
				{ field: 'prescriptionGenericName', title: '药品通用名', align: 'center' },
				{ field: 'prescriptionProductName', title: '商品名', align: 'center' },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                if (row.id) {
		                	var actions = [];
			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a>');
							actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>查看记录</a>');
							return actions.join('');
						} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		}

		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
		function resetPre() {
			resetDate();
			$("#patientCounseling-form")[0].reset();
			$("#deptId").val("");
			$("#parentId").val("");
			$(".curSelectedNode").removeClass("curSelectedNode");
			$.table.search();
			_refresh();
		}

	</script>
</body>

</html>
