var request = getRequest(), prescriptionCode = request.code, fv_id = request.fv_id; $(function(){ getList(); bindEvents(); }) function getList(){ var params = { prescriptioncode: prescriptionCode }; consultingAPI.getFollowupCountList(params).then(function(res){ if(res.status == 200){ var list = _.map(res.data, function(o){ o.jsonStr = JSON.stringify(o); return o; }); var html = template('info_tmp', {list: list}); $("#container").empty().append(html); }else{ showErrorMsg(res.msg); } }); } function bindEvents(){ $("body").on('click', ".import-fv", function(e){ e.stopPropagation(); var $this = $(this), $box = $this.closest(".box"), json = $box.data(json), params = { followupid: fv_id, prescriptioncode: prescriptioncode, type: json.type //1身体异常症状问卷,2体征及生活方式调查问卷 }; consultingAPI.importfollowupcontent(params).then(function(res){ if(res.status == 200){ showSuccessMsg("已填入"); }else{ showErrorMsg(res.msg); } }) }); $("body").on('click', '.send-survey', function(e){ e.stopPropagation(); var $this = $(this), $box = $this.closest(".box"), json = $box.data(json), params = { followupid: fv_id, prescriptioncode: prescriptioncode, type: json.type //1身份异常症状问卷,2体征及生活方式调查问卷 }; consultingAPI.addPrescriptionFollowupContentConsult(params).then(function(res){ if(res.status == 200){ showSuccessMsg("已发送"); }else{ showErrorMsg(res.msg); } }) }); $("body").on('click', '.box', function(){ var $this = $(this), json = $this.data('json'); location.href = "survey-detail.html?prescriptionCode="+prescriptionCode+"&fv_id="+fv_id+"&type="+json.type+"&projectId="+json.typevalue+'&state='+json.statue; }); }