prescribing.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. import { getMaxMinDoaseNumber } from '@/api/diagnosis.js'
  2. export default {
  3. data() {
  4. return {
  5. showCase: false, // 参考医案弹窗
  6. showUnifyPresc: false, // 统建处方弹窗
  7. showPresc: false, // 方剂 协定方弹窗
  8. showSafeD: false, // 安全合理用药
  9. isShrink: false, // 是否是收缩状态
  10. // 中药处方 中成药处方 适宜技术处方提交前暂存
  11. zhongPrescriptionVo: null,
  12. chengPrescriptionVo: null,
  13. technologyPrescriptionVo: null,
  14. doseMax: 0, // 最大开方数量
  15. doseMin: 0, // 最小开方数量
  16. doseAllowMax: 0, // 是否允许最大开方
  17. doseAllowMin: 0, // 是否允许最小开方
  18. innerWidth: 0,// 屏幕宽度
  19. isDaiJian: 2, // 1是 0 否 2:自煎
  20. isPs: 1, // 是否配送 0:是 1:否
  21. isShowDj: true, // 是否展示代煎
  22. isShowPs: true, // 是否展示配送
  23. showAddress: false, // 展示选择代煎 地址
  24. }
  25. },
  26. beforeRouteEnter(to, from, next) {
  27. next(vm => {
  28. vm.setWidth()
  29. })
  30. },
  31. beforeRouteLeave(to, from, next) {
  32. let width = window.innerWidth
  33. if (width <= 1280 && width > 800) {
  34. document.body.style.width = '1280px'
  35. }
  36. if (width < 800) {
  37. document.body.style.width = '100%'
  38. }
  39. next()
  40. },
  41. beforeCreate() {
  42. this.$nextTick(vm => {
  43. let width = window.innerWidth
  44. this.innerWidth = width
  45. })
  46. },
  47. mounted() {
  48. this.isShrink = window.localStorage.getItem('isShrink') == 0 ? false : true
  49. this.getMaxMinDoaseNumber()
  50. },
  51. methods: {
  52. psChange(e) {
  53. this.isPs = e
  54. },
  55. djChange(e) {
  56. this.isDaiJian = e
  57. },
  58. // 展示收缩模式弹窗
  59. openDCase() {
  60. this.showCase = true
  61. },
  62. openPrec() {
  63. this.showPresc = true
  64. },
  65. openUnifyPrescPrec() {
  66. this.showUnifyPresc = true
  67. },
  68. opensafeD() {
  69. this.showSafeD = true
  70. },
  71. // 设置收缩模式
  72. setShrink() {
  73. this.isShrink = !this.isShrink
  74. window.localStorage.setItem('isShrink', this.isShrink ? 1 : 0)
  75. this.setWidth()
  76. },
  77. //
  78. setWidth() {
  79. let width = window.innerWidth
  80. this.innerWidth = width
  81. if (width <= 1280 && width > 800) {
  82. document.body.style.width = '1280px'
  83. }
  84. if (width < 800) {
  85. let isShrink = window.localStorage.getItem('isShrink')
  86. isShrink = Number(isShrink)
  87. if (!isShrink) {
  88. // 扩展状态
  89. document.body.style.width = '1280px'
  90. } else {
  91. // 收缩模式
  92. document.body.style.width = '100%'
  93. }
  94. }
  95. },
  96. // 我的协定方转方
  97. agreeTurnRecipe(agreeInfo) {
  98. this.turnRecipe2(agreeInfo)
  99. if (agreeInfo.diseaseid) {
  100. this.$refs.TCM.setParams({
  101. namemedicine: agreeInfo.diseasename,
  102. disid: agreeInfo.diseaseid,
  103. symptomid: agreeInfo.symptomid,
  104. syndrometypes: agreeInfo.symptomname,
  105. treatment: agreeInfo.treatment
  106. });
  107. setTimeout(() => {
  108. this.tcmClick(false);
  109. }, 200);
  110. }
  111. },
  112. // 补充中医电子病历
  113. handleReplenish() {
  114. let params = this.$refs.TCM.getParams();
  115. this.$router.push({
  116. path: `/index/dialectical?name=${params.namemedicine}`
  117. })
  118. },
  119. // 切换药房时 监听煎 配送是否显示
  120. onUpdateDp(e) {
  121. let isShowDj = e.displayAgency == 0 ? true : false // 是否展示代煎 0 展示 1不展示
  122. let isShowPs = e.displayDelivery == 0 ? true : false // 是否展示配送 0 展示 1不展示
  123. // this.isDaiJian = e.defaultAgency == 0 ? 1 : ''
  124. this.isShowDj = isShowDj
  125. this.isShowPs = isShowPs
  126. this.openAddress()
  127. },
  128. openAddress() {
  129. if (this.isShowDj || this.isShowPs) {
  130. this.showAddress = true;
  131. setTimeout(() => {
  132. let children = this.$children.filter(item => {
  133. return (
  134. item.name == "中药处方" ||
  135. item.name == "中药制剂" ||
  136. item.name == "适宜技术处方"
  137. );
  138. });
  139. let child = children[0];
  140. this.isDaiJian = child.recipe_tabs[child.recipe_tabs_c].bottom_form.isDaiJian
  141. this.isPs = child.recipe_tabs[child.recipe_tabs_c].bottom_form.radio
  142. }, 200)
  143. }
  144. },
  145. // 提交地址信息
  146. submitAddress() {
  147. this.showAddress = false
  148. return
  149. let zhongPrescriptionVo = this.dealRecipe1();
  150. let chengPrescriptionVo = {};
  151. setTimeout(() => {
  152. chengPrescriptionVo = this.dealRecipe2();
  153. }, 100);
  154. let technologyPrescriptionVo = {};
  155. setTimeout(() => {
  156. technologyPrescriptionVo = this.dealRecipe3();
  157. }, 200);
  158. setTimeout(() => {
  159. this._getRecipePriview(
  160. zhongPrescriptionVo,
  161. chengPrescriptionVo,
  162. technologyPrescriptionVo
  163. );
  164. }, 500);
  165. },
  166. // 获取医保规则最大/最小药味数
  167. async getMaxMinDoaseNumber() {
  168. let res = await getMaxMinDoaseNumber()
  169. if (res.ResultCode == 0) {
  170. this.doseMax = res.Data.zdyws
  171. this.doseMin = res.Data.zxyws
  172. this.doseAllowMax = res.Data.zdyws_mandatoryOrNot // 0 否(可以继续开方) 1是(不可以继续开方)
  173. this.doseAllowMin = res.Data.zxyws_mandatoryOrNot // 0 否 1是
  174. }
  175. }
  176. },
  177. }