prescribing.js 6.6 KB

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