remindDetail.js 2.67 KB
Newer Older
hanpeng committed
1 2 3 4 5
define(['zepto','medtap'],function($,medtap){
	var detail = {
		remindId:medtap.getRequest('remindId'),
		init:function(){
			detail.getDetail();
hanpeng committed
6
			detail.bindEve()
hanpeng committed
7 8 9
		},
		bindEve:function(){
			$('#no').unbind().bind('click',function(){
hanpeng committed
10 11 12 13 14 15
				var status = 2;
				detail.confirmMsg(status)
			});
			$('#yes').unbind().bind('click',function(){
				var status = 1;
				detail.confirmMsg(status)
hanpeng committed
16 17 18 19 20
			})
		},
		getDetail:function(){
			medtap.loading(1);
			medtap.submitAjax({
hanpeng committed
21
				url:'https://testdevgw.medtap.cn/operation/notify/getNotifyMessage',
hanpeng committed
22 23 24 25
				type:"post",
				contentType: 'application/json',
				async:false,
				data:{
hanpeng committed
26
					id:parseInt(detail.remindId)
hanpeng committed
27 28 29 30
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
hanpeng committed
31 32 33 34
						var info = res.content.uerNotifyDTO.messageInfo;
						if(res.content.uerNotifyDTO.confirmStatus == 0){
							//待确认
							$('.btn_warp').show();
hanpeng committed
35 36 37 38 39 40 41
						}else if(res.content.uerNotifyDTO.confirmStatus == 1){
							$('.remind_flag img').attr('src','../images/remind_my_result_yes_png@2x.png');
							$('.remind_flag').show();
							$('.btn_warp').hide();
						}else if(res.content.uerNotifyDTO.confirmStatus == 2){
							$('.remind_flag img').attr('src','../images/remind_my_result_no_png@2x.png');
							$('.remind_flag').show();
hanpeng committed
42 43
							$('.btn_warp').hide();
						}
hanpeng committed
44 45
						if(info.notifyType == 3){
							//就诊
hanpeng committed
46
							$('.remind_title').text('- 就诊提醒 -');
hanpeng committed
47
							$('.item .left_title').text('就诊类型:');
hanpeng committed
48
							$('.item .right_content').text(info.medicalTypeName)
hanpeng committed
49 50 51
							$('.remind_content').text(info.content);
						}else if(info.notifyType == 2){
							//检查
hanpeng committed
52
							$('.remind_title').text('- 检查提醒 -');
hanpeng committed
53
							$('.item .left_title').text('检查项目:');
hanpeng committed
54
							$('.item .right_content').text(info.checkItemName)
hanpeng committed
55
							$('.remind_content').text(info.content)
hanpeng committed
56
						}else if(info.notifyType == 1){
hanpeng committed
57
							//用药
hanpeng committed
58
							$('.remind_title').text('- 用药提醒 -');
hanpeng committed
59 60 61 62 63 64 65
							$('.item .left_title').text('药品名称:');
							$('.item .right_content').text(info.drugName)
							$('.remind_content').text(info.content)
						}
					}
				}
			})
hanpeng committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
		},
		confirmMsg:function(status){
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/operation/notify/confirmMessage',
				type:"post",
				contentType: 'application/json',
				async:false,
				data:{
					confirmStatus:status,
					remark:'',
					id:detail.remindId
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						medtap.toast({
							message:'确认成功',
							time:1500
						})
hanpeng committed
86 87 88
						setTimeout(function(){
							window.location.reload();
						})
hanpeng committed
89 90 91
					}
				}
			})
hanpeng committed
92 93 94 95
		}
	}
	detail.init();
})