zhidaojilu.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. function queryInit(){
  27. sendPost("doctor/health/guidance/list", {
  28. type: 0,
  29. id: id,
  30. pagesize: pagesize,
  31. patient: patiCode
  32. }, null, function(res) {
  33. console.log("指导记录:"+JSON.stringify(res));
  34. if(res.status == 200) {
  35. if(res.list.length== 0 && id==0){
  36. $("#div-no-info").removeClass("c-hide");
  37. plus.nativeUI.closeWaiting();
  38. return false;
  39. }
  40. template.helper("setSex", function(s) {
  41. if(s == 1) {
  42. return "男"
  43. } else if(s == 2) {
  44. return "女"
  45. }
  46. });
  47. template.helper("setPhoto", function(p) {
  48. // if(!p || p.length == 0) {
  49. // return "../../../images/p-default.png";
  50. // } else {
  51. // return p
  52. // }
  53. return getImgUrl(p);
  54. });
  55. if(res.list.length > 0) {
  56. var list = res.list;
  57. id = list[list.length-1].id;//取最后一条的id
  58. }
  59. var cont = template("zhidao_tmpl", res);
  60. $("#zhidao_list").append(cont);
  61. scroller1.refresh();
  62. $(".pullDown").hide();
  63. $(".pullUp").hide();
  64. plus.nativeUI.closeWaiting();
  65. }
  66. });
  67. }
  68. //下拉刷新
  69. function pullDownAction(theScrollerTemp) {
  70. $(".pullDown").show();
  71. $(".pullUp").hide();
  72. setTimeout(function () {
  73. $("#zhidao_list").html("");
  74. id=0;
  75. queryInit();
  76. }, 100);
  77. }
  78. //上拉加载数据
  79. function pullUpAction(theScrollerTemp) {
  80. $(".pullDown").hide();
  81. $(".pullUp").show();
  82. setTimeout(function () {
  83. queryInit();
  84. }, 100);
  85. }
  86. $("#zhidao_list").on("click",".n-list",function(){
  87. //该患者跟医生无签约关系时不可看详细信息
  88. if(self.qyRelation == 0)
  89. return;
  90. var id = this.getAttribute("data-id");
  91. mui.openWindow('guidance-detail.html', 'guidance-detail', {
  92. extras: {
  93. guideId: id
  94. }
  95. })
  96. })
  97. $("#add_btn").on("click",function(){
  98. mui.openWindow('../../hzzd/html/xinzengzhidao.html', 'jkzd', {
  99. extras: {
  100. code: patiCode
  101. }
  102. });
  103. })