xietongfuwu-yy.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. var self,
  2. patient,
  3. selectDatas,
  4. xtCode;
  5. mui.plusReady(function(){
  6. self = plus.webview.currentWebview();
  7. patient = self.patient;
  8. xtCode = self.code;//协同
  9. plus.nativeUI.showWaiting()
  10. Promise.all([queryPatient(),queryData()]).then(function(datas){
  11. plus.nativeUI.closeWaiting()
  12. var html = template('text_tmp',{data:$.map(datas[1].data,function(o,index){ o.jsonStr = JSON.stringify(o);return o ;}),patient:datas[0].data})
  13. $('#show_content').html(html)
  14. bindEvents();
  15. })
  16. })
  17. function queryData(){
  18. return getReqPromise("doctor/pcCustomer/GetRegList",{patient:patient},'post')
  19. }
  20. function queryPatient(){
  21. return getReqPromise("doctor/patient_label_info/patient",{patient:patient},'get')
  22. }
  23. function bindEvents(){
  24. $(".add-btn").on('click', function(){
  25. mui.openWindow({
  26. id: "xietongfuwu-deal",
  27. url: "../../xtfw/html/xietongfuwu-deal.html",
  28. extras: {
  29. type:1,//预约
  30. code:xtCode
  31. }
  32. })
  33. });
  34. $(".mui-scroll").on("change", ".icon-checkbox", function(){
  35. var $this = $(this);
  36. if($this.prop("checked")){
  37. $(".list-item").removeClass("active");
  38. $this.parent().parent().addClass("active");
  39. var json = $this.parent().parent().attr('data-json');
  40. selectDatas = json?JSON.parse(json):''
  41. }
  42. })
  43. mui('.mui-scroll-wrapper').scroll({
  44. bounce: true, //是否启用回弹
  45. })
  46. $("#submitBtn").on('tap',function(){
  47. if(!selectDatas){
  48. mui.toast('请选择要关联的记录')
  49. return
  50. }
  51. var params = {
  52. type:1,//1.预约成功,2.预约失败
  53. code:xtCode,
  54. orderHospital:selectDatas.orgCode,
  55. orderHospitalName:selectDatas.orgName,
  56. orderDept:selectDatas.deptCode,
  57. orderDeptName:selectDatas.deptName,
  58. orderDoctor :selectDatas.doctorCode,
  59. orderDoctorName:selectDatas.doctorName,
  60. orderTime:selectDatas.startTime,//就诊时间
  61. registerTime:selectDatas.czrq//挂号
  62. }
  63. plus.nativeUI.showWaiting();
  64. sendPost("doctor/pcCustomer/dealAppointCallService",params, function(){
  65. plus.nativeUI.closeWaiting();
  66. mui.toast("请求失败");
  67. }, function(res){
  68. plus.nativeUI.closeWaiting();
  69. if(res.status == 200){
  70. refreshHz()
  71. mui.toast("关联协同任务完成");
  72. closePage()
  73. }else{
  74. mui.toast("关联协同任务失败");
  75. }
  76. })
  77. })
  78. }
  79. //刷新事件
  80. function refreshHz(){
  81. var page = plus.webview.getWebviewById("xietongfuwu-management");
  82. if(page){ mui.fire(page, "refreshXietong") }
  83. var page1 = plus.webview.getWebviewById("xietongfuwu-message");
  84. if(page1){ mui.fire(page1, "refreshXTmsg") }
  85. }
  86. //关闭页面
  87. function closePage(){
  88. var page = plus.webview.getWebviewById("xietongfuwu-detail");
  89. if(page){ page.close('none') }
  90. var page1 = plus.webview.getWebviewById("appointment-register");
  91. if(page1){ page1.close('none') }
  92. setTimeout(function(){ mui.back() },1000)
  93. }
  94. template.helper("setPhoto", function(p) {
  95. return getImgUrl(p);
  96. });