123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- var d= dialog({contentType:'load', skin:'bk-popup'});
- var $eventListWrapper = $('#recent_event_list_wrap'),
- $eventList = $('#recent_event_list'),
- // 搜索无结果时显示
- $noResultWrap = $('#no_result_wrap');
- // 分页查询当前页数
- var curPage = 1,
- // iscroll 滚动条实例
- iscroller;
- var pagetype = 32;
- appendFamilyMember($('#memberContainer'),function(){
- queryInit();
- },function(){
- //判断有授权家人,修改样式
- if($('#memberContainer').is(':hidden')){
- $('#recent_event_scroller').css('top','0px');
- $('.no-result-img').css('margin-top','150px')
- }else{
- $('#recent_event_scroller').css('top','90px');
- }
- })
- template.helper("toJson", function(v, i) {
- return JSON.stringify(v);
- });
-
- // 初始化就诊事件列表
- var initEventList = function(list) {
- var html = template("recent_event_tmpl", {list: list})
- $eventList.append(html);
- },
- // 分页查询列表
- searchByPaging = function () {
- var userAgent = JSON.parse(window.localStorage.getItem(agentName));
- var url = "patient/archives/list_medical",
- curPage = 1,
- pagesize = 50,
- params = {
- pageIndex: curPage,
- pageSize: pagesize
- };
- getReqPromise(url,params,'','POST').then(function(res){
- if(!iscroller) {
- iscroller = initScroller($eventListWrapper,url);
- }
- if(res.status == 200) {
- curPage++;
- var list = res.list;
- if(!list|| !list.length) {
- $eventListWrapper.hide();
- $noResultWrap.show();
- } else {
- $noResultWrap.hide();
- $eventListWrapper.show();
- initEventList(list);
- }
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg,bottom:true}).show();
- }
- iscroller.refresh();
- }).catch(function(e) {
- console && console.error(e)
- });
- },
- // 滚动条分页实例初始化
- initScroller = function($el,url,getData,pullUpAction) {
- var scroller = $el.initScroll({pullDown: false,pullUp: false});
- return scroller;
- },
- checkSignPromise = function (){
- d.show();
- return getReqPromise("patient/is_sign",{},'','POST').then(function(res) {
- d.close();
- if (res.status == 200) {
- // -1 未签约 0 待签约 1 已签约 2待解约
- var is_sign = res.data;
- if(is_sign > 0){
- return true;
- }else{
- return false;
- }
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg,bottom:true}).show();
- }
- }).catch(function(e) {
- d.close();
- console && console.error(e);
- })
- },
-
- // 绑定页面事件
- bindEvents = function () {
- $eventList.on('click','li',function() {
- var data = JSON.parse($(this).attr("data-json"));
- checkSignPromise()
- .then(function(isSign) {
- if(isSign === true) {
- window.location.href = "jiankangtijianxiangqing.html?medicalNo="+data.medicalNo
- } else if(isSign === false) {
- dialog({
- title: '提示',
- content: '对不起,签约家庭医生之后才能查看健康档案!',
- okValue:'我要签约',
- ok: function (){
- window.location.href = "../../qygl/html/signing-doctors.html";
- },
- cancelValue: '了解签约',
- cancel: function () {
- window.location.href = "../../qygl/html/signing-share2.html";
- }
- }).showModal();
- }
- })
-
- });
- };
- function queryInit(){
- curPage = 1;
- $eventList.empty();
- Promise.resolve().then(function() {
- searchByPaging();
- bindEvents();
- }).catch(function(e) {
- console && console.error(e);
- });
- }
- $(function() {
- checkUserAgent();
- // 页面业务处理流程开始
- })
|