<!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" >
					<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>
							<span>&nbsp;&nbsp;&nbsp;</span>
							<button type="button"  data-toggle="modal" data-target="#myModal" class="btn btn-danger">意见与反馈</button>
						</div>

					</div>

					<form id="followUp-form" class="customize-search-form">
						<input type="hidden" id="deptId" name="deptId">
		                <input type="hidden" id="parentId" name="parentId">
						<div class="customize-form-group-container">
							<div class="customize-form-group">
								<label>患者信息:</label>
								<input type="text" class="styled-input"  placeholder="请输入患者姓名或患者ID" name="query"/>
							</div>
							<div class="customize-form-group">
								<label>药品:</label>
								<input type="text"  class="styled-input" placeholder="请输入商品名或通用名"  name="product"/>
							</div>
							<div class="customize-form-group">
								<label>预约日期:</label>
								<input type="text" class="time-input time-input2" id="subscribebeginTime" placeholder="开始时间" name="subscribeBeginTime">
								<span>-</span>
								<input type="text" class="time-input time-input2" id="subscribeendTime" placeholder="结束时间" name="subscribeEndTime">
							</div>
							<div class="customize-form-group">
								<label>任务跟进人:</label>
								<select name="taskFollower" class="styled-input" >
									<option value="">全部</option>
<!--									<option th:each="salesclerk : ${clerk}" th:text="${salesclerk.name}" th:value="${salesclerk.id}"></option>-->
								</select>
							</div>

							<div class="customize-form-group">
								<label>门店:</label>
								<select name="storeId" class="styled-input">
									<option value="">全部</option>
<!--									<option th:each="store : ${stores}" th:text="${store.name}" th:value="${store.id}"></option>-->
								</select>
							</div>
							<div class="customize-form-group">
								<label>下次外呼时间:</label>
								<input type="text" class="time-input time-input2" id="beginTime" placeholder="开始时间" name="NextBeginTime">
								<span>-</span>
								<input type="text" class="time-input time-input2" id="endTime" placeholder="结束时间" name="NextEndTime">
							</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>
								<select name="followUpSummary" class="styled-input">
									<option value="">请选择</option>
									<option value="待处理" >待处理</option>
									<option value="已完成" >已完成</option>
									<option value="已过期" >已过期</option>
									<option value="无" >无</option>
								</select>
							</div>
							<div class="customize-form-group">
								<label>完成日期:</label>
								<input type="text" class="time-input time-input2" id="completeBeginTime" placeholder="开始时间" name="completeBeginTime">
								<span>-</span>
								<input type="text" class="time-input time-input2" id="completeEndTime" placeholder="结束时间" name="completeEndTime">
							</div>
							<div class="customize-form-group">
								<label>任务主题:</label>
								<select name="taskTheme" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_sfrw_rwzt')}">
									<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"  class="styled-input" placeholder="请输入任务名称" name="taskName"/>
							</div>
							<div class="customize-form-group">
								<label>任务状态:</label>
								<select name="taskStatus" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_sfrwzt')}" >
									<option value="">请选择</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
								</select>
							</div>
						</div>
							<div class="customize-form-group-container">
							<div class="customize-form-group">
								<label>业务归属:</label>
								<select name="businessBelonging" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ywgs')}" >
									<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>
								<select name="lastOutboundFlag" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_sfrw_zhwhbj')}">
									<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>
								<select name="lastOutboundStatus" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_sfrw_zhwhzt')}">
									<option value="">请选择</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
								</select>
							</div>
						</div>
					</form>
				</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>
	<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<form class="form-horizontal" id="form-yijianyufankui-add">
				<div class="modal-content animated bounceInRight">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
						</button>
						<h4 class="modal-title">意见与反馈</h4>
					</div>
					<div class="modal-body">
						<div class="customize-form-group edit">
							<label>反馈内容:</label>
							<textarea id="FeedbackContent" name="FeedbackContent" class="styled-input edit_inputs textareas"
									  style="width: auto;height: 140px ;border: 1px solid ;"
									  placeholder="请输入反馈内容" rows="1.9" cols="120" ></textarea>
							<span class="status"></span>
						</div>
						<div class="customize-form-group edit">
							<label class="is-required" for="uploadImage">图片上传：</label>
							<div class="custom-file-upload">
								<input type="file" id="uploadImage" accept=".jpg,.jpeg,.png,.gif">
								<label for="uploadImage"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#007bff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg></label>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" onclick="saveRow()">提交</button>
					</div>
				</div>
			</form>
		</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 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 + "/followUpList",
		        viewUrl: prefix + "/followUpView/{id}",
		        createUrl: prefix + "/followUpAdd",
		        updateUrl: prefix + "/followUpEdit/{id}",
		        removeUrl: prefix + "/followUpRemove",
		        /*exportUrl: prefix + "/export",
		        importUrl: prefix + "/importData",
		        importTemplateUrl: prefix + "/importTemplate",*/
		        sortName: "id",
		        sortOrder: "asc",
		        modalName: "随访表单",
				fitColumns: true,
				striped: true,
				autoRowHeight: true,
				rowNumbers: true,
				showFooter:true,  //是否显示表格底部区域。
				clickToSelect: true, //是否启用点击行时选中整行的功能。
				singleSelect: false, //是否仅允许选择一行
				fixedColumns: true,
				//fixedNumber: 3,
				fixedRightNumber: 1,
		        columns: [
				{ field: 'appointmentDate', title: '预约日期', align: 'center' },
				{ field: 'businessBelonging', title: '业务归属', align: 'center' },
				{ field: 'taskName', title: '任务名称',width: 170, align: 'center' ,
					formatter: function(value, row, index) {
						if (row.id) {
							return '<a href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.patientId + '\')">' + value + '</a>';
						} else {
							return "";
						}
					}},
				{ field: 'taskTheme', title: '任务主题', align: 'center' },
				{ field: 'patientName', title: '患者姓名',width: 200, align: 'center' ,
					formatter: function(value, row, index) {
						if (row.id) {
							return '<a href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">' + value + '</a>';
						} else {
							return "";
						}
					} },
				{ field: 'gender', title: '性别', align: 'center' },
				{ field: 'age', title: '年龄', align: 'center' },
				{ field: 'followUpSummary', title: '随访小结',width: 500, align: 'center' },
				{ field: 'disease', title: '疾病', align: 'center' },
				{ field: 'storeName', title: '门店', align: 'center' },
				{ field: 'genericName', title: '药品通用名', align: 'center' },
				{ field: 'productName', title: '商品名', align: 'center' },
				{ field: 'taskFollower', title: '任务跟进人', align: 'center' },
					{ field: 'taskStatus', title: '任务状态', align: 'center' ,
						formatter: function(value, row, index) {
							switch (value) {
								case '待执行':
									return '<span class=\"btn-danger">'+value+'</span>';
									break;
								case '已完成':
									return '<span class=\"btn-primary">'+value+'</span>';
									break;
								default:
									return '<span class=\"btn-warning">'+value+'</span>';
							}
						}},
					{ field: 'lastOutboundStatus', title: '最后外呼状态', align: 'center',
						formatter: function(value, row, index) {
							switch (value) {
								case '未外呼':
									return '<span class=\"btn-danger">'+value+'</span>';
									break;
								case '外呼中':
									return '<span class=\"btn-primary">'+value+'</span>';
									break;
								case '未接通':
									return '<span class=\"btn-danger">'+value+'</span>';
									break;
								case '未完成':
									return '<span class=\"btn-danger">'+value+'</span>';
									break;
								case '已完成':
									return '<span class=\"btn-primary">'+value+'</span>';
									break;
								case '接通后本人拒绝':
									return '<span class=\"btn-warning">'+value+'</span>';
									break;
								default:
									return '<span class=\"btn-primary">'+value+'</span>';
							}
						}},
				{ field: 'actualFollowUpTime', title: '实际随访时间', align: 'center' },
				{ field: 'callConnectedCount', title: '接通次数', align: 'center' },
				{ field: 'outboundCallCount', title: '外呼次数', align: 'center' },
				{ field: 'nextOutboundCallCount', title: '下次外呼次数', align: 'center' },

				{ field: 'updateTime2', title: '更新时间', align: 'center' },
		        {
		            title: '操作',
		            align: 'center',
					width: '180px',
		            formatter: function(value, row, index) {
		                if (row.id) {
		                	var actions = [];
			                actions.push('<a class="btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">去随访</a> ');
			                actions.push('<a class="btn-info btn-xs' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">查看全部</a> ');
			                return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		}

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


		/* 用户状态显示 */
		function statusTools(row) {
		    if (row.status == 1) {
    			return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
    		} else {
    			return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
    		}
		}
		function saveRow() {

			// 获取表单数据
			var uploadImage = document.getElementById('uploadImage').value;
			var FeedbackContent = document.getElementById('FeedbackContent').value;
			// 检查数据是否为空
			if (!FeedbackContent || !uploadImage) {
				$.modal.alert('请填写意见内容和或上传图片！');
				return;
			}
			$.modal.alert('意见内容=='+FeedbackContent+'传图片==='+uploadImage);
			// 关闭模态框
			$('#myModal').modal('hide');
		}
	</script>
</body>
<style>
	.custom-file-upload {
		position: relative;
		overflow: hidden;
		cursor: pointer;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.custom-file-upload input[type=file] {
		opacity: 0;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		position: absolute;
	}

	.custom-file-upload label {
		background-color: white;
		border: 2px dashed #007bff;
		color: #007bff;
		padding: 20px;
		text-align: center;
		display: block;
		min-height: 150px;
	}

</style>
</html>
