123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- mui.init();
- var patient = null;
- var docInfo = null;
- var pageIndex = 1;
- var pageSize = 10;
- var self;
- mui.plusReady(function(){
- self = plus.webview.currentWebview();
- docInfo = JSON.parse(plus.storage.getItem("docInfo"));
- patient = self.patient;
- queryInit();
- })
- function queryInit(){
- plus.nativeUI.showWaiting();
- initData();
- bindEvents();
- function bindEvents(){
- $(".c-list").on("click",".n-list-li,.n-list-content",function(event){
- //该患者跟医生无签约关系时不可看详细信息
- if(self.qyRelation == 0)
- return;
- var parentLi = $(this).closest("li");
- var id = parentLi.attr("data-id");
- openWebviewExtras("detail-appointment.html",{dataId:id});
- }).on("click",".div-again",function(){
- var parentLi = $(this).closest("li");
- var id = parentLi.attr("data-id");
- var doctorCode = parentLi.attr("data-doctorCode");
- var orgCode = parentLi.attr("data-orgCode");
- var deptCode = parentLi.attr("data-deptCode");
- var params = {};
- params.id=id;
- params.doctorId=doctorCode;
- params.hospitalId=orgCode;
- params.deptId = deptCode;
- params.type=2;
- params.patient = patient;
- openWebviewExtras("doctor-detail.html",params);
- })
-
- $(".div-add-btn").on("click",function(){
- openWebview("appointment-register.html");
- })
-
- scroller1 = $("#wrapper2").initScroll(
- {
- pullDownAction: function(){
- location.reload();
- },pullUpAction: function() {
- getMyAppo();
- }
- }
- );
-
- }
-
-
- function initData(){
- $(".c-list").html("");
- pageIndex = 1;
- getMyAppo();
- }
-
- function getMyAppo(){
- var data={};
- data.patient = patient;
- data.doctor = docInfo.code;
- data.pageIndex = pageIndex;
- data.pageSize = pageSize;
- sendPost('third/guahao/GetPatientReservationList', data, getListFail, successFun);
- }
-
- function successFun(res){
- plus.nativeUI.closeWaiting();
- if(res.status==200){
- updatePullUpText(scroller1,res.data);
-
- /*res.data = [{
- doctorName: "aa", startTime: "2016-06-06 06:06:06"
- }]*/
-
- if(res.data&&res.data.length>0){
- pageIndex=pageIndex+1;
- appendMyAppo(res.data);
- }else{
- if(pageIndex==1){
- $(".main").hide();
- $(".div-no-info").show();
- $("#footer").show();
- }else{
- mui.toast("无更多数据");
- }
- }
-
- }else{
- getListFail(res);
- }
- }
-
- function getListFail(res){
- plus.nativeUI.closeWaiting();
- if (res && res.msg) {
- mui.toast(res.msg);
- } else {
- mui.toast("加载失败!");
- }
- }
-
-
- function appendMyAppo(dataList){
- var appoHtml ="";
- for(var j in dataList){
- var data = dataList[j];
- //status:0 已撤销 1 预约成功 2 已就诊 3已停诊
- var clazz1 = "cb-47ABEF";
- var clazz2 = "c-47ABEF";
- var statusNm = "预约成功"
- if(data.status=="0"){
- clazz1 = "cb-FF6A56";
- clazz2 = "c-FF6A56";
- statusNm = "已撤销";
- }else if(data.status=="2"){
- clazz1 = "cb-74BF00";
- clazz2 = "c-74BF00";
- statusNm = "已就诊";
- }else if(data.status=="3"){
- clazz1 = "cb-909090";
- clazz2 = "c-909090";
- statusNm = "已停诊";
- }
-
- appoHtml+='<li class="mt10" data-id="'+data.id+'" data-doctorCode="'+data.doctorCode+'" data-orgCode="'+data.orgCode+'" data-deptCode="'+data.deptCode+'">'+
- '<div class="n-list dr-item c-border">'+
- '<div class="n-list-li pl10">'+
- '<div class="n-list-key">'+
- '<div class="n-avatar-l img-round">'+
- '<img src="../../../images/d-male.png">'+
- '</div>'+
- '</div>'+
- '<div class="pl15">'+
- '<div>'+
- '<span class="c-f16 c-bold c-323232">'+data.doctorName+'</span>'+
- '<span class="c-f12 c-666666 pl10">('+data.doctorJob+')</span>'+
- '<span class="c-f12 c-666666 pl10">'+data.deptName+'</span>'+
- '</div>'+
- '<div class="c-f14 c-323232 pt5">'+data.orgName+'</div>'+
- '</div>'+
- '</div>'+
- '<div class="mt10 c-f12 c-666666 n-list-content mb5 pl10">'+
- '<span>就诊时间:'+data.startTime.toString().substring(0,16)+'</span>'+
- '<span class="f-fr pr15">代预约:'+data.dname+'</span>'+
- '</div>'+
- '<div class="line"></div>';
-
- if(self.qyRelation==1){
- appoHtml +=
- '<div class="div-remark pl10">'+
- '<div class="f-fr pr15 div-again">'+
- '<div class="right-content">再次预约</div>'+
- '<img src="../images/tiaozhuan_lvse_icon.png">'+
- '</div>'+
- '</div>';
- }
-
- appoHtml += '</div></li>';
- }
- $(".c-list").append(appoHtml);
- $(".main").show();
- $("#footer").show();
- }
-
- var updatePullUpText= function(scroller,list) {
- var $wrap = $(scroller.wrapper),
- $pullupLabel = $wrap.find('.pullUpLabel');
- $(".pullUp").removeClass("loading");
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- scroller.on('refresh',function() {
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- });
- }
- }
- window.addEventListener('update', function(e) {
- queryInit();
- });
|