123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- var patiCode = "";
- var id = 0;
- var pagesize = 10;
- var scroller1 = null;
- var self = null;
- mui.plusReady(function() {
- plus.nativeUI.showWaiting();
- scroller1 = new IScrollPullUpDown('wrapper',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- click:true,
- scrollbars:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- },pullDownAction,pullUpAction);
-
- self = plus.webview.currentWebview();
- patiCode = self.code;
- queryInit();
- });
- mui.back = function(){
- self.opener().reload(true);
- self.close();
- }
- template.helper('toInfo', function(v){
- return JSON.stringify(v);
- })
- function queryInit(){
- sendPost("doctor/consult/list", {
- type: 0,
- id: id,
- pagesize: pagesize,
- patient: patiCode
- }, null, function(res) {
- // console.log("咨询记录:"+JSON.stringify(res));
- if(res.status == 200) {
- if(res.list.length== 0 && id==0){
- $("#div-no-info").removeClass("c-hide");
- plus.nativeUI.closeWaiting();
- return false;
- }
- template.helper("setSex", function(s) {
- if(s == 1) {
- return "男"
- } else if(s == 2) {
- return "女"
- }
- });
- template.helper("setPhoto", function(p) {
- // if(!p || p.length == 0) {
- // return "../../../images/p-default.png";
- // } else {
- // return p
- // }
- return getImgUrl(p);
- });
-
- template.helper("setTime", function(p) {
- var nowDateTime = (new Date()).format("yyyy-MM-dd hh:mm:ss");
- if(p){
- var dataArray = p.split(" ");
- var nowDateArray = nowDateTime.split(" ");
- var dataYear = dataArray[0].split("-")[0];//取出年份
- var nowYear = nowDateArray[0].split("-")[0];
- if(dataYear!=nowYear){//不同年
- return p;
- }else if(dataArray[0]!=nowDateArray[0]){//今年非今日
- return dataArray[0];
- }else{
- return dataArray[1];
- }
- }else{
- return "";
- }
- });
-
-
-
- if(res.list.length > 0) {
- var list = res.list;
- id = list[list.length-1].id;//取最后一条的id
- }
- var cont = template("consult_tmpl", res);
- $("#zixun_list").append(cont);
- scroller1.refresh();
- $(".pullDown").hide();
- $(".pullUp").hide();
- plus.nativeUI.closeWaiting();
- }
- });
- }
- //下拉刷新
- function pullDownAction(theScrollerTemp) {
- $(".pullDown").show();
- $(".pullUp").hide();
- setTimeout(function () {
- $("#zixun_list").html("");
- id=0;
- queryInit();
- }, 100);
- }
-
- //上拉加载数据
- function pullUpAction(theScrollerTemp) {
- $(".pullDown").hide();
- $(".pullUp").show();
- setTimeout(function () {
- queryInit();
- }, 100);
- }
-
- $("#zixun_list").on("click",".n-list",function(){
- //该患者跟医生无签约关系时不可看详细信息
- if(self.qyRelation == 0)
- return;
-
- var status = this.getAttribute("data-status");
- var consultInfo = JSON.parse(this.getAttribute("data-info"));
- mui.openWindow('../../message/html/p2dzixun.html', 'p2dzixun', {
- extras: {
- otherCode: consultInfo.patient,
- otherName: consultInfo.name,
- otherSex: consultInfo.sex,
- otherPhoto: consultInfo.photo,
- isOver: status,
- consultInfo: consultInfo
- }
- })
- })
-
|