xuanzezhuanyijumin.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. var myScroll, docCode, teamCode, type, self, num = 0, curDocCode;
  2. mui.plusReady(function(){
  3. self = plus.webview.currentWebview();
  4. docCode = self.docCode;
  5. teamCode = self.teamCode;
  6. type = self.type;
  7. curDocCode = getUid();
  8. if(type == "dfp"){
  9. getDfpPatiLs();
  10. }else
  11. getPatiLs();
  12. })
  13. function getDfpPatiLs(){
  14. plus.nativeUI.showWaiting();
  15. sendGet("/doctor/family_contract/findNoHealthSignFamilyHealth",
  16. {doctor: curDocCode, page: 0, pageSize: 2000}, null, function(res){
  17. if(res.status == 200){
  18. console.log(JSON.stringify(res))
  19. res.data = res.list;
  20. if(!res.data || res.data.length==0){
  21. $('#wushuju').show();
  22. $('.lin-footer').hide();
  23. $('.doc-list').hide();
  24. } else {
  25. $('.doc-list').html(template('pati_tmpl', res));
  26. }
  27. myScroll.refresh();
  28. plus.nativeUI.closeWaiting();
  29. } else
  30. mui.toast(res.msg)
  31. })
  32. }
  33. function getPatiLs(){
  34. plus.nativeUI.showWaiting();
  35. sendGet("/doctor/admin-teams/teams/"+ teamCode +"/members/"+ docCode +"/signing", {}, null, function(res){
  36. if(res.status == 200){
  37. if(!res.data || res.data.length==0){
  38. $('#wushuju').show();
  39. $('.lin-footer').hide();
  40. $('.doc-list').hide();
  41. } else {
  42. $('.doc-list').html(template('pati_tmpl', res));
  43. }
  44. myScroll.refresh();
  45. plus.nativeUI.closeWaiting();
  46. } else
  47. mui.toast(res.msg)
  48. })
  49. }
  50. var loaded = function () {
  51. myScroll = new IScroll('#wrapper', { mouseWheel: true });
  52. document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
  53. }();
  54. /**
  55. * 下一步操作
  56. */
  57. function submit(){
  58. if(num<=0)
  59. return;
  60. plus.nativeUI.showWaiting();
  61. var patients = [], patiCodes = [];
  62. var patient;
  63. $.each($('.doc-list').find('.doc-item.checked'), function(i, v) {
  64. patient = JSON.parse($(v).attr('data-info'));
  65. patients.push(patient);
  66. patiCodes.push(patient.code);
  67. });
  68. sendPost("/doctor/consult/getConsultByPatientAndDoctor",
  69. {patientCode: patiCodes.join(","), doctor: docCode}, null,
  70. function(res){
  71. var tem = {};
  72. if(res.length==0){
  73. to_next(patients);
  74. } else if(patients.length == res.length){
  75. plus.nativeUI.closeWaiting();
  76. mui.confirm("对不起,您选择的居民均有尚未结束的健康咨询,无法继续转移。", "提示", ["我知道了"], function(e){
  77. })
  78. return;
  79. } else if(res.length <= 3 ){
  80. tem = getCanTrans(patients, res);
  81. mui.confirm("居民"+ tem.names + ",尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){
  82. if(e.index == 0){
  83. to_next(tem.canPati);
  84. cancleSel(res);
  85. }
  86. })
  87. } else if(res.length < patients.length){
  88. tem = getCanTrans(patients, res);
  89. mui.confirm("选中居民中有"+ res.length + "人,尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){
  90. if(e.index == 0){
  91. to_next(tem.canPati);
  92. cancleSel(res);
  93. }
  94. })
  95. } else{
  96. }
  97. plus.nativeUI.closeWaiting();
  98. })
  99. }
  100. function cancleSel(notCodes){
  101. $.each(notCodes, function(i, v) {
  102. $('.doc-item[data-code="'+ v +'"]').removeClass("checked");
  103. });
  104. num = $('.doc-list').find('.doc-item.checked').length;
  105. $('.checked-num label').html(num);
  106. $('.link').toggleClass('c-ccc', num<=0);
  107. }
  108. function getCanTrans(patients, notCodes){
  109. var canPati = [];
  110. var names = [];
  111. $.each(patients, function(i, v) {
  112. var has = false;
  113. $.each(notCodes, function(n, m) {
  114. if(v.code == m){
  115. has = true;
  116. names.push(v.name);
  117. }
  118. });
  119. if(!has){
  120. canPati.push(v);
  121. }
  122. });
  123. return {canPati: canPati, names: names.join(",")}
  124. }
  125. function to_next(patients){
  126. mui.openWindow({
  127. id: "xuanzejieshouyisheng.html",
  128. url: "xuanzejieshouyisheng.html",
  129. extras: {
  130. jgs: self.jgs,
  131. patients: patients,
  132. docCode: docCode,
  133. teamCode: teamCode,
  134. type: "转移"
  135. }
  136. });
  137. }
  138. $('.doc-list').on('tap', '.doc-item', function(){
  139. $(this).toggleClass('checked');
  140. num = $('.doc-list').find('.doc-item.checked').length;
  141. $('.checked-num label').html(num);
  142. $('.link').toggleClass('c-ccc', num<=0);
  143. })
  144. $('#allSel').on('tap', function(){
  145. $(this).toggleClass('checked');
  146. if($(this).hasClass('checked')){
  147. $(this).next().html("取消全选");
  148. $('.doc-list').find('.doc-item').addClass('checked');
  149. } else {
  150. $(this).next().html("全选");
  151. $('.doc-list').find('.doc-item').removeClass('checked');
  152. }
  153. num = $('.doc-list').find('.doc-item.checked').length;
  154. $('.checked-num label').html(num);
  155. $('.link').toggleClass('c-ccc', num<=0);
  156. })