zixunjilu.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. var patiCode = "";
  2. var id = 0;
  3. var pagesize = 10;
  4. var scroller1 = null;
  5. var self = null;
  6. mui.plusReady(function() {
  7. plus.nativeUI.showWaiting();
  8. scroller1 = new IScrollPullUpDown('wrapper',{
  9. probeType:2,
  10. bounceTime: 250,
  11. bounceEasing: 'quadratic',
  12. mouseWheel:false,
  13. click:true,
  14. scrollbars:true,
  15. fadeScrollbars:true,
  16. interactiveScrollbars:false
  17. },pullDownAction,pullUpAction);
  18. self = plus.webview.currentWebview();
  19. patiCode = self.code;
  20. queryInit();
  21. });
  22. mui.back = function(){
  23. self.opener().reload(true);
  24. self.close();
  25. }
  26. template.helper('toInfo', function(v){
  27. return JSON.stringify(v);
  28. })
  29. function queryInit(){
  30. sendPost("doctor/consult/list", {
  31. type: 0,
  32. id: id,
  33. pagesize: pagesize,
  34. patient: patiCode
  35. }, null, function(res) {
  36. // console.log("咨询记录:"+JSON.stringify(res));
  37. if(res.status == 200) {
  38. if(res.list.length== 0 && id==0){
  39. $("#div-no-info").removeClass("c-hide");
  40. plus.nativeUI.closeWaiting();
  41. return false;
  42. }
  43. template.helper("setSex", function(s) {
  44. if(s == 1) {
  45. return "男"
  46. } else if(s == 2) {
  47. return "女"
  48. }
  49. });
  50. template.helper("setPhoto", function(p) {
  51. // if(!p || p.length == 0) {
  52. // return "../../../images/p-default.png";
  53. // } else {
  54. // return p
  55. // }
  56. return getImgUrl(p);
  57. });
  58. template.helper("setTime", function(p) {
  59. var nowDateTime = (new Date()).format("yyyy-MM-dd hh:mm:ss");
  60. if(p){
  61. var dataArray = p.split(" ");
  62. var nowDateArray = nowDateTime.split(" ");
  63. var dataYear = dataArray[0].split("-")[0];//取出年份
  64. var nowYear = nowDateArray[0].split("-")[0];
  65. if(dataYear!=nowYear){//不同年
  66. return p;
  67. }else if(dataArray[0]!=nowDateArray[0]){//今年非今日
  68. return dataArray[0];
  69. }else{
  70. return dataArray[1];
  71. }
  72. }else{
  73. return "";
  74. }
  75. });
  76. if(res.list.length > 0) {
  77. var list = res.list;
  78. id = list[list.length-1].id;//取最后一条的id
  79. }
  80. var cont = template("consult_tmpl", res);
  81. $("#zixun_list").append(cont);
  82. scroller1.refresh();
  83. $(".pullDown").hide();
  84. $(".pullUp").hide();
  85. plus.nativeUI.closeWaiting();
  86. }
  87. });
  88. }
  89. //下拉刷新
  90. function pullDownAction(theScrollerTemp) {
  91. $(".pullDown").show();
  92. $(".pullUp").hide();
  93. setTimeout(function () {
  94. $("#zixun_list").html("");
  95. id=0;
  96. queryInit();
  97. }, 100);
  98. }
  99. //上拉加载数据
  100. function pullUpAction(theScrollerTemp) {
  101. $(".pullDown").hide();
  102. $(".pullUp").show();
  103. setTimeout(function () {
  104. queryInit();
  105. }, 100);
  106. }
  107. $("#zixun_list").on("click",".n-list",function(){
  108. //该患者跟医生无签约关系时不可看详细信息
  109. if(self.qyRelation == 0)
  110. return;
  111. var status = this.getAttribute("data-status");
  112. var consultInfo = JSON.parse(this.getAttribute("data-info"));
  113. mui.openWindow('../../message/html/p2dzixun.html', 'p2dzixun', {
  114. extras: {
  115. otherCode: consultInfo.patient,
  116. otherName: consultInfo.name,
  117. otherSex: consultInfo.sex,
  118. otherPhoto: consultInfo.photo,
  119. isOver: status,
  120. consultInfo: consultInfo
  121. }
  122. })
  123. })