<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<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">
					<form id="user-form">
						<input type="hidden" id="deptId" name="deptId">
		                <input type="hidden" id="parentId" name="parentId">
						<div class="select-list">
							<ul>
								<li>
									患者信息：<input type="text" class="styled-input" placeholder="请输入患者姓名或手机号" name="query"/>
								</li>
								<li>
									药品：<input type="text" class="styled-input" name="genericName"/>
								</li>
								<li>
								<li>
									订单编号：<input type="text" class="styled-input" name="orderId"/>
								</li>
								<li>
									销售单号：<input type="text" class="styled-input" name="saleOrderNumber"/>
								</li>：
								</li>
								<li>
									处方单号：<input type="text" class="styled-input" name="prescriptionNumber"/>
								</li>
								<li>
									<label>处方类型</label>
									<select name="prescriptionType"  th:with="type=${@dict.getType('sys_select_prescription_ype')}" class="styled-input">
										<option value="">全部</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
												></option>
									</select>
								</li>
								<li>
									<label>配送方式</label>
									<select name="deliveryMethod"  th:with="type=${@dict.getType('sys_select_delivery_method')}" class="styled-input">
										<option value="">全部</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
												></option>
									</select>
								</li>

								<li>
									<label>订单日期 </label>
									<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTime"/>
									<span>-</span>
									<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
								</li>


								<li>
									<label>订单状态</label>
									<select name="status" th:with="type=${@dict.getType('sys_select_order_status')}" class="styled-input">
										<option value="">全部</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
										></option>
									</select>
								</li>
								</li>

								<li>
									<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>
								</li>
							</ul>
						</div>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">
		        	<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="dtp:recipe:add">
		                <i class="fa fa-plus"></i> 新增
		            </a>
		             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="dtp:recipe:edit">
			            <i class="fa fa-edit"></i> 修改
			        </a>
		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sdtp:recipe:remove">
		                <i class="fa fa-remove"></i> 删除
		            </a>
<!--		            <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="dtp:recipe:import">-->
<!--			            <i class="fa fa-upload"></i> 导入-->
<!--			        </a>-->
		            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="dtp:recipe:export">
			            <i class="fa fa-download"></i> 导出
			        </a>
		        </div>

		        <div class="col-sm-12 select-table table-striped">
				    <table id="bootstrap-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 :: ztree-js" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
		var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
		var prefix = ctx + "dtp/recipe";


		$(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);
	    	}
		    queryUserList();
		});

		function queryUserList() {
		    var options = {
		        url: prefix + "/list",
		        viewUrl: prefix + "/view/{id}",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        //importUrl: prefix + "/importData",
		        importTemplateUrl: prefix + "/importTemplate",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "处方登记信息",
		        columns: [{
		            checkbox: true
		        },
					{
						field: "id",
						title: "id",
						//hidden:false
						visible: false,
					},
					{
						field: "orderId",
						title: "订单编号"
					},
					{
						field: "saleOrderNumber",
						title: "销售单号"
					},
					{
						field: "genericName",
						title: "药品通用名"
					},
					{
						field: "productName",
						title: "商品名",
					},
					{
						field: "specification",
						title: "规格"
					},
					{
						field: "quantity",
						title: "数量"
					},
					{
						field: "manufacturer",
						title: "厂家"
					},
					{
						field: "mdmCode",
						title: "MDM编码"
					},
					{
						field: "posMemberName",
						title: "POS会员姓名"
					},
					{
						field: "posMemberPhone",
						title: "POS会员手机号"
					},
					{
						field: "prescriptionType",
						title: "处方类型"
					},
					{
						field: "orderTime",
						title: "订单时间"
					},
					{
						field: "prescriptionNumber",
						title: "处方单号"
					},
					{
						field: "hospital",
						title: "医院"
					},
					{
						field: "department",
						title: "科室"
					},
					{
						field: "doctor",
						title: "医生"
					},
					{
						field: "patientName",
						title: "患者姓名"
					},
					{
						field: "patientPhone",
						title: "手机号"
					},
					{
						field: "storeName",
						title: "门店"
					},
					{
						field: "registrar",
						title: "登记人"
					},
					{
						field: "completionTime",
						title: "完成时间"
					},
					{
						field: "lastUpdated",
						title: "最后更新时间"
					},
					// {
					// 	field: "deliveryMethod",
					// 	title: "配送方式"
					// },
					// {
					// 	field: "paymentCode",
					// 	title: "付款代码"
					// },
					// {
					// 	field: "paymentMethod",
					// 	title: "付款方式"
					// },
					{
						field: "status",
						title: "状态"
					},
					{
						field: "createTime",
						title: "创建时间"
					},
		        /*{
		        	visible: editFlag == 'hidden' ? false : true,
		        	title: '用户状态',
		        	align: 'center',
		        	formatter: function (value, row, index) {
		        		return statusTools(row);
		        	}
		        },*/

		        {
		            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.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
			                return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		}

		function queryDeptTree()
		{
			var url = ctx + "dtp/recipe/deptTreeData";
			var options = {
		        url: url,
		        expandLevel: 2,
		        onClick : zOnClick
		    };
			$.tree.init(options);

			function zOnClick(event, treeId, treeNode) {
				$("#deptId").val(treeNode.id);
				$("#parentId").val(treeNode.pId);
				$.table.search();
			}
		}
		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
		function resetPre() {
			resetDate();
			$("#user-form")[0].reset();
			$("#deptId").val("");
			$("#parentId").val("");
			$(".curSelectedNode").removeClass("curSelectedNode");
			$.table.search();
		}
	</script>
</body>

</html>
