Browse Source

模板管理

yezehua 6 years ago
parent
commit
0023cee450

+ 23 - 1
api/rehabilitation-api.js

@ -34,7 +34,29 @@
		saveRehabilitationOperateRecord:function(data){
			return httpRequest.post('doctor/specialist/rehabilitation/saveRehabilitationOperateRecord',{data:data})
		},
		
		// 康复服务套餐管理-获取康复服务套餐模板列表
		findTemplateList:function(data){
			return httpRequest.get("doctor/specialist/rehabilitationPlan/findTemplateList",{data:data})
		},
		// 康复服务套餐管理-获取机构服务项目列表
		findServiceItemsByHospital:function(data){
			return httpRequest.get("doctor/specialist/hospitalServiceItem/findServiceItemsByHospital",{data:data})
		},
		createTemplate:function(data){
			return httpRequest.post('doctor/specialist/rehabilitationPlan/createTemplate',{data:data})
		},
		createTemplateDetail:function(data){
			return httpRequest.post('doctor/specialist/rehabilitationPlan/createTemplateDetail',{data:data})
		},
		findTemplateDetail:function(data){
			return httpRequest.get("doctor/specialist/rehabilitationPlan/findTemplateDetail",{data:data})
		},
		deleteTemplate:function(data){
			return httpRequest.post('doctor/specialist/rehabilitationPlan/deleteTemplate',{data:data})
		},
		selectByIds:function(data){
			return httpRequest.get("doctor/specialist/hospitalServiceItem/selectByIds",{data:data})
		},
		
		
		

+ 2 - 2
app/guidance/html/index.html

@ -12,7 +12,7 @@
        <link rel="shortcut icon" href="../../../favicon.ico">
        <link rel="stylesheet" type="text/css" href="../../../css/cross.css"/>
        <link rel="stylesheet" type="text/css" href="../../../plugins/toastr/toastr.min.css"/>
        <link rel="stylesheet" type="text/css" href="../../../plugins/artDialog/6.0.5/api/css/ui-dialog.css"/>
        <link rel="stylesheet" type="text/css" href="../../../plugins/artDialog/6.0.5/css/ui-dialog.min.css"/>
        <link rel="stylesheet" type="text/css" href="../css/index.css"/>
        <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
@ -25,7 +25,7 @@
			<router-view></router-view>
		</div>
		<script src="../../../plugins/toastr/toastr.min.js"></script>
		<script src="../../../plugins/artDialog/6.0.5/api/js/dialog-plus.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../plugins/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="u
		<script src="../../../api/http-request.js"></script>
		<script src="../../../js/underscore.js"></script>
		<script src="../../../api/guidance-api.js"></script>

+ 304 - 0
app/rehabilitation/css/management.css

@ -0,0 +1,304 @@
html,body,#app {
	margin: 0;
	padding: 0;
	height: 100%;
	color: #333;
}
ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}
a {
	text-decoration:none;
}
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: ".";
    clear: both;
    height: 0;
}
.clearfix {
    zoom: 1;
}
.fl {
	float: left;
}
.fr {
	float: right;
}
#app>.ui-grid, #app>.ui-grid .ui-grid {
	height: 100%;
}
.ul-wrap {
	background-color:#f5f5fa;
	height: -moz-calc(100% - 100px);
	height: -webkit-calc(100% - 100px);
	height: calc(100% - 100px);
	overflow-y: auto;
}
.left-panel {
	width: 450px;
	border-right: 1px solid #d7dce6;
}
.title-name {
	height: 40px;
	line-height: 40px;
	border-bottom: 1px solid #d7dce6;
	box-sizing: border-box;
}
.title-name:before {
	content: '';
	display: inline-block;
	vertical-align: middle;
	background: #12b7f5;
	width: 4px;
	height: 20px;
	margin-right: 10px;
}
.inp-search {
	border: solid 1px #d7dce6;
	margin: 10px 0 auto;
	width: 100%;
	height: 30px;
	padding-left: 10px;
	box-sizing: border-box;
}
.search-warp {
	position: relative;
}
.search-warp::after {
	content: ' ';
	width: 20px;
	height: 20px;
	position: absolute;
	right: 8px;
	top: 14px;
	display: block;
	background: url(../../../images/sousuo_icon.png) center center / 15px 15px no-repeat;
}
.temp-item {
	height: 28px;
	line-height: 28px;
	background-color: #ffffff;
	border-radius: 5px;
	border: solid 1px #82dcfa;
	margin: 20px 0;
	cursor: pointer;
}
.temp-item.active {
	color: #fff;
	background-color: #12b7f5;
}
.temp-item.add {
	height: 28px;
	background-color: #ffffff;
	border-radius: 5px;
	border: solid 1px #82dcfa;
}
.wushuju {
	width: 260px;
	margin-top: 100px;
}
.new-temp-btn {
	width: 120px;
	height: 34px;
	background-color: #ffffff;
	border-radius: 17px;
	border: solid 1px #12b7f5;
	font-size: 14px;
	color: #12b7f5;
	padding: 5px 10px;
	cursor: pointer;
}
.temp-name-inpt {
	height: 28px;
	line-height: 28px;
	box-sizing: border-box;
	padding-left: 10px;
}
.save-temp-name-btn {
	height: 28px;
	line-height: 28px;
	background-color: #12b7f5;
	border-radius: 2px;
	color: #ffffff;
	width: 80px;
	display: inline-block;
}
.foot-btns {
	position: absolute;
	bottom: 20px;
	left: 50%;
    margin-left: -94px;
}
.delete-btn {
	width: 90px;
	height: 34px;
	background-color: #f96565;
	border-radius: 2px;
	padding: 5px 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.save-btn {
	width: 90px;
	height: 34px;
	background-color: #12b7f5;
	border-radius: 2px;
	padding: 5px 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.list-item {
	position: relative;
	cursor: pointer;
}
.list-item.arrow-r:before {
	height: 11px;
	width: 11px;
	content: '';
	display: inline-block;
	vertical-align: middle;
	background: url(../../../images/shouqi_jiantou_icon.png) no-repeat 100%;
	margin-right: 5px;
}
.list-item.arrow-d:before {
	height: 11px;
	width: 11px;
	content: '';
	display: inline-block;
	vertical-align: middle;
	background: url(../../../images/zhankai_jiantou_icon.png) no-repeat 100%;
	margin-right: 5px;
}
.list-item-name {
	width: 320px;
	height: 28px;
	line-height: 28px;
	background-color: #f5f5fa;
	border-radius: 5px;
	border: solid 1px #82dcfa;
	color: #666666;
	display: inline-block;
	vertical-align: middle;
}
.add-item-btn {
	width: 60px;
	height: 28px;
	background-color: #12b7f5;
	border-radius: 5px;
	color: #fff;
	display: inline-block;
	vertical-align: middle;
	text-align: center;
	line-height: 28px;
}
.add-item-btn.disabled {
	background-color: #d7dce6;
	pointer-events: none;
}
.item-card {
	position: relative;
	background-color: #ffffff;
	border-radius: 10px;
	border: solid 1px #d7dce6;
}
.item-card:before {
	content: '';
    width: 3px;
    height: 60px;
    background-color: #12b7f5;
    border-radius: 3px;
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -30px;
}
.item-delete-btn {
	position: absolute;
    right: 5px;
    top: 50%;
    margin-top: -10px;
    cursor: pointer;
}
.template-items {
	height: -moz-calc(100% - 100px);
	height: -webkit-calc(100% - 100px);
	height: calc(100% - 100px);
    overflow-y: auto;
}
.item-detail {
	border: solid 1px #d7dce6;
	box-sizing: border-box;
}
.item-detail-name {
	height: 40px;
	line-height: 40px;
	background-color: #f5f5fa;
}
.back-btn {
	display: inline-block;
	width: 120px;
	height: 34px;
	line-height: 34px;
	background-color: #12b7f5;
	border-radius: 2px;
	color: #fff;
	cursor: pointer;
	position: absolute;
	left: 50%;
	bottom: 10px;
	margin-left: -60px;
}
.item-detail-wrap {
	height: -moz-calc(100% - 20px);
	height: -webkit-calc(100% - 20px);
	height: calc(100% - 20px);
}
.item-detail-innerwrap {
	height: -moz-calc(100% - 50px);
	height: -webkit-calc(100% - 50px);
	height: calc(100% - 50px);
	overflow-y: auto;
}

+ 44 - 0
app/rehabilitation/html/management.html

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="renderer" content="webkit">
        <meta http-equiv="Cache-Control" content="no-siteapp">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <title>模板管理</title>
        <meta name="keywords" content="">
        <meta name="description" content="">
        <link rel="shortcut icon" href="../../../favicon.ico">
        <link rel="stylesheet" type="text/css" href="../../../css/cross.css"/>
        <link rel="stylesheet" type="text/css" href="../../../plugins/toastr/toastr.min.css"/>
        <link rel="stylesheet" type="text/css" href="../../../plugins/artDialog/6.0.5/css/ui-dialog.min.css"/>
        <link rel="stylesheet" type="text/css" href="../css/management.css"/>
        <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
		
	</head>
	<body>
		<div id="app" >
			<router-view></router-view>
		</div>
		<script src="../../../plugins/toastr/toastr.min.js"></script>
		<script src="../../../plugins/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="utf-8"></script>
		<script>
			var EventBus = new Vue();
			Vue.prototype.loading = dialog({contentType:'load', skin:'bk-popup'})
		</script>
		<script src="../../../api/http-request.js"></script>
		<script src="../../../js/underscore.js"></script>
		<script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
		<script src="../../../js/vue-router.js"></script>
		<script src="../../../component/rehabilitation/template-items.js"></script>
		<script src="../../../component/rehabilitation/template-items-select.js"></script>
		<script src="../../../component/rehabilitation/template-list.js"></script>
		<script src="../../../component/rehabilitation/new-template-form.js"></script>
		<script src="../../../component/rehabilitation/new-template.js"></script>
		<script src="../../../component/rehabilitation/item-detail.js"></script>
		<script src="../../../component/rehabilitation/index-page.js"></script>
		<script src="../js/management.js" type="text/javascript" charset="utf-8"></script>
	</body>
</html>

+ 59 - 0
app/rehabilitation/js/management.js

@ -0,0 +1,59 @@
var routes = [
	{ path: '/', component: IndexPage,
	  children: [
	  	{
          path: '/',
          components: {
	        leftView: TemplateList,
	        rightView: NewTemplate
	      }
       },
       {
          path: '/new-template-form',
          components: {
	        leftView: TemplateList,
	        rightView: NewTemplateForm
	      }
       },
       {
          path: '/template-items',
          components: {
	        leftView: TemplateItemsSelect,
	        rightView: TemplateItems
	      }
       },
       {
          path: '/template-items-select',
          components: {
	        leftView: TemplateItemsSelect,
	        rightView: TemplateItems
	      }
       },
       {
          path: '/template-item-detail',
          components: {
	        leftView: TemplateItemsSelect,
	        rightView: ItemDetail
	      }
       },
      ]
	}
],
router = new VueRouter({
  routes: routes
}),
storage = {
	docInfo: localStorage.getItem('docInfo')?JSON.parse(localStorage.getItem('docInfo')):null,
	patient: null, // url中patient,用来来判断是否是"发送"模式
	planId: null
}
new Vue({
    data: {
    },
    router: router,
    methods: {
    },
    components: {
    }
}).$mount('#app')

+ 18 - 18
component/guidance/person-edit-panel.js

@ -177,24 +177,24 @@ var PersonEditPanel = {
		            }).then(function(res) {
        				toastr && toastr.success("发送成功")
        				
//      				var obj = {
//      					rehabilitationDetailId: storage.planId,
//				            patientCode: storage.patient,
//				            // patientName: patientName,
//				            doctorCode: storage.docInfo.code,
//				            doctorName: storage.docInfo.name,
//				            relationRecordType: 2, //健康指导
//				            relationRecordCode: res.data.id
//      				}
//      				guidanceAPI.saveRehabilitationOperateRecord({
//      					dataJson: JSON.stringify(obj)
//      				}).then(function(res) {
//      					if(res.status == 200) {
//      						
//      					} else {
//      						toastr && toastr.success(res.msg)
//      					}
//      				})
        				var obj = {
        					rehabilitationDetailId: storage.planId,
				            patientCode: storage.patient,
				            // patientName: patientName,
				            doctorCode: storage.docInfo.code,
				            doctorName: storage.docInfo.name,
				            relationRecordType: 2, //健康指导
				            relationRecordCode: res.data.id
        				}
        				guidanceAPI.saveRehabilitationOperateRecord({
        					dataJson: JSON.stringify(obj)
        				}).then(function(res) {
        					if(res.status == 200) {
        						
        					} else {
        						toastr && toastr.success(res.msg)
        					}
        				})
        				
		        	}).catch(function(e) {
		        		console.error(e)

+ 18 - 0
component/guidance/system-send-panel.js

@ -175,6 +175,24 @@ var SystemSendPanel = {
		                images: vm.imgs.join(',')
		            }).then(function(res) {
        				toastr && toastr.success("发送成功")
        				var obj = {
        					rehabilitationDetailId: storage.planId,
				            patientCode: storage.patient,
				            // patientName: patientName,
				            doctorCode: storage.docInfo.code,
				            doctorName: storage.docInfo.name,
				            relationRecordType: 2, //健康指导
				            relationRecordCode: res.data.id
        				}
        				guidanceAPI.saveRehabilitationOperateRecord({
        					dataJson: JSON.stringify(obj)
        				}).then(function(res) {
        					if(res.status == 200) {
        						
        					} else {
        						toastr && toastr.success(res.msg)
        					}
        				})
		        	}).catch(function(e) {
		        		console.error(e)
		        	})

+ 18 - 0
component/guidance/team-edit-panel.js

@ -263,6 +263,24 @@ var TeamEditPanel = {
						teamId: JSON.stringify(team)
		        	}).then(function(res) {
        				toastr && toastr.success("发送成功")
        				var obj = {
        					rehabilitationDetailId: storage.planId,
				            patientCode: storage.patient,
				            // patientName: patientName,
				            doctorCode: storage.docInfo.code,
				            doctorName: storage.docInfo.name,
				            relationRecordType: 2, //健康指导
				            relationRecordCode: res.data.id
        				}
        				guidanceAPI.saveRehabilitationOperateRecord({
        					dataJson: JSON.stringify(obj)
        				}).then(function(res) {
        					if(res.status == 200) {
        						
        					} else {
        						toastr && toastr.success(res.msg)
        					}
        				})
		        	}).catch(function(e) {
		        		console.error(e)
		        	})

+ 38 - 0
component/rehabilitation/index-page.js

@ -0,0 +1,38 @@
var IndexPage = {
    template: '<div class="ui-grid">\
	    		<div ref="leftPanel" class="ui-col-0 plr10 left-panel">\
	    			<keep-alive>\
	    				<router-view name="leftView"></router-view>\
	    			</keep-alive>\
				</div>\
	 		    <div ref="rightPanel" class="ui-col-1 plr10 c-position-r">\
	 		    	<keep-alive>\
			    	<router-view name="rightView"></router-view>\
			    	</keep-alive>\
			    </div>\
		    </div>',
    props: [],
    data: function() {
		return {
		}
    },
    created: function() {
    	var vm = this
    },
    mounted: function() {
    	var vm = this
    	var leftPanel = vm.$refs.leftPanel
    	var rightPanel = vm.$refs.rightPanel
    	$(leftPanel).height($(window).height())
    	$(rightPanel).height($(window).height())
    	window.addEventListener('resize', _.debounce(function() {
    		$(leftPanel).height($(window).height())
    		$(rightPanel).height($(window).height())
    	}, 300))
    },
    methods: {
    }
}

+ 72 - 0
component/rehabilitation/item-detail.js

@ -0,0 +1,72 @@
var ItemDetail = {
    template: '<div class="plr10 ptb10 c-position-r item-detail-wrap">\
		    		<div class="item-detail-innerwrap">\
			    		<div class="item-detail">\
							<div class="c-f14 c-999 plr10 item-detail-name">项目名称</div>\
							<div class="c-f14 c-666 ptb10 plr10">{{item.specialistServiceItemDO.title}}</div>\
						</div>\
						<div class="item-detail mt20">\
							<div class="c-f14 c-999 plr10 item-detail-name">项目内容</div>\
							<div class="c-f14 c-666 ptb10 plr10">{{item.specialistServiceItemDO.content}}</div>\
						</div>\
						<div class="item-detail mt20">\
							<div class="c-f14 c-999 plr10 item-detail-name">项目类型</div>\
							<div class="c-f14 c-666 ptb10 plr10">{{itemTypes[item.specialistServiceItemDO.itemType]}}</div>\
						</div>\
						<div class="item-detail mt20">\
							<div class="c-f14 c-999 plr10 item-detail-name">服务机构</div>\
							<div class="c-f14 c-666 ptb10 plr10">{{item.hospitalName}}</div>\
						</div>\
						<div class="item-detail mt20">\
							<div class="c-f14 c-999 plr10 item-detail-name">服务地点</div>\
							<div class="c-f14 c-666 ptb10 plr10">{{item.hospitalDo.address}}</div>\
						</div>\
		    		</div>\
					<a class="back-btn c-t-center mr15" @click="goBack">\
		    			返回\
		    		</a>\
		    	</div>',
    props: [],
    data: function() {
        return {
        	item: {
        		specialistServiceItemDO: {},
        		hospitalName: ""
        	},
        	itemTypes: ["","康复服务","健康服务"],
        	itemId: ""
        }
    },
     beforeRouteEnter (to, from, next) {
	    next(function(vm) {
	    	var query = vm.$route.query
	    	vm.itemId = query.itemId
	    	
	    	rehaAPI.selectByIds({
	    		ids: JSON.stringify([vm.itemId])
	    	}).then(function(res) {
	    		if(res.status == 200) {
	    			var data = res.data[0]
	    			if(data) {
	    				vm.item = data
	    			}
	    		} else {
	    			
	    		}
	    	})
	    	
	    })
	},
	created: function() {
		var vm = this
	},
    mounted: function() {
    	var vm = this
    },
    methods: {
    	goBack: function() {
        	this.$router.back()
        }
    }
}

+ 50 - 0
component/rehabilitation/new-template-form.js

@ -0,0 +1,50 @@
var NewTemplateForm = {
    template: '<div>\
    				<div class="title-name c-f16">\
	    				<span class="c-vam">模板未命名</span>\
	    			</div>\
	    			<div class="c-t-center" style="margin-top: 240px;">\
	    				<span class="c-vam c-f14 mr5">模板名称: </span>\
	    				<input v-model="name" placeholder="请输入新模板名称" class="c-vam temp-name-inpt"/>\
	    				<a @click="save" href="javascript: void(0);" class="ml10 save-temp-name-btn c-f14 c-vam">保存</a>\
	    			</div>\
    			</div>',
    props: [],
    data: function() {
        return {
        	name:''
        }
    },
    mounted: function() {
    	var vm = this
    },
    methods: {
    	save: function() {
    		var vm = this
    		
    		if(vm.name) {
    			rehaAPI.createTemplate({
	    			doctor: storage.docInfo.code,
	    			title: vm.name
	    		}).then(function(res) {
	    			if(res.status == 200) {
	    				vm.$router.push({
			    			path:'/template-items',
			    			query: {
			    				name: vm.name,
			    				isNew: true,
			    				templateId: res.data
			    			}
			    		})
	    			} else {
	    				toastr && toastr.error(res.msg)
	    			}
	    			
	    		}).catch(function(e) {
	    			console.error(e)
	    		})
    		}
    	}
    }
}

+ 28 - 0
component/rehabilitation/new-template.js

@ -0,0 +1,28 @@
var NewTemplate = {
    template: '<div>\
    				<div class="title-name c-f16">\
	    				<span class="c-vam">模板未命名</span>\
	    			</div>\
	    			<div class="c-t-center">\
	    				<img src="../../../images/wushuju_img.png" class="wushuju"/>\
	    			</div>\
	    			<div class="c-t-center mt30">\
	    				<a @click="newTemplate" class="new-temp-btn">创建新模板</a>\
	    			</div>\
    			</div>',
    props: [],
    data: function() {
        return {
        }
    },
    mounted: function() {
    	var vm = this
    },
    methods: {
    	newTemplate: function() {
    		var vm = this
    		vm.$router.push('/new-template-form')
    	}
    }
}

+ 184 - 0
component/rehabilitation/template-items-select.js

@ -0,0 +1,184 @@
var TemplateItemsSelect = {
    template: '<div style="height: 100%;">\
    				<div class="title-name c-f16">\
	    				<span class="c-vam mr15">项目表</span><img @click="goBack" src="../../../images/fanhui02_icon.png" class="c-vam"/>\
	    			</div>\
	    			<div class="search-warp">\
						<input class="inp-search" v-model="searchName" placeholder="搜索项目名称" @input="debounceSearch"/>\
					</div>\
	    			<div class="mt10 pt10 pl10 ul-wrap">\
		    			<ul>\
							<li v-for="(s,i) in items" class="list-item c-f16" :class="{\'arrow-r\': !s.dropdown, \'arrow-d\': s.dropdown}" >\
								<span @click.stop="s.dropdown=!s.dropdown">{{itemType[s.itemType]}}</span>\
								<ul class="level-sec" v-show="s.dropdown">\
									<li v-for="(g, j) in s.item" class="list-item c-f14 ml15 mt15" :class="{\'arrow-r\': !g.dropdown, \'arrow-d\': g.dropdown}">\
										<span @click.stop="g.dropdown=!g.dropdown">{{g.itemName}}</span>\
										<ul class="level-third" v-show="g.dropdown" >\
											<li v-for="(o, k) in g.hospitalServiceItems" class="mt15" v-show="o.show">\
												<div class="list-item-name pl10 c-nowrap mr5">{{o.specialistServiceItemDO.title}}</div>\
												<a href="javascript:void(0);" @click="addItem(o)" class="add-item-btn" :class="{\'disabled\': !o.enable}">\
													添加\
												</a>\
											</li>\
										</ul>\
									</li>\
								</ul>\
							</li>\
						</ul>\
	    			</div>\
    			</div>',
    props: [],
    data: function() {
        return {
        	isNew: null,
        	searchName: "",
        	itemType: ["", "康复服务", "健康服务"],
        	items: [
//      		{
//      			name: "健康服务",
//      			dropdown: false,
//      			items: [
//      				{
//      					name: "门诊",
//      					dropdown: false,
//      					items: [
//      						{
//      							name: "专科医师每周两次查房,指导药物调整和诊疗",
//      							enable: true
//      						},
//      						{
//      							name: "专科医师每周两次查房,指导药物调整和诊疗",
//      							enable: false
//      						}
//      					]
//      				}
//      			]
//      		}
        	]
        }
    },
    beforeRouteEnter (to, from, next) {
	    next(function(vm) {
	    	var query = vm.$route.query
	    	if(vm.isNew == true || vm.isNew === "true") {
	    		vm.isNew = true
	    	} else {
	    		vm.isNew = false
	    	}
	    	vm.templateId = query.templateId
//	    	if((to.path == "/template-items" || to.path=="/template-item-detail") 
//	    	&& (from.path != "/template-item-detail" || from.path == "/")) {
//	    		
//	    	}
			if((to.path == "/template-item-detail" || from.path == "/template-item-detail" ) && from.path != "/") {
				return 
			}
			if(!vm.isNew) {
				vm.loading.show()
				vm.findTemplateDetail().then(function(res) {
					if(res.status == 200) {
						var selected = res.data
						var selectedIds = _.pluck(selected, "id")
						vm.findServiceItemsByHospital().then(function() {
							_.each(vm.items, function(o) {
				    			_.each(o.item,function(g) {
				    				_.each(g.hospitalServiceItems, function(v) {
				    					if(_.contains(selectedIds, v.id)) {
				    						v.enable = false
				    						EventBus.$emit("add-template-item", v)
				    					} else {
				    						v.enable = true
				    					}
				    				})
				    			})
				    		})
							vm.loading.close()
						}).catch(function(e) {
							vm.loading.close()
							console.error(e)
						})
					} else {
						vm.loading.close()
						toastr && toastr.error(res.msg)
					}
				})
			} else {
				vm.findServiceItemsByHospital()
			}
	    	
	    })
	 },
	created: function() {
		
	},
    mounted: function() {
    	var vm = this
		
    },
    methods: {
    	goBack: function() {
    		this.$router.replace('/');
    	},
    	addItem: function(o) {
    		o.enable = false
    		EventBus.$emit("add-template-item", o)
    	},
    	debounceSearch: _.debounce(function() {
			var vm = this
			if(vm.searchName.trim()) {
				_.each(vm.items, function(o) {
					o.dropdown = true
	    			_.each(o.item,function(g) {
	    				g.dropdown = true
	    				_.each(g.hospitalServiceItems, function(v) {
	    					if(v.specialistServiceItemDO.title.indexOf(vm.searchName)>-1) {
	    						v.show = true
	    					} else {
	    						v.show = false
	    					}
	    				})
	    			})
	    		})
			} else {
				_.each(vm.items, function(o) {
	    			_.each(o.item,function(g) {
	    				_.each(g.hospitalServiceItems, function(v) {
	    					v.show = true
	    				})
	    			})
	    		})
			}
    		
		}, 500, false),
		findServiceItemsByHospital: function(){
			var vm = this
		 	return rehaAPI.findServiceItemsByHospital({
		 		doctor: storage.docInfo.code
		 	}).then(function(res) {
	    		var items = res.data[0]
	    		vm.items = _.map(items, function(o) {
	    			o.dropdown = false
	    			o.item = _.map(o.item,function(g) {
	    				g.dropdown = false
	    				_.each(g.hospitalServiceItems, function(v) {
	    					v.enable = true
	    					v.show = true
	    				})
	    				return g
	    			})
	    			
	    			return o
	    		})
	    	})
		},
		findTemplateDetail: function() {
    		var vm = this
    		return rehaAPI.findTemplateDetail({
    			templateId: vm.templateId
    		}).then(function(res) {
    			return res
    		})
    	},
    }
}

+ 161 - 0
component/rehabilitation/template-items.js

@ -0,0 +1,161 @@
var TemplateItems = {
    template: '<div style="height: 100%;">\
    				<div class="title-name c-f16">\
	    				<span class="c-vam">{{name}}</span>\
	    			</div>\
	    			<div v-show="!items.length" class="c-t-center" style="margin-top: 200px;">\
	    				<img src="../../../images/fanhui_icon.png" class="c-vam"/>请在左侧“服务项”列表中选择\
	    			</div>\
	    			<div class="template-items" v-show="items.length">\
	    				<div class="item-card ptb10 plr15 mt10" v-for="(o, i) in items" @click="toDetail(o)">\
		    				<div class="c-nowrap">{{o.specialistServiceItemDO.title}}</div>\
			    			<div class="c-row c-f14 mt5">\
						        <div class="c-50">\
						        	<span class="c-909090">医&emsp;&emsp;院:</span>\
						        	<span>{{o.hospitalName}}</span>\
						        </div>\
						        <div class="c-50">\
						        	<span class="c-909090">执行人员:</span>\
						        	<span class="c-909090">待选择</span>\
						        </div>\
						    </div>\
						    <div class="c-row c-f14 mt5">\
						        <div class="c-50">\
						        	<span class="c-909090">计划时间:</span>\
						        	<span class="c-909090">待选择</span>\
						        </div>\
						        <div class="c-50">\
						        	<span class="c-909090">费&emsp;&emsp;用:</span>\
						        	<span>{{o.expense}}元</span>\
						        </div>\
						    </div>\
						    <img src="../../../images/qingchu_icon.png" class="item-delete-btn" @click.stop="deleteItem(o, i)"/>\
	    				</div>\
	    			</div>\
	    			<div class="foot-btns">\
			    		<a class="delete-btn c-t-center mr50" @click="deleteTemplate">\
			    			删除模板\
			    		</a>\
			    		<a class="save-btn c-t-center" @click="saveTemplate">\
			    			保存模板\
			    		</a>\
		    		</div>\
    			</div>',
    props: [],
    data: function() {
        return {
        	name: '',
        	items: [],
        	isNew: null,
        	templateId: "",
        	item: null
        }
    },
    beforeRouteEnter: function (to, from, next) {
	    next(function(vm) {
	    	var query = vm.$route.query
	    	vm.name = query.name || '模板未命名',
	    	vm.templateId = query.templateId
	    	if(from.path != "/template-item-detail" || from.path == "/") {
	    		vm.items = []
	    	}
	    	
	    	if(vm.isNew == true || vm.isNew === "true") {
	    		vm.isNew = true
	    	} else {
	    		vm.isNew = false
	    	}
	    })
	},
	created: function() {
		var vm = this
		EventBus.$on("add-template-item", function(o) {
			vm.items.push(o)
		})
	},
    mounted: function() {
    	var vm = this
		
    },
    methods: {
    	deleteItem: function(o, i) {
    		var vm = this
    		o.enable = true
    		vm.items.splice(i, 1)
    	},
    	saveTemplate: function() {
    		var vm = this
    		vm.loading.showModal()
    		rehaAPI.createTemplateDetail({
    			doctor: storage.docInfo.code,
    			json: JSON.stringify({
    				templateId: vm.templateId,
    				hospitalServiceItemId: _.pluck(vm.items, 'id').join(',')
    			}),
    			type: vm.isNew?"create":"edit"
    		}).then(function(res) {
    			if(res.status == 200) {
    				vm.loading.close()
    				toastr && toastr.success("保存成功")
    				EventBus.$emit("refresh-index")
        			vm.$router.back()
    			} else {
    				vm.loading.close()
    				toastr && toastr.error(res.msg)
    			}
    		}).catch(function(e) {
    			vm.loading.close()
    			console.error(e)
    		})
    	},
    	deleteTemplate: function() {
    		var vm = this
    		
    		var d = dialog({
				content: '确定删除该模板?',
				okValue: '确认',
				ok: function () {
					vm.loading.showModal()
					rehaAPI.deleteTemplate({
						templateId: vm.templateId
		            }).then(function(res) {
		            	vm.loading.close()
        				toastr && toastr.success("删除成功")
        				EventBus.$emit("refresh-index")
        				vm.$router.back()
		        	}).catch(function(e) {
		        		vm.loading.close()
		        		console.error(e)
		        	})
				},
				cancelValue: '取消',
				cancel: function () {}
			});
			d.showModal();
    	},
    	toDetail: function(o) {
    		var vm = this
    		vm.item = o
    		vm.$router.push({
    			path:"/template-item-detail",
    			query: {
    				templateId: vm.templateId,
    				itemId: o.id
    			}
    		})
    		
    	}
    },
//  watch: {
//	    '$route': function (to, from) {
//	    	var vm = this
////	    	if(to.path == "/template-item-detail" && (from.path != "/template-item-detail" || from.path == "/")) {
////	    		EventBus.$emit("show-item-detail", vm.item)
////	    	}
//			if(to.path == "/template-item-detail") {
//	    		EventBus.$emit("show-item-detail", vm.item)
//	    	}
//	    }
//	 }
}

+ 54 - 0
component/rehabilitation/template-list.js

@ -0,0 +1,54 @@
var TemplateList = {
    template: '<div>\
	    			<div class="title-name c-f16">\
	    				<span class="c-vam">模板库</span>\
	    			</div>\
					<ul>\
						<li v-for="(o,i) in items" class="temp-item c-nowrap c-t-center" @click="showTemplateDetail(o)">{{o.title}}</li>\
						<li class="temp-item c-nowrap c-t-center add" @click="newTemplate">添加新模板</li>\
					</ul>\
	   	 		</div>',
    props: [],
    data: function() {
        return {
        	items: []
        }
    },
    created: function() {
    	var vm = this
    	
    	vm.findTemplateList()
    	EventBus.$on("refresh-index",function() {
    		vm.findTemplateList()
    	})
    },
    mounted: function() {
    	var vm = this
		
    },
    methods: {
    	findTemplateList: function() {
    		var vm = this
    		rehaAPI.findTemplateList({
	    		doctor: storage.docInfo.code
	    	}).then(function(res) {
	    		vm.items = res.data
	    	})
    	},
    	showTemplateDetail: function(o) {
    		var vm = this
    		vm.$router.push({
    			path:'/template-items',
    			query: {
    				name: o.title,
    				isNew: false,
    				templateId: o.id
    			}
    		})
    	},
    	newTemplate: function() {
    		var vm = this
    		vm.$router.push('/new-template-form')
    	}
    }
}

BIN
images/qingchu_icon.png


BIN
images/shouqi_jiantou_icon.png


BIN
images/wushuju_img.png