medication.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. new Vue({
  2. el: '#app',
  3. data: {
  4. frequency_dict:recipe_frequency_dict,
  5. unit_dict:measure_unit_dict,
  6. DRUG_COMPLIANCE_CODE:'',
  7. hasInsulin:[],//胰岛素药
  8. noInsulin:[],//其他药
  9. objData:''
  10. },
  11. mounted: function() {
  12. var vm = this
  13. console.log(measure_unit_dict)
  14. var Request = GetRequest();
  15. recordAPI.getFollowupProjectData({id:Request["id"],followupProject:6}).then(function(res){
  16. if(res.status==200){
  17. var data = res.data;
  18. vm.objData = res.data
  19. vm.DRUG_COMPLIANCE_CODE = data.DRUG_COMPLIANCE_CODE;
  20. }
  21. })
  22. recordAPI.getFollowupDrugs({id:Request["id"]}).then(function(res){
  23. if(res.status==200){
  24. var data = res.data.DRUG_LIST;
  25. if(data.length>0){
  26. for(var i=0;i<data.length;i++){
  27. if(data[i].drugsGroup == 'insulin'){//胰岛素药品
  28. vm.hasInsulin.push(data[i])
  29. }else{
  30. vm.noInsulin.push(data[i])
  31. }
  32. }
  33. }
  34. }else{
  35. toastr.error('获取数据失败')
  36. }
  37. })
  38. },
  39. methods:{
  40. saveButton:function(){
  41. var vm = this;
  42. if(!vm.DRUG_COMPLIANCE_CODE){
  43. toastr.error('请选择服药依从性')
  44. return
  45. }
  46. params = {id: vm.objData.followup_id}
  47. var arr = [];
  48. $(".inline-container-p").each(function(i,v){//把所有被选中的复选框的值存入数组
  49. var checkID = {};
  50. checkID['drugsName'] = $(this).attr('name')
  51. checkID['drugsCode'] = $(this).attr('code')
  52. checkID['drugsGroup'] = $(this).attr('group')
  53. checkID['dose'] = $(this).attr('dose')
  54. checkID['unit'] = $(this).attr('value1')
  55. checkID['frequency'] = $(this).attr('value2')
  56. arr.push(checkID)
  57. });
  58. $(".inline-container-y").each(function(i,v){//把所有被选中的复选框的值存入数组
  59. var checkID1 = {};
  60. checkID1['drugsName'] = $(this).attr('name')
  61. checkID1['drugsCode'] = $(this).attr('code')
  62. checkID1['drugsGroup'] = $(this).attr('group')
  63. checkID1['dose'] = $(this).attr('dose')
  64. checkID1['unit'] = $(this).attr('value1')
  65. checkID1['frequency'] = $(this).attr('value2')
  66. arr.push(checkID1)
  67. });
  68. params.drugsData = JSON.stringify(arr)
  69. recordAPI.saveDrugs(params).then(function(res){
  70. if(res.status==200){
  71. // toastr.error("保存成功")
  72. var params = {};
  73. params.id = vm.objData.followup_id;
  74. params.followupProject = vm.objData.followup_project;
  75. params.followupProjectData = JSON.stringify({'DRUG_COMPLIANCE_CODE':vm.DRUG_COMPLIANCE_CODE})
  76. recordAPI.saveDrugsLaw(params).then(function(res){
  77. if(res.status==200){
  78. toastr.error("保存成功")
  79. }else{
  80. toastr.error(res.msg)
  81. }
  82. })
  83. }else{
  84. toastr.error(res.msg)
  85. }
  86. })
  87. }
  88. }
  89. })