<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta charset="UTF-8">
	<th:block th:include="include :: header('患者管理品')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>

<body><div class="main-content">


				<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="tag-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="请输入MDM编码或药品商品名/通用名" name="query" style="width: 350px;"/>
								</div>

								<div class="customize-form-group">
									<label>厂家简称:</label>
									<input type="text" class="styled-input" placeholder="请输入厂家简称" name="manufacturerShortName" style="width: 350px;"/>
								</div>
							</div>
						</form>
					</div>

				</div>
				<div class="row">
					<div class="col-sm-12 select-table table-striped">
						<table id="bootstrap-table"></table>
					</div>
				</div>
</div>

<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var viewFlag = [[${@permission.hasPermi('dtp:configInfo:list')}]];
	var prefix = ctx + "yppz/drugConfig";

	$(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 + "/getAllDrugs",
			viewUrl: prefix + "/view/{id}",
			exportUrl: prefix + "/export",
			//sortName: "createTime",
			//sortOrder: "desc",
			modalName: "患者管理品",
			showFooter:true,  //是否显示表格底部区域。
			clickToSelect: true, //是否启用点击行时选中整行的功能。
			singleSelect: true, //是否仅允许选择一行
			fixedColumns: true,
			//fixedNumber: 3,
			//fixedRightNumber: 1,
			columns: [{
				checkbox: true
			},
				{
					field: "id",
					title: "id",
					align: 'center', visible: false
				},
				{
					"field": "mdmCode",
					"title": "MDM编码"
				},{
					"field": "productName",
					"title": "药品商品名"
				},{
					"field": "genericName",
					"title": "药品通用名"
				},{
					"field": "specification",
					"title": "规格"
				},{
					"field": "manufacturerShortName",
					"title": "厂家简称"
				},
				{
					"field": "manufacturer",
					"title": "生产厂家"
				},
				{
					"field": "packaging",
					"title": "包装"
				},
				{
					"field": "isFollowUpManaged",
					"title": "是否随访管理品 (1: 是, 0: 否)",
					align: 'center', visible: false
				},
				{
					"field": "isColdChainManaged",
					"title": "是否冷链管理品 (1: 是, 0: 否)",
					align: 'center', visible: false
				},
				{
					"field": "isRegisteredManaged",
					"title": "是否登记管理品 (1: 是, 0: 否)",
					align: 'center', visible: false
				},
				{
					"field": "isCharityAidManaged",
					"title": "是否慈善援助管理品 (1: 是, 0: 否)",
					align: 'center', visible: false
				},
				{
					"field": "administrationMethod",
					"title": "给药方式",
					align: 'center', visible: false
				},
				{
					"field": "enterpriseFlowManagement",
					"title": "企业流向管理方式",
					align: 'center', visible: false
				},

				{
					"field": "dosage_max",
					"title": "最大剂量数量",
					align: 'center', visible: true
				},
				{
					"field": "dosage_min",
					"title": "最小剂量数量",
					align: 'center', visible: true
				},
				{
					"field": "unit_max",
					"title": "最大剂量单位",
					align: 'center', visible: true
				},
				{
					"field": "unit_min",
					"title": "最小剂量单位",
					align: 'center', visible: true
				},
				{
					"field": "unit_normal",
					"title": "常见计量单位",
					align: 'center', visible: true
				},
				{
					"field": "dosage_normal",
					"title": "常见计量数量",
					align: 'center', visible: true
				},
				{
					"field": "packing_value",
					"title": "包装单位值",
					align: 'center', visible: true
				},
				{
					"field": "packing_unit",
					"title": "包装单位",
					align: 'center', visible: true
				},
				{
					"field": "indicationDescription",
					"title": "说明书适应症",
					align: 'center', visible: false
				},
				{
					"field": "dosageAndAdministration",
					"title": "用法用量",
					align: 'center', visible: false
				},
				// {
				// 	"field": "isColdChainDrug",
				// 	"title": "是否冷链药品(1: 是, 0: 否)"
				// },
				// {
				// 	"field": "dtpProduct",
				// 	"title": "DTP商品(D)(1: 是, 0: 否)"
				// },
				// {
				// 	"field": "usageMethod",
				// 	"title": "用药方法"
				// },
				{
					"field": "creator",
					"title": "创建人",
					align: 'center', visible: false
				},
				{
					"field": "createTime",
					"title": "创建时间",
					align: 'center', visible: false
				},
				{
					"field": "updater",
					"title": "更新人",
					align: 'center', visible: false
				},
				{
					"field": "updatedTime",
					"title": "更新时间"
				},
				// {
				// 	"field": "marketingAuthorizationHolder",
				// 	"title": "上市许可证持有人"
				// },
				// {
				// 	"field": "entrustedManufacturer",
				// 	"title": "委托厂家"
				// },
				// {
				// 	"field": "productionLicenseNumber",
				// 	"title": "生产许可证号/备案"
				// },
				// {
				// 	"field": "formulationSpecification",
				// 	"title": "制剂规格"
				// },

				// {
				// 	"field": "dosageFormCode",
				// 	"title": "剂型代码"
				// },
				// {
				// 	"field": "approvalNumber",
				// 	"title": "批准文号1"
				// },
				// {
				// 	"field": "approvalNumberExpiryDate",
				// 	"title": "批准文号1有效期"
				// },
				// {
				// 	"field": "storageConditions",
				// 	"title": "存储条件"
				// },

				// {
				// 	"field": "targetPopulation",
				// 	"title": "用药人群"
				// },
				// {
				// 	"field": "genderRestrictions",
				// 	"title": "用药性别"
				// },
				// {
				// 	"field": "dosageAndAdministration",
				// 	"title": "用法用量"
				// },
				// {
				// 	"field": "indications",
				// 	"title": "适应症"
				// },
				// {
				// 	"field": "drugInteractions",
				// 	"title": "药物相互作用"
				// },
				// {
				// 	"field": "adverseReactions",
				// 	"title": "不良反应"
				// },
				// {
				// 	"field": "contraindications",
				// 	"title": "禁忌症"
				// },
				// {
				// 	"field": "precautions",
				// 	"title": "注意事项"
				// },
				// {
				// 	"field": "pregnancyAndLactation",
				// 	"title": "孕妇及哺乳期妇女用药"
				// },
				// {
				// 	"field": "pediatricUsage",
				// 	"title": "儿童用药"
				// },
				// {
				// 	"field": "geriatricUsage",
				// 	"title": "老年患者用药"
				// },
				// {
				// 	"field": "drugOverdose",
				// 	"title": "药物过量"
				// },
				// {
				// 	"field": "clinicalTrials",
				// 	"title": "临床试验"
				// },
				// {
				// 	"field": "pharmacologyToxicology",
				// 	"title": "药理毒理"
				// },
				// {
				// 	"field": "pharmacokinetics",
				// 	"title": "药代动力学"
				// },

				{
					"field": "status",
					"title": "状态",
				formatter: function(value, row, index) {
			    switch (value) {
					case 0:
						return '停用';
						break;
					case 1:
						return '启用';
						break;
					default:
						return '-';
			}
		}
				}]
		};
		$.table.init(options);
	}

	/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
	function resetPre() {
		resetDate();
		$("#tag-form")[0].reset();
		$("#deptId").val("");
		$("#parentId").val("");
		$(".curSelectedNode").removeClass("curSelectedNode");
		$.table.search();
	}
	/* 添加用户-选择用户-提交(子页面调用父页面形式) */
	function submitHandler(index, layero) {
		debugger
		var rows = $.table.selectFirstColumns();

		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		$.modal.close();
		// 父页面的方法
		// activeWindow().selectUsers();
		// 父页面的变量
		activeWindow().$('#userids').html('我是通过方式一来的：' + rows.join());
	}

	/* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
	function getSelections() {
		return $.table.selectFirstColumns();
	}

	function selectTableObject() {
		var productName = $.table.selectColumns('productName');
		var mdmCode = $.table.selectColumns('mdmCode');
		var genericName = $.table.selectColumns('genericName');
		var specification = $.table.selectColumns('specification');
		var packaging = $.table.selectColumns('packaging');
		var manufacturerShortName = $.table.selectColumns('manufacturerShortName');
		var isFollowUpManaged = $.table.selectColumns('isFollowUpManaged');
		var isColdChainManaged = $.table.selectColumns('isColdChainManaged');
		var isRegisteredManaged = $.table.selectColumns('isRegisteredManaged');
		var isCharityAidManaged = $.table.selectColumns('isCharityAidManaged');
		var administrationMethod = $.table.selectColumns('administrationMethod');
		var dosageAndAdministration = $.table.selectColumns('dosageAndAdministration');
		var indicationDescription = $.table.selectColumns('indicationDescription');
		var	dosage_max= $.table.selectColumns('dosage_max');
		var	dosage_min= $.table.selectColumns('dosage_min');
		var	dosage_normal= $.table.selectColumns('dosage_normal');
		var	unit_normal= $.table.selectColumns('unit_normal');
		var	unit_max= $.table.selectColumns('unit_max');
		var	unit_min= $.table.selectColumns('unit_min');
		var	packing_unit= $.table.selectColumns('packing_unit');
		var	packing_value= $.table.selectColumns('packing_value');
		var productId = $.table.selectColumns('id');
		var column = [{productName:productName,genericName:genericName,
			mdmCode:mdmCode,specification:specification,
			packaging:packaging,manufacturerShortName:manufacturerShortName,
			isFollowUpManaged:isFollowUpManaged,isColdChainManaged:isColdChainManaged,
			isRegisteredManaged:isRegisteredManaged,isCharityAidManaged:isCharityAidManaged,
			administrationMethod:administrationMethod,indicationDescription:indicationDescription,
			dosageAndAdministration:dosageAndAdministration,
			dosage_max:dosage_max,dosage_min:dosage_min,dosage_normal:dosage_normal,
			unit_normal:unit_normal,unit_max:unit_max,unit_min:unit_min,
			packing_unit:packing_unit,packing_value:packing_value,
			productId:productId}];
		return column;
	}
	/*回调返回所有的选中行数据*/
	function selectColumns2() {
		return $.table.selectColumns2();
	}
	$("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
		var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
		var rowIds = $.table.affectedRowIds(rows);
		$("#rowIds").val(rowIds);
	});
</script>
</body>

</html>
