Procházet zdrojové kódy

修复bug#3975 【PC端-长处方】续方管理:续方详情中原处方信息有误。

yezehua před 7 roky
rodič
revize
8f28ef1819

+ 90 - 34
js/buz/prescription-detail.js

@ -35,6 +35,41 @@ $(function(){
    	return getReviewResultName(status)
    })
    
   	template.helper('setRestTime',function(minDate,sDate){
		var now = getNowDate();
		var createDate = sDate.split(' ');
		var diff = getDays(createDate[0],now);
		if(diff<minDate){
			return '<span style="color:#17b3ec">'+(minDate-diff)+'天</span>'
		}else{
			return '<span style="color:#ff4c4c">已用完</span>'
		}
	})
	//相隔几天
	function getDays(sDate,eDate){
	   var oDate1;
	   var oDate2;
	   var iDays;
	   oDate1= sDate.split("-");
	   oDate2= eDate.split("-");
	   var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
	   var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
	   iDays = parseInt(Math.abs(strDateE - strDateS ) / 1000 / 60 / 60 /24)
	   return iDays ;
	}
	//现在时间
	function getNowDate() {
		var date = new Date();
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		var day = date.getDate();
		var hour = date.getHours();
		var minute = date.getMinutes();
		var second = date.getSeconds();
		return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
	}
	
	
    prescriptionDetailApis.getContinuedPrescriptionAsDoctor({
    	data: {
    		code: prescriptionCode, // 续方CODE
@ -42,48 +77,69 @@ $(function(){
    	}
    }).then(function(res) {
    	if(res.status == 200) {
    		var data = res.data;
	    	var prescription = data.prescription;
	    	var diagnosis = data.diagnosis;
	    	strOriginalData = data;
    		var detailData = res.data;
			var prescription = detailData.prescription;
	    	var diagnosis = detailData.diagnosis;
	    	var patient = detailData.patient;
	    	strOriginalData = detailData;
	    	jwHospital = prescription.jwHospital;
	    	jwDoctorCode = prescription.jwDoctorCode;
	    	var diagnosisNames = _.pluck(diagnosis,'name').join('、')
	    	
	    	if(isLeader) {
	    		getDataPromises().then(function(responses) {
		    		var deptRes = responses[0],
		    			feeRes = responses[1],
		    			authRes = responses[2],
		    			reasonRes = responses[3];
		    			
		    		$main.html(template('detailTmpl',$.extend({}, data , {
		    			diagnosisNames: diagnosisNames,
		    			depts: deptRes.data,
		    			feeRes: feeRes.data,
		    			isAuthentication: authRes.data.type == 4,
		    			isLeader: isLeader,
		    			reasonTypes: reasonRes.data
		    		})))
		    		
		    		bindEvents()
		    	}).catch(function(e) {
		    		showErrorMsg('初始化失败')
		    	})
	    	} else {
	    		$main.html(template('detailTmpl',$.extend({}, data , {
	    			diagnosisNames: diagnosisNames,
	    			isLeader: isLeader
	    		})))
	    		bindEvents()
	    	}
    		prescriptionDetailApis.getPrescription({
    			data: {
    				code: prescriptionCode, 
    				patient: patient.code
    			}
    		}).then(function(res) {
				
				if(res.status == 200) {
					
					if(isLeader) {
			    		getDataPromises().then(function(responses) {
				    		var deptRes = responses[0],
				    			feeRes = responses[1],
				    			authRes = responses[2],
				    			reasonRes = responses[3];
				    			
				    		$main.html(template('detailTmpl',$.extend({}, detailData , {
				    			primary: res.data,
				    			diagnosisNames: diagnosisNames,
				    			depts: deptRes.data,
				    			feeRes: feeRes.data,
				    			isAuthentication: authRes.data.type == 4,
				    			isLeader: isLeader,
				    			reasonTypes: reasonRes.data
				    		})))
				    		
				    		bindEvents()
				    	}).catch(function(e) {
				    		showErrorMsg('初始化失败')
				    	})
			    	} else {
			    		$main.html(template('detailTmpl',$.extend({}, detailData , {
			    			primary: res.data,
			    			diagnosisNames: diagnosisNames,
			    			isLeader: isLeader
			    		})))
		
			    		bindEvents()
			    	}
				}else {
		    		showErrorMsg(res.msg)
		    	}
		    	
    		}).catch(function(e){
    			console && console.error(e)
    		})
    		
	    	
    	} else {
    		showErrorMsg(res.msg)
    	}
    	
    })
    }).catch(function(e){
		console && console.error(e)
	})
    
    function bindEvents() {
    	$('#auditResultSel').on('change',function() {

+ 3 - 0
js/prescription-detail-api.js

@ -1,6 +1,9 @@
(function(){
    var prescriptionDetailApis = {
    	getPrescription: function(data) {
    		return APIService.httpGet('doctor/prescriptionInfo/getPrescription', data);
    	},
    	getContinuedPrescriptionAsDoctor: function(data) {
    		return APIService.httpGet('doctor/prescriptionInfo/getContinuedPrescriptionAsDoctor', data);
    	},

+ 3 - 3
prescription-detail.html

@ -45,11 +45,11 @@
	        <div class="ibox-content">
	            <table class="c-wp100 c-999">
	            	<tr>
	            		<td>开方时间:{{prescription.presCreateTime}}</td>
	            		<td>开方医生:{{prescription.doctorName}}</td>
	            		<td>开方时间:{{primary.createTime}}</td>
	            		<td>开方医生:{{primary.doctorName}}</td>
	            	</tr>
	            	<tr>
	            		<td>剩余药品可用天数:2天</td>
	            		<td>剩余药品可用天数:{{# setRestTime(prescription.minDrugDay,prescription.presCreateTime)}}</td>
	            		<td>医院/科室:{{prescription.hospitalName}} / {{prescription.deptName}}</td>
	            	</tr>
	            </table>