huanzhe-tijian.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. var teamCode,
  2. iscroller,
  3. page = 0,//第几页
  4. pageNum = 10,//每页显示的数量
  5. $eventListWrapper = $('#view_wrap'),
  6. $noResultWrap = $('#no_result_wrap');
  7. mui.plusReady(function() {
  8. teamCode = plus.storage.getItem("selectedTeamId");
  9. // console.log(teamCode);
  10. getTijianList(teamCode,0,pageNum,true);
  11. isShowPlBtns(teamCode);
  12. initScroller()
  13. })
  14. $("#closeBtn").on("tap", function(){
  15. $(".information").hide();
  16. });
  17. mui("#jktj_list").on("tap", ".tixing-true", function(e) {
  18. var $li = $(this).parent();
  19. var patientCode = $li.attr("data-code");
  20. tjtxSingle(patientCode, $li);
  21. isShowPlBtns(teamCode);
  22. });
  23. mui("#jktj_list").on("click", ".tixing-false", function(e) {
  24. return false;
  25. });
  26. $('#tj_all_tx').on("click", function(e){
  27. mui.confirm("您确定给7天被未被提醒的居民发送体检提醒吗?", "提示", ["立即提醒", "不了,谢谢"], function(e){
  28. if(e.index == 0){
  29. tjtxSingleAll(teamCode);
  30. }
  31. })
  32. })
  33. // 滚动条实例初始化
  34. function initScroller() {
  35. //阻尼系数
  36. var deceleration = mui.os.ios?0.003:0.0009;
  37. mui('.mui-scroll-wrapper').scroll({
  38. bounce: false,
  39. indicators: true, //是否显示滚动条
  40. deceleration:deceleration
  41. });
  42. iscroller = mui(".mui-scroll").pullToRefresh({
  43. up: {
  44. callback: function() {
  45. page++;
  46. // console.log(page);
  47. // alert(page);
  48. getTijianList(teamCode,page,pageNum);
  49. // this.endPullUpToRefresh();
  50. }
  51. },
  52. down: {
  53. callback: function() {
  54. var self = this;
  55. page = 0;
  56. getTijianList(teamCode,0,pageNum,true);
  57. self.endPullDownToRefresh();
  58. }
  59. }
  60. });
  61. }
  62. function getTijianList(teamCode,pageNum,pageSize,isInit){
  63. var url = "/doctor/patient_label_info/getOldPatientByTeamCode",
  64. params = {adminTeamCode: teamCode,page: pageNum,pagesize: pageSize};
  65. plus.nativeUI.showWaiting();
  66. sendGet(url, params, null, function(res){
  67. if(res.status==200){
  68. plus.nativeUI.closeWaiting();
  69. var list = res.data;
  70. if(list.length == 0) {
  71. if(isInit){
  72. $eventListWrapper.hide();
  73. $noResultWrap.show();
  74. }else{
  75. iscroller.endPullUpToRefresh(true);
  76. }
  77. } else {
  78. $noResultWrap.hide();
  79. $eventListWrapper.show();
  80. var html = template('tjshow_list', {list:list});
  81. if(isInit) {
  82. $("#jktj_list").html(html);
  83. if(res.data.length == pageSize){
  84. iscroller.finished = false;
  85. }
  86. } else {
  87. $("#jktj_list").append(html)
  88. }
  89. if(res.data && res.data.length < pageSize) {
  90. iscroller.endPullUpToRefresh(true);
  91. }else{
  92. iscroller.endPullUpToRefresh(false);
  93. }
  94. }
  95. } else {
  96. // plus.nativeUI.closeWaiting();
  97. $eventListWrapper.hide();
  98. $noResultWrap.show();
  99. mui.toast(res.msg);
  100. }
  101. });
  102. }
  103. function isShowPlBtns(teamCode){
  104. var url = "/doctor/patient_label_info/isShowRemindBtns",
  105. params = {adminTeamCode: teamCode};
  106. $jfAllBtn = $("#tj_all_tx");
  107. plus.nativeUI.showWaiting();
  108. sendGet(url, params, null, function(res){
  109. if(res.status==200){
  110. if(res.data==0){
  111. $jfAllBtn.hide();
  112. } else {
  113. $jfAllBtn.show();
  114. // mui.toast(res.msg);
  115. }
  116. } else {
  117. plus.nativeUI.closeWaiting();
  118. mui.toast(res.msg);
  119. }
  120. });
  121. }
  122. function tjtxSingle(patientCode,$dom){
  123. plus.nativeUI.showWaiting();
  124. sendPost("/doctor/patient_label_info/singleRemindPhyExam", {patient: patientCode}, null, function(res){
  125. plus.nativeUI.closeWaiting();
  126. if(res.status == 200){
  127. $dom.find(".tixing-true").removeClass("tixing-true").html("已提醒").addClass("tixing-false");
  128. mui.toast(res.msg);
  129. }
  130. else {
  131. mui.toast(res.msg);
  132. }
  133. })
  134. }
  135. $(".yiwen-icon").on("tap", function(){
  136. $(".information").show();
  137. });
  138. function tjtxSingleAll(teamCode){
  139. plus.nativeUI.showWaiting();
  140. sendPost("/doctor/patient_label_info/remindPhyExams", {adminTeamCode:teamCode}, null, function(res){
  141. plus.nativeUI.closeWaiting();
  142. var $tjAllBtn = $('#tj_all_tx');
  143. if(res.status == 200){
  144. mui.toast("提醒成功");
  145. $('.tixing-true').addClass("tixing-false").html("已提醒").removeClass("tixing-true");
  146. $tjAllBtn.hide();
  147. } else {
  148. mui.toast(res.msg);
  149. }
  150. }
  151. )}
  152. template.helper("setPhoto", function(p) {
  153. return getImgUrl(p);
  154. });