fv-survey.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. var request = getRequest(),
  2. prescriptionCode = request.code,
  3. fv_id = request.fv_id;
  4. $(function(){
  5. getList();
  6. bindEvents();
  7. })
  8. function getList(){
  9. var params = {
  10. prescriptioncode: prescriptionCode
  11. };
  12. consultingAPI.getFollowupCountList(params).then(function(res){
  13. if(res.status == 200){
  14. var list = _.map(res.data, function(o){
  15. o.jsonStr = JSON.stringify(o);
  16. return o;
  17. });
  18. var html = template('info_tmp', {list: list});
  19. $("#container").empty().append(html);
  20. getConsultStatus()
  21. }else{
  22. showErrorMsg(res.msg);
  23. }
  24. });
  25. }
  26. function getConsultStatus(){
  27. var params = {
  28. prescriptionCode: prescriptionCode
  29. }
  30. consultingAPI.getConsultStatusByXFcode({data: params}).then(function(res){
  31. if(res.status == 200){
  32. //咨询状态(0进行中,1已完成,-1患者取消,-2超时未响应自动关闭)
  33. if(res.data == 0) { //咨询未结束
  34. $('.send-survey').show()
  35. } else { //咨询已结束
  36. $('.send-survey').hide()
  37. }
  38. }else{
  39. showErrorMsg('获取咨询信息失败');
  40. }
  41. })
  42. }
  43. function bindEvents(){
  44. $("body").on('click', ".import-fv", function(e){
  45. e.stopPropagation();
  46. var $this = $(this),
  47. $box = $this.closest(".box"),
  48. jsonObj = $box.data('json'),
  49. params = {
  50. followupid: fv_id,
  51. prescriptioncode: prescriptionCode,
  52. type: jsonObj.type //1身体异常症状问卷,2体征及生活方式调查问卷
  53. };
  54. consultingAPI.importfollowupcontent(params).then(function(res){
  55. if(res.status == 200){
  56. showSuccessMsg("已填入");
  57. }else{
  58. showErrorMsg(res.msg);
  59. }
  60. })
  61. });
  62. $("body").on('click', '.send-survey', function(e){
  63. e.stopPropagation();
  64. var $this = $(this),
  65. $box = $this.closest(".box"),
  66. jsonObj = $box.data('json'),
  67. params = {
  68. followupid: fv_id,
  69. prescriptionCode: prescriptionCode,
  70. type: jsonObj.type //1身份异常症状问卷,2体征及生活方式调查问卷
  71. };
  72. consultingAPI.addPrescriptionFollowupContentConsult(params).then(function(res){
  73. if(res.status == 200){
  74. showSuccessMsg("已发送");
  75. }else{
  76. showErrorMsg(res.msg);
  77. }
  78. })
  79. });
  80. $("body").on('click', '.box', function(){
  81. var $this = $(this),
  82. json = $this.data('json');
  83. location.href = "survey-detail.html?prescriptionCode="+prescriptionCode+"&fv_id="+fv_id+"&type="+json.type+"&projectId="+json.typevalue+'&state='+json.statue;
  84. });
  85. }