info-confirm.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. var imgKey = null;
  2. var xtCode;
  3. var scroller1 = null;
  4. mui.init();
  5. mui.plusReady(function(){
  6. var doctorTemp = window.localStorage.getItem("doctorTemp");
  7. doctorInfo = JSON.parse(plus.storage.getItem("docInfo"));
  8. if(doctorTemp&&doctorTemp!=""){
  9. doctorTemp = JSON.parse(doctorTemp);
  10. }else{
  11. //return;
  12. }
  13. var arrangeDate = window.localStorage.getItem("arrangeDate");
  14. var self = plus.webview.currentWebview();
  15. var patient = self.patient;
  16. xtCode = self.xtCode;
  17. if(arrangeDate&&arrangeDate!=""){
  18. arrangeDate = JSON.parse(arrangeDate);
  19. }
  20. bindEvents();
  21. function bindEvents(){
  22. $(".visit-ul").on("click",".searchbar-clear",function(){
  23. $(this).prev().val("");
  24. $(this).css("pointer-events","none").css("opacity",0);
  25. $(this).prev().focus();
  26. return false;
  27. });
  28. $(".div-immediately-btn").on("click",function(){
  29. applyData();
  30. })
  31. }
  32. var patientInfo;
  33. initData();
  34. function initData(){
  35. $("#hospitalName").html(doctorTemp['hospitalName']);
  36. $("#hosDeptDocName").html(doctorTemp['hosDeptName']+" "+doctorTemp['name']);
  37. $("#yyTime").html(arrangeDate['startTime'].split(" ")[0]+" "+arrangeDate['yysj']);
  38. query();
  39. }
  40. function query() {
  41. var data={patient:patient};
  42. sendPost('doctor/patient/info', data, queryFailed, querySuccess);
  43. }
  44. function querySuccess(res){
  45. if(res.status==200){
  46. patientInfo = res.data;
  47. //身份证号
  48. var idcard = patientInfo.idcard;
  49. var jj = idcard.substring(idcard.length-2,idcard.length-9);
  50. var idcardStr = idcard.replace(jj,'*******');
  51. //医保卡号
  52. var ssc = patientInfo.ssc;
  53. var j = ssc.substring(ssc.length,ssc.length-3);
  54. var sscStr = ssc.replace(j,'***');
  55. $("#username").html(res.data.name);
  56. $("#idcard").html(idcardStr);
  57. $("#ssc").html(sscStr);
  58. $("#mobile").val(res.data.mobile);
  59. }else{
  60. queryFailed(res);
  61. }
  62. }
  63. function queryFailed(res){
  64. plus.nativeUI.closeWaiting();
  65. if (res && res.msg) {
  66. mui.toast(res.msg);
  67. } else {
  68. mui.toast("加载失败");
  69. }
  70. }
  71. function applyData(){
  72. var mobile = $("#mobile").val();
  73. if(!isphone(mobile)) {
  74. mui.toast("请输入正确的手机号码");
  75. return;
  76. }
  77. plus.nativeUI.showWaiting();
  78. var params = {};
  79. params.city=CITY_CODE;
  80. params.hospitalId=doctorTemp.hospitalId;
  81. params.hospitalName = doctorTemp.hospitalName;
  82. params.hosDeptId = doctorTemp.hosDeptId;
  83. params.hosDeptName = doctorTemp.hosDeptName;
  84. params.doctorId = doctorTemp.id;
  85. params.doctorName = doctorTemp.name;
  86. delete arrangeDate.yysj;
  87. params.arrangeDate=JSON.stringify(arrangeDate);
  88. params.patient = patientInfo.code;
  89. params.patientName = patientInfo.name;
  90. params.cardNo = patientInfo.idcard;
  91. params.clinicCard = patientInfo.ssc;
  92. params.dcode = doctorInfo.code;//代预约人code
  93. params.dname = doctorInfo.name;//代预约人编码
  94. params.patientPhone = mobile;//patientInfo.mobile;
  95. sendPost("third/guahao/CreateOrderByDoctor",params,queryFailed,submitSuccess);
  96. }
  97. function submitSuccess(res){
  98. plus.nativeUI.closeWaiting();
  99. if(res.status==200){
  100. mui.fire(plus.webview.getWebviewById('p2dzixun'), 'update');
  101. var myappo = plus.webview.getWebviewById('my-appointment');
  102. var docappo = plus.webview.getWebviewById('doctor-appointment');
  103. if(myappo){
  104. mui.fire(myappo, 'update');
  105. }else if(docappo){
  106. mui.fire(docappo, 'update');
  107. }
  108. mui.toast("预约成功");
  109. setTimeout(function(){
  110. openWebviewExtras("detail-appointment.html",{dataId:res.data,xtCode:xtCode});
  111. },500)
  112. }else{
  113. queryFailed(res);
  114. }
  115. }
  116. });