<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>新增康复安排</title>
		<link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/new_recover.css" />
	</head>
	<body class="m0">
	<div id="app" v-cloak>
		<div class="c-position-a" style="top: -999px; left: -999px;" v-show="isTest"></div>
		<div class="c-h100 clearfix">
	        <div class="fl c-h100 w300 person_info c-border-r" style="overflow: hidden;">
	        	<div v-if="!patiInfo" class="c-h100" style="overflow: auto;">
		        	<div  class="c-border-b c-t-center pt20">
		        		<div class="set-photo imgw80">
		        			<img src="../../../images/p-female.png" alt="居民头像" />
		        		</div>
		        		<p class="ptb10">患者名</p>
		        	</div>
		        	<div>
		        		<div class="no-result c-t-center pt20">
		        			<img src="../images/wushuju01_img.png" alt="无数据" />
		        			<p class="c-999">暂无相关信息</p>
		        			<div class="pt30">
		        				<span class="c-fff btn cur-pit plr10 ptb5 bgc-12b7f5 b-r-3" @click="selectPatient()">同步信息</span>
		        			</div>
		        		</div>
		        	</div>
	        	</div>
	        	<div v-else class="c-h100 plr10" style="overflow: auto;">
	        		<div  class="c-t-center pt20 c-position-r">
		        		<div class="set-photo imgw80">
		        			<img :src="setPatImg(patiInfo.photo)" alt="居民头像" />
		        		</div>
		        		<h3 class="ptb10 m0 c-f16">{{patiInfo.name}}</h3>
		        		<span class="c-position-a set-qiehuan cur-pit" @click="selectPatient()"></span>
		        	</div>
		        	<h4 class="h30 m0 c-f14 c-border-b">基本信息</h4>
		        	<ul class="c-333 m0 p0 pb20">
		        		<li class="pt10"><span class="c-999">性&emsp;&emsp;别：</span>{{patiInfo.sex == 1 ? "男" : "女"}}</li>
		        		<li class="pt10"><span class="c-999">年&emsp;&emsp;龄：</span>{{patiInfo.age}}岁</li>
		        		<li class="pt10"><span class="c-999">身份证号：</span>{{patiInfo.idcard}}</li>
		        		<li class="pt10"><span class="c-999">地&emsp;&emsp;址：</span>{{patiInfo.address}}</li>
		        	</ul>
		        	<h4 class="h30 m0 c-f14 c-border-b">家庭医生</h4>
		        	<ul class="c-333 m0 p0 pb20">
		        		<li class="pt10"><span class="c-999">签约社区：</span>{{patiInfo.ssHospitalName || patiInfo.jtHospitalName}}</li>
		        		<li class="pt10"><span class="c-999">全科医生：</span>{{patiInfo.ssDoctorName || patiInfo.jtDoctorName}}</li>
		        		<li class="pt10"><span class="c-999">健&ensp;管&ensp;师：</span>{{patiInfo.ssDoctorHealthName || patiInfo.jtDoctorHealthName}}</li>
		        	</ul>
		        	<!--<h4 class="h30 m0 c-f14 c-border-b">诊疗信息</h4>
		        	<ul class="c-333 m0 p0 pb20">
		        		<li class="pt10"><span class="c-999">诊疗医院：</span>男</li>
		        		<li class="pt10"><span class="c-999">入院科室：</span>男</li>
		        		<li class="pt10"><span class="c-999">主治医师：</span>男</li>
		        		<li class="pt10"><span class="c-999">入院诊断：</span>男</li>
		        		<li class="pt10"><span class="c-999">出院诊断：</span>男</li>
		        	</ul>
		        	<h4 class="h30 m0 c-f14 c-border-b">出院小结</h4>
		        	<p class="m0 pt10 c-333">依旧本次判断，对新消息进行出院诊断做出以下结论：忧郁啥啥事等等等问题</p>-->
	        	</div>
	        </div>
	        <div class="fl c-h100 w-100-300">
	        	<div class="c-h100 plr5" v-if="!isPlan">
		        	<h4 class="m0 pl15 lh40 c-border-b c-position-r"><span class="c-position-a set-blue-span"></span>配置康复计划</h4>
		        	<div style="overflow: hidden; height: calc(100% - 41px);">
		        		<div style="overflow: auto; height: 100%;">
				        	<div class="un-select c-t-center pt45" v-if="!patiInfo">
				        		<img src="../images/wushuju_img.png" alt="" />
				        		<p class="c-999">您还没有选择居民</p>
				        	</div>
				        	<ul class="muban_con lh40 c-t-center pt30" v-else>
				        		<li class="mb20" v-for="(muban, index) in mubanList" :key="index" @click="addMuban(muban.id)">{{muban.title}}</li>
				        		<li class="addmuban-btn c-fff" @click="addMuban()">新增模板</li>
				        	</ul>
			        	</div>
			        </div>
		        </div>
		        <div class="clearfix c-h100" v-else>
		        	<div class="fl w-100-300 c-h100">
		        		<div class="plr5 c-h100-79">
		        			<h4 class="m0 pl15 lh40 c-border-b set-label c-position-r">
		        				<em class="c-position-a set-blue-span"></em>
		        				配置康复计划
		        				<span v-for="(label, index) in spanLabel" :key="index" class="fr ml20 pl20 c-f14 c-999 cur-pit" :class="{'active': index == labelIndex}" @click="setLabelIndex(index, label)">{{label.labelName}}</span>
		        			</h4>
		        			<div class="c-h100-41" style="overflow: hidden;">
		        				<ul class="c-h100 p0 m0" style="overflow: auto;">
		        					<li class="mt10 plr10 ptb5 c-border b-r-3 clearfix" v-for="(detail, index) in templateDetail" :key="index">
		        						<div class="fl w-100-78 c-333">
		        							<p class="m0 p0 mb10 txt-ells cur-pit" @click="lookProject(detail)">{{detail.specialistServiceItemDO.title}}</p>
	        								<div class="clearfix">
	        									<p class="m0 mb5 mr20 p0 fl"><span class="c-999">医&emsp;&emsp;院：</span>{{detail.hospitalName}}</p>
	        									<div class="m0 mb5 mr20 p0 fl clearfix">
	        										<span class="fl c-999">执行人员：</span>
	        										<div class="fl c-position-r w100">
	        											<p class="m0 p0 plr10 c-border cur-pit set-xia" :class="{'set-shang':detail.selectDoc}" @click="changeSelectDoc(index, detail.selectDoc)">{{detail.executeDoctorName}}</p>
	        											<ul class="m0 p0 c-border-b c-border-l c-border-r c-position-a doc_list" v-if="detail.selectDoc">
	        												<li class="plr10 c-border-t cur-pit" v-for="(list, indDoc) in detail.docList" :key="indDoc" @click="selectLi(index, list)">{{list.name}}</li>
	        											</ul>
	        										</div>
	        									</div>
	        									<p class="m0 mb5 p0 fl"><span class="c-999">费&emsp;&emsp;用：</span>{{detail.expense}}{{detail.specialistServiceItemDO.unit}}</p>
	        								</div>
		        							<div class="m0 p0 lh18 clearfix">
        										<span class="fl c-999">计划时间：</span>
        										<p class="fl lh18 mb5 mr20 clearfix" v-for="(time, ind) in detail.specialistServiceItemDO.executeTime" :key="ind" v-if="detail.specialistServiceItemDO.executeTime.length">
        											<span class="fl">{{time}}</span><span class="fl ml5 sub-tap cur-pit" @click="spliceTimeArr(index, ind)"></span>
        										</p>
        										<span class="fl c-12b7f5 cur-pit calendar" contenteditable="true" readonly @mousedown="selectTime(index)" class=flatpickr data-enable-time=true data-time_24hr=true>添加</span>
        										<span class="fl c-12b7f5 cur-pit ml10" v-show="sureIndex == index">确定</span>
        									</div>
		        						</div>
		        						<div class='fr w60 c-t-right clearfix'>
		        							<p class="m0 p0 mb10">×{{detail.specialistServiceItemDO.executeTime.length}}</p>
		        							<div class="fr sub-tap cur-pit" @click="subTemplate(index, detail)"></div>
		        						</div>
		        					</li>
		        					<li class="pt100 c-t-center" v-if="!templateDetail.length">
		        						<span class="set-right-arraw pr20">请在右侧“服务项”列表中选择</span>
		        					</li>
		        				</ul>
		        			</div>
		        		</div>
		        		<div>
	        				<p class="m0 p0 pl20 ptb10 c-border-b set-label">支付方式：<span class="ml10 pl20 active">按服务支付</span><em class="c-red ml20">(按选择支付方式完成收费)</em></p>
	        				<div class="pl20 lh40">总费用：
	        					<span class="c-red c-f16">￥{{allFee}}</span>
	        					<span class="fr lh30 cur-pit w80 c-t-center c-fff" :class="allFee ? 'bgc-12b7f5' : 'bgc-d7dce6'" @click="createRehabilitationPlan()">生成计划</span>
	        					<span class="fr lh30 cur-pit w80 c-t-center bgc-green c-fff" @click="canclePlan()">取消</span>
	        				</div>
	        			</div>
		        	</div>
		        	<div class="fr w300 c-h100 c-border-l">
		        		<div class="plr5 c-h100">
		        			<h4 class="m0 pl15 lh40 c-border-b c-position-r">
		        				<em class="c-position-a set-blue-span"></em>添加其他项目
		        			</h4>
		        			<div class="clearfix mtb10 c-border">
								<input class="fl search-input plr10" type="text" v-model="searchKey" placeholder="输入项目名称" />
								<span class="fr search-btn" @click="searchProject()"></span>
							</div>
							<div class="c-h100-99" style="overflow: hidden;">
								<ul class="c-h100 p0 m0" style="overflow: auto;">
									<li v-for="(project1, index) in projectList" :key="index">
										<h4 class="set-arrow c-f14 h30 p0 m0 pl20 cur-pit" :class="{'active': index == proIndex1}" @click="selectPro(1, index)">{{project1.itemType == 1 ? '康复服务' : '健康服务'}}</h4>
										<ul class="c-h100 p0 m0 pl10" v-if="index == proIndex1">
											<li v-for="(project2, index2) in project1.item" :key="index2">
												<p class="set-arrow h30 c-f14 pl20 m0 c-333 cur-pit" :class="{'active': index2 == proIndex2}" @click="selectPro(2, index2)">{{project2.itemName}}</p>
												<ul class="p0 m0 pr10" v-if="index2 == proIndex2">
													<li v-for="(project3, index3) in project2.hospitalServiceItems" :key="index3" class="clearfix ptb5">
														<div class="fl project c-border w-100-66 cur-pit border-c12b7f5 ptb5 plr5 b-r-3 clearfix" @click="selectProject(index, index2, index3, project3)">
															<p class="fl w-100-78 txt-ells lh18">{{project3.specialistServiceItemDO.title}}</p>
															<span class="fr lh18 b-r-3 c-f12 ml5 bgc-green plr5 c-fff" v-if="project3.flag == 1 || project3.flag == 3">社区</span>
															<span class="fr lh18 b-r-3 c-f12 ml5 bgc-12b7f5 plr5 c-fff" v-if="project3.flag == 2 || project3.flag == 3">医院</span>
														</div>
														<span class="fr h30 btn cur-pit plr10 bgc-12b7f5 c-fff b-r-3" v-if="!project3.isSelect" @click="addProject(index, index2, index3, project3)">添加</span>
														<span class="fr h30 btn plr10 bgc-e1e1e1 c-fff b-r-3" v-else>添加</span>
													</li>
												</ul>
											</li>
										</ul>
									</li>
								</ul>
							</div>
		        		</div>
		        	</div>
		        </div>
	        </div>
	    </div>
	</div>
		<script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/jquery-2.2.4.js"></script>
        <script src="../../../plugins/layer/layer.min.js"></script>
        <script src="../../../js/bootstrap.min.js"></script>
        <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="../../../js/flatpickr/flatpickr.min.css">
		<script src="../../../js/flatpickr/flatpickr.min.js"></script>
		<script src="../../../api/http-request.js" type="text/javascript"></script>
		<script src="../../../api/recover_api.js" type="text/javascript"></script>
		<script type="text/javascript">
			var doctorType = (JSON.parse(window.localStorage.getItem('wlyyAgent'))||{}).doctorType,
				docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
			var httpData=GetRequest()
			function showSuccessMessage(msg) {
				layer.msg(msg, {
					icon: 1
				})
			}
			
			function showErrorMessage(msg) {
				layer.msg(msg, {
					icon: 5
				})
			}
			
			function showWarningMessage(msg) {
				layer.msg(msg, {
					icon: 2
				})
			}
			
			function showInfoMessage(msg) {
				layer.msg(msg, {
					icon: 6
				})
			}
			// 初始化加载flatpickr插件
//			$(".calendar").flatpickr();
			
			recoverVue = new Vue({
                el: "#app",
                data: {
                	isTest: false,
                	pati: null,
                	isPlan: false,
                	proIndex1: null,
                	proIndex2: null,
                	patiInfo: null,
                	diseaseObj: null,
                	mubanList: [],
                	sureIndex: null,
                	templateDetail: [],
                	templateResult: [],
                	allFee: 0,
                	projectList: null,
                	labelIndex: 2,
                	labelCode: 1,
                	spanLabel: [{
                		labelName: "(转)家庭病床",
                		code: 3
                	}, {
                		labelName: "(转)社区医院",
                		code: 2
                	}, {
                		labelName: "康复计划",
                		code: 1
                	}],
                	jDlist: null,
                	zDlist: null,
                	selectProjectDetail: null,
                	searchKey: null
                },
                mounted: function() {
                	
                },
                methods: {
                	// 获取居民信息
                	getPatientInfo: function() {
                		this.findPatientSignSpecialistInfo()
                		var vm = this,
			    			loadding = layer.load(0, {shade: false}),
			    			params = {
			    				patient: this.pati.patient
			    			}
						recoverAPI.getPatientInfo(params).then(function(res) {
							layer.close(loadding)
							if(res.status == 200) {
								vm.patiInfo = res.data
								console.log(vm.patiInfo)
								vm.jDlist = [{
									name: vm.patiInfo.ssDoctorName || vm.patiInfo.jtDoctorName,
									code: vm.patiInfo.ssDoctor || vm.patiInfo.jtDoctor
								}, {
									name: vm.patiInfo.ssDoctorHealthName || vm.patiInfo.jtDoctorHealthName,
									code: vm.patiInfo.ssDoctorHealth || vm.patiInfo.jtDoctorHealth
								}]
							} else {
								showErrorMessage(res.msg);
							}
						})
                	},
                	findPatientSignSpecialistInfo: function() {
                		var vm = this,
			    			params = {
			    				patient: this.pati.patient,
			    				doctor: docInfo.uid
			    			}
						recoverAPI.findPatientSignSpecialistInfo(params).then(function(res) {
							if(res.status == 200) {
								vm.zDlist = [{
									name: res.data.doctorName,
									code: res.data.doctor
								}, {
									name: res.data.healthAssistantName,
									code: res.data.healthAssistant
								}]
							} else {
								showErrorMessage(res.msg);
							}
						})
                	},
                	// 模板列表
                	findTemplateList: function() {
                		var vm = this,
			    			loadding = layer.load(0, {shade: false}),
			    			params = {
			    				patient: this.pati.patient,
			    				doctor: docInfo.uid
			    			}
						recoverAPI.findTemplateList(params).then(function(res) {
							layer.close(loadding)
							if(res.status == 200) {
								vm.mubanList = res.data
							} else {
								showErrorMessage(res.msg);
							}
						})
                	},
                	// 模板详细
                	findTemplateDetail: function(templateId) {
                		var vm = this,
			    			loadding = layer.load(0, {shade: false}),
			    			params = {
			    				templateId: templateId
			    			}
						recoverAPI.findTemplateDetail(params).then(function(res) {
							layer.close(loadding)
							if(res.status == 200) {
								vm.templateDetail = []
								vm.templateResult = res.data
								vm.findServiceItemsByHospital()
							} else {
								showErrorMessage(res.msg);
							}
						})
                	},
                	// 服务项目列表
                	findServiceItemsByHospital: function() {
                		var vm = this,
			    			loadding = layer.load(0, {shade: false}),
			    			params = {
			    				doctor: docInfo.uid,
								patient: this.pati.patient,
								serviceItemName: this.searchKey
			    			}
						recoverAPI.findServiceItemsByHospital(params).then(function(res) {
							layer.close(loadding)
							if(res.status == 200) {
								vm.projectList = $.each(res.data[0], function(index, o) {
									$.each(vm.templateResult, function(index1, o1) {
										if(o1.specialistServiceItemDO.itemType == o.itemType) {
											$.each(o.item, function(index2, o2) {
												if(o1.specialistServiceItemDO.diseaseItem == o2.itemName) {
													$.each(o2.hospitalServiceItems, function(index3, o3) {
														if(o3.serviceItemId == o1.serviceItemId) {
															o3.isSelect = true
															o3.selectDoc = false
															o3.specialistServiceItemDO.executeTime = []
															if(o3.flag == 2) {
																o3.executeDoctor = vm.zDlist[0].code
																o3.executeDoctorName = vm.zDlist[0].name
																o3.docList = vm.zDlist
															} else {
																o3.executeDoctor = vm.jDlist[0].code
																o3.executeDoctorName = vm.jDlist[0].name
																o3.docList = vm.jDlist
															}
															vm.templateDetail.push(o3)
														}
													});
												}
											});
										}
									});
									return o;
								});
							} else {
								showErrorMessage(res.msg);
							}
						})
                	},
                	searchProject: function() {
                		this.findServiceItemsByHospital()
                	},
                	setPatImg: function(src) {
			    		if(!src) {
			    			return "../../../images/p-female.png"
			    		} else {
			    			var str = httpRequest.getImgUrl(src);
			    			return str
			    		}
			    	},
			    	changeSelectDoc: function(index, bool) {
			    		this.templateDetail[index].selectDoc = !bool
			    		this.isTest = !this.isTest
			    	},
			    	selectLi: function(index, list) {
			    		this.templateDetail[index].selectDoc = false
			    		this.templateDetail[index].executeDoctor = list.code
			    		this.templateDetail[index].executeDoctorName = list.name
			    		this.templateDetail[index] = this.templateDetail[index]
			    		this.isTest = !this.isTest
			    	},
			    	subTemplate: function(index, detail) {
			    		var vm = this
			    		this.templateDetail.splice(index, 1)
			    		var len = detail.specialistServiceItemDO.executeTime.length
			    		if(len) {
			    			this.allFee -= (len * detail.expense)
			    		}
			    		$.each(vm.projectList, function(index, o) {
							if(detail.specialistServiceItemDO.itemType == o.itemType) {
								$.each(o.item, function(index2, o2) {
									if(detail.specialistServiceItemDO.diseaseItem == o2.itemName) {
										$.each(o2.hospitalServiceItems, function(index3, o3) {
											if(o3.serviceItemId == detail.serviceItemId) {
												o3.isSelect = false
												o3.specialistServiceItemDO.executeTime = []
											}
										});
									}
								});
							}
						});
			    	},
			    	// 选择项目
			    	selectProject: function(index, index2, index3, o) {
			    		this.selectProjectDetail = o
                		selectPatientIndex = layer.open({
							type: 2,
							area: ['400px', '500px'],
							shade: 0.5,
							title: '选择项目',
							closeBtn: 1,
							shift: 5,
							shadeClose: false, //点击遮罩关闭层
							content: "select-project.html?isLook=true&projectId=" + o.id + "&index=" + index + "&index3=" + index3 + "&index2=" + index2
						});
                	},
                	// 添加项目
                	addProject: function(index, index2, index3, obj) {
                		if(obj) {
                			this.selectProjectDetail = obj
                		}
                		if(this.selectProjectDetail.isSelect) {
                			showWarningMessage("已添加！")
                			return false;
                		}
                		this.selectProjectDetail.isSelect = true
                		this.selectProjectDetail.selectDoc = false
                		this.selectProjectDetail.specialistServiceItemDO.executeTime = []
						if(this.selectProjectDetail.flag == 2) {
							this.selectProjectDetail.executeDoctor = this.zDlist[0].code
							this.selectProjectDetail.executeDoctorName = this.zDlist[0].name
							this.selectProjectDetail.docList = this.zDlist
						} else {
							this.selectProjectDetail.executeDoctor = this.jDlist[0].code
							this.selectProjectDetail.executeDoctorName = this.jDlist[0].name
							this.selectProjectDetail.docList = this.jDlist
						}
                		this.templateDetail.push(this.selectProjectDetail)
                		this.projectList[index].item[index2].hospitalServiceItems[index3] = this.selectProjectDetail
                	},
                	// 查看项目
                	lookProject: function(o) {
                		selectPatientIndex = layer.open({
							type: 2,
							area: ['400px', '500px'],
							shade: 0.5,
							title: '查看项目',
							closeBtn: 1,
							shift: 5,
							shadeClose: false, //点击遮罩关闭层
							content: "select-project.html?projectId=" + o.id
						});
                	},
                	selectPatient: function() {
                		selectPatientIndex = layer.open({
							type: 2,
							area: ['400px', '500px'],
							shade: 0.5,
							title: '同步出院小结',
							closeBtn: 1,
							shift: 5,
							shadeClose: false, //点击遮罩关闭层
							content: "select-patient.html"
						});
                	},
                	selectPatientOk: function(pati) {
                		this.isPlan = false
                		this.pati = pati
                		this.getPatientInfo()
                		this.findTemplateList()
                	},
                	addMuban: function(oId) {
                		var vm = this
                		selectDiseaseIndex = layer.open({
							type: 2,
							area: ['400px', '500px'],
							shade: 0.5,
							title: '选择疾病',
							closeBtn: 1,
							shift: 5,
							shadeClose: false, //点击遮罩关闭层
							content: "select-disease.html?teamCode=" + vm.pati.teamCode +"&templateId=" + oId || ''
						});
                	},
                	canclePlan: function(obj) {
                		this.isPlan = false
                		this.allFee = 0
                	},
                	newPlan: function(disease, templateId) {
                		this.diseaseObj = disease
                		this.isPlan = true
                		if(templateId) {
                			this.findTemplateDetail(templateId)
                		} else {
	                		this.templateDetail = []
	                		this.findServiceItemsByHospital()
	                	}
                	},
                	selectPro: function(pro, index) {
                		if(pro == 1) {
                			this.proIndex2 = null;
                			this.proIndex1 == index ? this.proIndex1 = null : this.proIndex1 = index
                		} else {
                			this.proIndex2 == index ? this.proIndex2 = null : this.proIndex2 = index
                		}
                	},
                	setLabelIndex: function(index, label) {
                		this.labelIndex = index
                		this.labelCode = label.code
                	},
                	selectTime: function(index) {
                		var currentEle = $(event.target),
                			vm = this;
                		this.sureIndex = index
                		currentEle.flatpickr({
                			defaultDate: currentEle.val(),
                			minDate: "today",
                			enableTime: true,
                			onOpen: function(obj, str) {
                				currentEle.val(str)
                			},
                			onClose: function(obj, str) {
                				if(!str) {
                					return false;
                				}
                				vm.sureIndex = null
                				vm.templateDetail[index].specialistServiceItemDO.executeTime.push(str)
                				vm.allFee += Number(vm.templateDetail[index].expense)
                			}
                		})
                	},
                	spliceTimeArr: function(index, ind) {
                		this.templateDetail[index].specialistServiceItemDO.executeTime.splice(ind, 1)
                		this.allFee -= Number(this.templateDetail[index].expense)
                	},
                	createRehabilitationPlan: function() {
                		if(!this.allFee) {
                			showWarningMessage("请选择计划时间！")
                			return false;
                		}
                		var vm = this,
			    			loadding = layer.load(0, {shade: false}),
			    			data = {
			    				patient: this.pati.patient,
			    				name: this.pati.patientName,
			    				title: this.pati.patientName + this.diseaseObj.diseaseName + "康复计划",
			    				disease: this.diseaseObj.diseaseCode,
			    				diseaseName: this.diseaseObj.diseaseName,
			    				planType: this.labelCode,
			    				payment: 2,
			    				totalExpense: this.allFee,
			    				detail: []
			    			},
			    			params = {};
			    		$.each(vm.templateDetail, function(index, o) {
			    			if(o.specialistServiceItemDO.executeTime.length) {
			    				var obj = {
			    					hospitalServiceItemId: o.id,
			    					type: o.flag == 2 ? 2 : 1,
			    					doctor: o.executeDoctor,
			    					doctorName: o.executeDoctorName,
			    					executeTime: o.specialistServiceItemDO.executeTime.join(",")
			    				}
			    				data.detail.push(obj)
			    			}
			    		});
			    		params = {
			    			json: JSON.stringify(data)
			    		}
						recoverAPI.createRehabilitationPlan(params).then(function(res) {
							layer.close(loadding)
							if(res.status == 200) {
								showSuccessMessage("康复计划配置成功！")
								setTimeout(function() {
									window.location.href = "../../rehabilitation/html/health_control.html"
								}, 1000)
							} else {
								showErrorMessage(res.msg);
							}
						})
                	}
                }
            })
		</script>
	</body>
</html>
