define(['zepto', 'medtap', 'mui', 'mui.picker'], function($, medtap, mui) {
	var patientInfo = {
		selectGender: '',
		notLung:true,
		userPicker: [],
		showUserPickerButton: [],
		userResult: [],
		dPicker: null,
		smokingFlg:'',
		smokingYear: '',
		smokingDailyNum: '',
		canSkip:medtap.getRequest('canSkip'),
		toLink:medtap.getRequest('toLink'),
		wechatId:medtap.getRequest('wechatId'),
		sexData: [{
				text: '男',
				value: 'M'
			},
			{
				text: '女',
				value: 'F'
			}
		],
		diseaseData: [{
			text: '肺癌',
			value: '1009'
		}, {
			text: '其他',
			value: '1094'
		}],
		pathologyData: [{
			text: '小细胞肺癌',
			value: 'LPT2',
			children: [{
				text: ' ',
				value: 'LPT2',
				showText: ''
			}]
		}, {
			text: '非小细胞肺癌',
			value: 'LPT3',
			children: [{
				text: '腺癌',
				value: 'LPT4',
				showText: '腺癌'
			}, {
				text: '鳞癌',
				value: 'LPT5',
				showText: '鳞癌'
			}, {
				text: '大细胞癌',
				value: 'LPT6',
				showText: '大细胞癌'
			}]
		}, {
			text: '不清楚',
			value: 'LPT7',
			children: [{
				text: ' ',
				value: 'LPT7',
				showText: ''
			}]
		}],
		stagesData: [{
			text: '原位癌0期',
			value: 'CTS1'
		}, {
			text: 'ⅠA 期',
			value: 'CTS2'
		}, {
			text: 'ⅠB 期',
			value: 'CTS3'
		}, {
			text: 'ⅡA期',
			value: 'CTS4'
		}, {
			text: 'ⅡB 期',
			value: 'CTS5'
		}, {
			text: 'ⅢA 期',
			value: 'CTS6'
		}, {
			text: 'ⅢB 期',
			value: 'CTS7'
		}, {
			text: 'ⅢC 期',
			value: 'CTS8'
		}, {
			text: 'ⅣA 期',
			value: 'CTS9'
		}, {
			text: 'ⅣB 期',
			value: 'CTS10'
		}],
		TNM_Data: [{
			text: 'Tis',
			value: '01',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T1',
			value: '02',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T1a',
			value: '03',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T1b',
			value: '04',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T2',
			value: '05',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T2a',
			value: '06',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}, {
			text: 'T2b',
			value: '07',
			children: [{
				text: 'N0',
				value: '01',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N1',
				value: '02',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N2',
				value: '03',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}, {
				text: 'N3',
				value: '04',
				children: [{
					text: 'M0',
					value: '01',
				}, {
					text: 'M1a',
					value: '02'
				}, {
					text: 'M1b',
					value: '03'
				}, {
					text: 'M1c',
					value: '04'
				}]
			}]
		}],
		transferData: [{
			text: '无转移',
			value: 'CTN1'
		}, {
			text: '脑转移',
			value: 'CTN2'
		}, {
			text: '骨转移',
			value: 'CTN3'
		}, {
			text: '肝转移',
			value: 'CTN4'
		}, {
			text: '淋巴转移',
			value: 'CTN5'
		}, {
			text: '肾及肾上腺转移',
			value: 'CTN6'
		}, {
			text: '其他部位转移',
			value: 'CTN7'
		}],
		ecogGradeData: [{
			text: '0分 正常生活',
			value: 'ECOG1'
		}, {
			text: '1分 有症状，但不需要卧床休息，生活可自理',
			value: 'ECOG2'
		}, {
			text: '2分 50%以上时间不需要卧床，偶需照顾',
			value: 'ECOG3'
		}, {
			text: '3分 50%以上时间需要卧床，需特殊照顾',
			value: 'ECOG4'
		}, {
			text: '4分 卧床不起',
			value: 'ECOG5'
		}, {
			text: '5分 死亡',
			value: 'ECOG6'
		}],
		init: function() {
			window.onload = function(){
				$('.input_list input').val('');
			}
			if(patientInfo.canSkip == 'true'){
				$('.skip').show();
				$('.skip').unbind().bind('click',function(){
					//medtap.pushWindow('doctorHomePage.html?doctorId=' + medtap.getRequest('doctorId') + '&operationType=' + medtap.getRequest('operationType'))
					switch (patientInfo.toLink){
						case 'MYDOCTOR':
							window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myDoctor.html?wechatId=' + patientInfo.wechatId)
							break;
						case 'MYEMR':
							window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myEMR.html?wechatId=' + patientInfo.wechatId);
							break;
						case 'MYREMIND':
							window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myRemind.html?wechatId=' + patientInfo.wechatId);
							break;
						case 'MYCONSULT':
							window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myConsult.html?wechatId=' + patientInfo.wechatId);
						default:
							break;
					}
				})
			}else{
				$('.skip').hide();
			}
			patientInfo.initSex();
			patientInfo.initBirth();
			patientInfo.initdisease();
			patientInfo.initpathology();
			patientInfo.initStages();
			patientInfo.initTNMStage();
			patientInfo.initTransfer();
			patientInfo.initEcog();
			patientInfo.initCity();
			patientInfo.bindEve();
		},
		bindEve: function() {
			$('.somke_typeBox').on('click', function() {
				$('.content_mod').show();
				$('.somke_warp').show();
				$('.somke_select').on('click', function() {
					$(this).children('img').attr('src', '../images/pop_select_active@2x.png');
					$(this).siblings('.somke_select').children('img').attr('src', '../images/pop_select_default@2x.png');
					$(this).attr('data-select', 'yes');
					$(this).siblings('.somke_select').attr('data-select', 'no');
					if ($('.yes').attr('data-select') == 'yes') {
						$('.somke_content_item').children('input').removeAttr('disabled');
						$('.somke_content_item').children('input').attr('placeholder', '请输入');
						$('.somke_content_item').children('input').removeClass('inputNone');
					} else if ($('.no').attr('data-select') == 'yes') {
						$('#somkeYear').val('');
						$('#somkeNum').val('');
						$('.somke_content_item').children('input').attr('disabled', 'disabled');
						$('.somke_content_item').children('input').attr('placeholder', '');
						$('.somke_content_item').children('input').addClass('inputNone');
					}
				})
			});
			$('.smoke_btn').on('click', function() {
				if ($('.yes').attr('data-select') == 'yes') {
					if(!$('#somkeYear').val()){
						medtap.toast({
							message:'请输入吸烟时长',
							time:1500
						})
					}else if(!$('#somkeNum').val()){
						medtap.toast({
							message:'请输入每日吸烟量',
							time:1500
						})
					}else{
						patientInfo.smokingFlg = true;
						patientInfo.smokingYear = $('#somkeYear').val();
						patientInfo.smokingDailyNum = $('#somkeNum').val();
						$('.content_mod').hide();
						$('.somke_warp').hide();
						$('#somke').val(patientInfo.smokingYear + '年'+ ' ' + patientInfo.smokingDailyNum +'支/天')
					}
				} else if ($('.no').attr('data-select') == 'yes') {
					$('.content_mod').hide();
					$('.somke_warp').hide();
					$('#somkeYear').val('');
					$('#somkeNum').val('');
					$('#somke').val('无');
					patientInfo.smokingFlg = false;
					patientInfo.smokingYear = '';
					patientInfo.smokingDailyNum = '';
				}
			});
			
			$('.next').on('click',function(){
				if(patientInfo.checkValue() == true){
					patientInfo.postData();
				}else{
					
				}
			});
			$('.pre').unbind().bind('click',function(){
				window.history.go(-1);
			});
			
		},
		initBirth: function() {
			$('#birth_typeBox').on('click', function() {
				var year = new Date().getFullYear();
				var month = new Date().getMonth();
				var day = new Date().getDate();
				patientInfo.dPicker = new mui.DtPicker({
					"type": "date",
					"beginYear": 1900,
					"endDate": new Date(year, month, day)
				});
				patientInfo.dPicker.show(function(rs) {
					$('#birth').val(rs.text);
				});
			});
		},
		initSex: function() {
			patientInfo.initPickers(8, 'sex_typeBox', 'sex', patientInfo.sexData, 1)
		},
		initdisease: function() {
			patientInfo.initPickers(3, 'disease_typeBox', 'disease', patientInfo.diseaseData, 1);
		},
		initpathology: function() {
			patientInfo.initPickers(1, 'pathology_typeBox', 'pathology', patientInfo.pathologyData, 2);
		},
		initStages: function() {
			patientInfo.initPickers(2, 'stages_typeBox', 'stages', patientInfo.stagesData, 1);
		},
		initTNMStage: function() {
			patientInfo.initPickers(4, 'stages_TNM_typeBox', 'stages_TNM', patientInfo.TNM_Data, 3);
		},
		initTransfer: function() {
			patientInfo.initPickers(5, 'transfer_typeBox', 'transfer', patientInfo.transferData, 1)
		},
		initEcog: function() {
			patientInfo.initPickers(6, 'ECOG_typeBox', 'ECOG', patientInfo.ecogGradeData, 1);
		},
		initCity: function() {
			medtap.loading(1);
			$.ajax({
				url: "https://testdevgw.medtap.cn/common/listAreaV0",
				data: {},
				type: 'get',
				async: true,
				success: function(data) {
					medtap.loading(0);
					if (data.success) {
						var arr = data.content.areas;
						var cityData = [];
						for (var i = 0, len = arr.length; i < len; i++) {
							var obj = {};
							obj.text = arr[i].name;
							obj.value = arr[i].provinceId;
							var temp = [];
							for (var j = 0, len2 = arr[i].city.length; j < len2; j++) {
								var item = arr[i].city[j];
								var o = {};
								o.text = item.name;
								o.value = item.cityId;
								temp.push(o);
							}
							obj.children = temp;
							cityData.push(obj);
						}
						patientInfo.initPickers(7, 'location_typeBox', 'location', cityData, 2);
					}
				},
				error: function(data) {
					medtapCore.jzz(0);
					mui.toast('获取所在地失败');
				}
			});
		},
		initPickers: function(index, el, tarEl, vals, layer) {
			var _this = this;
			_this.userPicker[index] = new mui.PopPicker({
				layer: layer
			});
			_this.userPicker[index].setData(vals);
			_this.showUserPickerButton[index] = document.getElementById(el);
			_this.userResult[index] = document.getElementById(tarEl);
			_this.showUserPickerButton[index].addEventListener('tap', function(event) {
				_this.userPicker[index].show(function(items) {
					if (layer == 1) {
						document.getElementById(tarEl).nodeName === 'INPUT' || document.getElementById(tarEl).nodeName ===
							'TEXTAREA' ?
							(_this.userResult[index].value = items[0]['text']) :
							(_this.userResult[index].innerHTML = items[0]['text']);
						_this.userResult[index].setAttribute("sendKey", items[0]['value']);
						if(tarEl == 'disease'){
							if(items[0]['text'] == '肺癌'){
								$('.not_lung').show();
								$('#disease').parents('.input_item').css('border-bottom','0.01rem solid #e0e0e0');
								patientInfo.notLung = true;
							}else{
								$('.not_lung').hide();
								$('#disease').parents('.input_item').css('border','none');
								patientInfo.notLung = false;
							}
						}
					} else if (layer == 2) {
						//只显示第二级的数据
						document.getElementById(tarEl).nodeName === 'INPUT' || document.getElementById(tarEl).nodeName ===
							'TEXTAREA' ?
							(_this.userResult[index].value = items[0]['text'] + items[1]['text']) :
							(_this.userResult[index].innerHTML = items[0]['text'] + ' ' + items[1]['text']);
						_this.userResult[index].setAttribute("sendKey", items[0]['value']);
						if (tarEl == 'disease') {
							document.getElementById(tarEl).setAttribute('diseaseid', items[1]['value']);
							_this.userResult[index].setAttribute("sendKey", items[1]['value']);
						} else if (tarEl == 'location') {
							document.getElementById(tarEl).setAttribute('locationid', items[1]['value']);
							_this.userResult[index].setAttribute("sendKey", items[1]['value']);
						} else if (tarEl == 'pathology') {
							document.getElementById(tarEl).setAttribute('pathologyId', items[1]['value']);
							if (items[1].showText != '') {
								_this.userResult[index].innerHTML = items[1]['showText'];
								_this.userResult[index].value = items[1]['showText'];
							} else {
								_this.userResult[index].innerHTML = items[0]['text'];
								_this.userResult[index].value = items[0]['text']
							}
							_this.userResult[index].setAttribute("sendKey", items[1]['value']);
						}
					} else if (layer == 3) {
						document.getElementById(tarEl).nodeName === 'INPUT' || document.getElementById(tarEl).nodeName ===
							'TEXTAREA' ?
							(_this.userResult[index].value = items[0]['text'] + items[1]['text'] + items[2]['text']) :
							(_this.userResult[index].innerHTML = items[0]['text'] + ' ' + items[1]['text'] + '' + items[2]['text']);
						_this.userResult[index].setAttribute("sendKey", items[0]['value']);
					}

				});
			}, false);
		},
		checkValue:function(){
			var flag = false;
			if(patientInfo.notLung == true){
				if(!$('#username').val()){
					medtap.toast({
						message:'请输入真实姓名',
						time:1500
					});
					flag = false;
				}else if(!$('#sex').val()){
					medtap.toast({
						message:'请选择性别',
						time:1500
					});
					flag = false;
				}else if(!$('#birth').val()){
					medtap.toast({
						message:'请选择出生日期',
						time:1500
					});
					flag = false;
				}else if(!$('#disease').val()){
					medtap.toast({
						message:'请选择疾病诊断',
						time:1500
					});
					flag = false;
				}else if(!$('#pathology').val()){
					medtap.toast({
						message:'请选择病理类型',
						time:1500
					});
					flag = false;
				}else{
					flag = true;
				}
			}else if(patientInfo.notLung == false){
				if(!$('#username').val()){
					medtap.toast({
						message:'请输入真实姓名',
						time:1500
					});
					flag = false;
				}else if(!$('#sex').val()){
					medtap.toast({
						message:'请选择性别',
						time:1500
					});
					flag = false;
				}else if(!$('#birth').val()){
					medtap.toast({
						message:'请选择出生日期',
						time:1500
					});
					flag = false;
				}else if(!$('#disease').val()){
					medtap.toast({
						message:'请选择疾病诊断',
						time:1500
					});
					flag = false;
				}else{
					flag = true;
				}
			}
			
			return flag;
		},
		postData:function(){
			var pathologyType = ''
			if($('#disease').attr('sendkey') == '1009'){
				pathologyType = $('#pathology').attr('sendkey');
			}else{
				pathologyType = '';
			}
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/user/patientEMR/createPatientEMR',
				type:'post',
				contentType: "application/json",
				async:false,
				data:{
					patientName:$('#username').val(),
					sex:$('#sex').attr('sendkey'),
					birthday:$('#birth').val(),
					diseaseDiagnosis:parseInt($('#disease').attr('sendkey')),
					height:parseInt($('#height').val() || ''),
					weight:parseInt($('#weight').val() || ''),
					pathologyType:pathologyType,
					tumorStage:$('#stages').attr('sendkey') || '',
					tnmStage:$('#stages_TNM').val() || '',
					transferNidus:$('#transfer').attr('sendkey') || '',
					smokingFlg:patientInfo.smokingFlg,
					smokingYear:parseInt(patientInfo.smokingYear) || '',
					smokingDailyNum	:parseInt(patientInfo.smokingDailyNum) || '',
					ecogGrade:$('#ECOG').attr('sendkey'),
					patientHospitalIdNum:$('#idCard').val() || '',
					cityId:parseInt($('#location').attr('locationid')),
					infoStep:1
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						var emrId = res.content.patientEMR.emrId;
						localStorage.setItem('emrId',emrId);
						medtap.loading(1);
						setTimeout(function(){
							//medtap.pushWindow('createTreatmentInfo.html?emrId=' + emrId + '&doctorId=' + medtap.getRequest('doctorId') + '&operationType=' + medtap.getRequest('operationType'));
							if(patientInfo.notLung == true){
								medtap.pushWindow('createTreatmentInfo.html?emrId=' + emrId + '&doctorId=' + medtap.getRequest('doctorId') + '&operationType=' + medtap.getRequest('operationType') + '&wechatId=' + patientInfo.wechatId + '&toLink=' + patientInfo.toLink);
							}else{
								//medtap.pushWindow('doctorHomePage.html?doctorId=' + medtap.getRequest('doctorId') + '&operationType=' + medtap.getRequest('operationType'));
								switch (patientInfo.toLink){
									case 'MYDOCTOR':
										window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myDoctor.html?wechatId=' + patientInfo.wechatId)
										break;
									case 'MYEMR':
										window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myEMR.html?wechatId=' + patientInfo.wechatId);
										break;
									case 'MYREMIND':
										window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myRemind.html?wechatId=' + patientInfo.wechatId);
										break;
									case 'MYCONSULT':
										window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_myHome/pages/myConsult.html?wechatId=' + patientInfo.wechatId);
									default:
										break;
								}
							}
						},1500)
					}
				}
			})
		},
		upDateUserEmr:function(){
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/user/patientEMR/updatePatientEMR',
				type:'post',
				contentType: "application/json",
				async:false,
				data:{
					patientName:$('#username').val(),
					sex:$('#sex').attr('sendkey'),
					birthday:$('#birth').val(),
					diseaseDiagnosis:$('#disease').attr('sendkey') || '',
					height:parseInt($('#height').val() || ''),
					pathologyType:$('#pathology').attr('sendkey') || '',
					tumorStage:$('#stages').attr('sendkey') || '',
					tnmStage:$('#stages_TNM').val() || '',
					transferNidus:$('#transfer').attr('sendkey') || '',
					smokingFlg:patientInfo.smokingFlg,
					smokingYear:parseInt(patientInfo.smokingYear) || '',
					smokingDailyNum	:parseInt(patientInfo.smokingDailyNum) || '',
					ecogGrade:$('#ECOG').attr('sendkey'),
					patientHospitalIdNum:$('#idCard').val() || '',
					cityId:parseInt($('#location').attr('locationid')),
					infoStep:1,
					emrId:parseInt(localStorage.emrId)
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						var emrId = res.content.patientEMR.emrId;
						localStorage.setItem('emrId',emrId);
						medtap.loading(1);
						setTimeout(function(){
							medtap.pushWindow('createTreatmentInfo.html?emrId=' + emrId + '&doctorId=' + medtap.getRequest('doctorId'));
						},1500)
					}
				}
			})
		}
	}
	patientInfo.init();
})
