medication.js 2.7 KB

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