questionaires.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. var pro_id,
  2. self,
  3. prescriptionCode,
  4. followupid,
  5. project_data;
  6. var $form = $("#question_form");
  7. var initPage = function(){
  8. var classes;
  9. prescriptionCode = self.prescriptionCode;
  10. followupid = self.followupid;
  11. project_data = gTemplate[pro_id];
  12. var nameObj = {1:'症状',2:'体征及生活方式问卷'}
  13. $('#title').text(nameObj[pro_id])
  14. if(pro_id == 1){classes='1'}
  15. if(pro_id == 2){classes='2,4'}
  16. var params = {
  17. prescriptioncode:prescriptionCode,
  18. followupProject:classes
  19. }
  20. plus.nativeUI.showWaiting();
  21. sendGet('doctor/prescription/followupcontent/getinfo', params,function(){
  22. plus.nativeUI.closeWaiting();
  23. mui.toast('请求失败')
  24. }, function(res){
  25. plus.nativeUI.closeWaiting();
  26. if(res.status == 200){
  27. if(! $.isEmptyObject(res.data)){
  28. for(var key in project_data){
  29. project_data[key].value = res.data[key];
  30. }
  31. console.log(project_data)
  32. var html = template("item", {data:project_data})
  33. $form.append(html);
  34. bindEvents()
  35. }
  36. }
  37. })
  38. },
  39. bindEvents = function(){
  40. $("#save").on("tap", function(){
  41. if(! followupid){
  42. mui.toast('随访创建失败,请重新登记')
  43. return
  44. }
  45. var params = {
  46. followupid:followupid,
  47. prescriptioncode:prescriptionCode,
  48. type:pro_id
  49. }
  50. plus.nativeUI.showWaiting();
  51. sendPost('doctor/prescription/followupcontent/importfollowupcontent', params,function(){
  52. plus.nativeUI.closeWaiting();
  53. mui.toast('请求失败')
  54. }, function(res){
  55. plus.nativeUI.closeWaiting();
  56. if(res.status == 200){
  57. mui.toast('成功填入随访记录')
  58. setTimeout(function(){
  59. mui.back()
  60. },1000)
  61. }else{
  62. mui.toast(res.msg)
  63. }
  64. })
  65. })
  66. }
  67. mui.plusReady(function(){
  68. self = plus.webview.currentWebview();
  69. pro_id = self.pro_id;
  70. //初始化页面内容
  71. initPage();
  72. })