myEMR.js 6.13 KB
Newer Older
hanpeng committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
define(['zepto','medtap'],function($,medtap){
	var myEmr = {
		userId:medtap.getRequest('userId'),
		init:function(){
			myEmr.getMyEmr();
			myEmr.bindEve();
		},
		bindEve:function(){
			/* $('.change_emr').unbind().bind('click',function(){
				medtap.pushWindow('createPatientInfo.html?id=' + myEmr.emrId);
			});
			$('.add_new_btn').unbind().bind('click',function(){
				medtap.pushWindow('createPatientInfo.html');
			}) */
hanpeng committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
			$('.img_warp img').unbind().bind('click', function() {
				var imgObject = {};
				var imgSelect = $(this).index();
				var imgIndex = 0;
				var urls = [],
					picUrl = "";
				[].forEach.call($('.img_warp img'),function(item,index){
					if($(item).index() == imgSelect){
						imgIndex = index;
					}
					urls.push($(item).attr('src'));
				})
				imgObject.imgList = urls;
				imgObject.imgIndex = imgIndex;
				try {
					if (!WebAPI) {
				
					}
					try {
						WebAPI.showImages(imgObject);
					} catch (e) {
				
					}
				} catch (e) {
				
				}
			})
hanpeng committed
42 43 44 45 46 47 48 49 50 51 52 53 54
		},
		getMyEmr:function(){
			medtap.jzz(1);
			$.ajax({
				url:'https://testdevgw.medtap.cn/user/patientEMR/getPatientEMRInfo',
				type:'post',
				async:false,
				contentType: 'application/json',
				headers:medtap.getHeaders(),
				data:JSON.stringify({
					userId:myEmr.userId
				}),
				success:function(res){
hanpeng committed
55
					medtap.jzz(0);
hanpeng committed
56 57 58 59 60 61
					if(res.success == true){
						var data = res.content;
						//填充用户信息
						var userInfo = data.userInfo;
						$('.user_profile').attr('src',userInfo.profile);
						$('.user_name').text(userInfo.username);
hanpeng committed
62
						$('.user_type').text('(' + (userInfo.hasOwnProperty('healthType') ? userInfo.healthType.value : '') + ')');
hanpeng committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
						$('.user_sex').text(userInfo.sex == 'M' ? '男' : '女');
						var emrInfo = JSON.stringify(data.emr)
						if(emrInfo != {}){
							//有病历信息
							$('.user_patient_info_detail').show();
							$('.add_new_patient').hide();
							$('body').css('background','#F6F6FC');
							myEmr.emrId = data.emr.emrId;
							$('.patient_name').text(data.emr.patientName);
							$('.patient_sex').text(data.emr.sex == 'M' ? '男' : '女');
							$('.patient_age').text(data.emr.age);
							if(data.emr.hasOwnProperty('height')){
								$('.patient_height').text(data.emr.height);
							}else{
								$('.patient_height').text('未知').css('color','#999999');
							}
							if(data.emr.hasOwnProperty('weight')){
								$('.patient_weight').text(data.emr.weight);
							}else{
								$('.patient_weight').text('未知').css('color','#999999');
							}
							$('#diseases').text(data.emr.diseaseDiagnosisName);
							$('#pathologyType').text(data.emr.pathologyTypeName);
							if(data.emr.hasOwnProperty('tumorStageItem')){
								$('#tumorStage').text(data.emr.tumorStageItem.value);
							}else{
								$('#tumorStage').text('未知').css('color','#999999');
							}
hanpeng committed
91 92
							
							if(data.emr.hasOwnProperty('tnmStage') && data.emr.tnmStage !== ''){
hanpeng committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106
								$('#tnmStage').text(data.emr.tnmStage);
							}else{
								$('#tnmStage').text('未知').css('color','#999999');
							}
							if(data.emr.hasOwnProperty('transferNidusItem')){
								$('#transferNidus').text(data.emr.transferNidusItem.value);
							}else{
								$('#transferNidus').text('未知').css('color','#999999');
							}
							if(data.emr.hasOwnProperty('ecogGradeItem')){
								$('#ecogGrade').text(data.emr.ecogGradeItem.value.substring(0,2));
							}else{
								$('#ecogGrade').text('未知').css('color','#999999');
							}
hanpeng committed
107 108 109 110 111 112 113
							if(data.emr.hasOwnProperty('smokingFlg')){
								if(data.emr.smokingFlg == true){
									var smokeStr = data.emr.smokingDailyNum + '支/天 ' + data.emr.smokingYear +'年';
									$('#somke').text(smokeStr);
								}else if(data.emr.smokingFlg == false){
									$('#somke').text('无');
								}
hanpeng committed
114
							}else{
hanpeng committed
115
								$('#somke').text('未知').css('color','#999999');
hanpeng committed
116
							}
hanpeng committed
117
							if(data.emr.hasOwnProperty('patientHospitalIdNum') && data.emr.patientHospitalIdNum !== ''){
hanpeng committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
								$('#patientHospitalIdNum').text(data.emr.patientHospitalIdNum);
							}else{
								$('#patientHospitalIdNum').text('未知').css('color','#999');
							}
							if(data.emr.hasOwnProperty('areaItem')){
								$('#area').text(data.emr.areaItem.fullName);
							}else{
								$('#area').text('未知').css('color','#999');
							}
							if(data.emr.hasOwnProperty('targetedMutationsItem')){
								var str = [];
								for(var i = 0;i < data.emr.targetedMutationsItem.length;i++){
									str.push(data.emr.targetedMutationsItem[i].value);
								}
								str.join(',');
								$('#targetedMutations').text(str);
							}else{
								$('#targetedMutations').text('未知').css('color','#999');
							}
hanpeng committed
137
							if(data.emr.hasOwnProperty('acceptingCureItem') && data.emr.acceptingCure !=''){
hanpeng committed
138 139 140 141 142 143
								var str = [];
								for(var i = 0; i < data.emr.acceptingCureItem.length;i++){
									str.push(data.emr.acceptingCureItem[i].value);
								}
								str.join(',');
								$('#acceptingCureItem').text(str);
hanpeng committed
144 145
							}else if(data.emr.acceptingCure == ''){
								$('#acceptingCureItem').text('无');
hanpeng committed
146 147 148
							}else{
								$('#acceptingCureItem').text('未知').css('color','#999');
							}
hanpeng committed
149
							if(data.emr.hasOwnProperty('acceptedCureItem') && data.emr.acceptedCure != ''){
hanpeng committed
150 151 152 153 154 155
								var str = [];
								for(var i = 0; i < data.emr.acceptedCureItem.length;i++){
									str.push(data.emr.acceptedCureItem[i].value);
								}
								str.join(',');
								$('#acceptedCureItem').text(str);
hanpeng committed
156 157
							}else if(data.emr.acceptedCure == ''){
								$('#acceptedCureItem').text('无')
hanpeng committed
158 159 160 161 162 163 164
							}else{
								$('#acceptedCureItem').text('未知').css('color','#999');
							}
							if(data.emr.curePicList == ''){
								var str = '<img src="images/post_no picture@2x.png" >';
								$('.img_warp').html(str);
							}else{
hanpeng committed
165 166 167 168 169
								var html = '';
								for(var i = 0;i <data.emr.curePicList.length;i++){
									html +=' <img src="'+data.emr.curePicList[i]+'" >'
								}
								$('.img_warp').html(html);
hanpeng committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183
							}
						}else{
							//无病历信息
							$('.user_patient_info_detail').hide();
							$('.add_new_patient').show();
							$('body').css('background','#fff');
						}
					}
				}
			})
		}
	}
	myEmr.init();
})