Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

prescriptionTable.vue 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <template>
  2. <div class="prescriptionTable">
  3. <el-table v-if="activeType == 1" :data="prescription.advices" border style="width: 99%;"
  4. :row-style="{ color: '#303133' }"
  5. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  6. <el-table-column align="center" prop="day" width="70" label="序号">
  7. <template slot-scope="scope">
  8. <div style="display:flex;align-items:center;">
  9. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.groupno" placeholder=""></el-input>
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column align="center" prop="drug_name" label="名称">
  14. <template slot-scope="scope"><span :title="scope.row.drug_name">{{ scope.row.drug_name }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column align="center" prop="single_dose" width="120" label="单次用量">
  18. <template slot-scope="scope">
  19. <div style="display:flex;align-items:center;">
  20. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.single_dose" @input="getAllChangeTwo(scope)"
  21. style="width:50%;"></el-input>
  22. <!-- <div>{{scope.row.single_dose_unit}}</div> -->
  23. <el-select v-model="scope.row.single_dose_unit" placeholder="请选择" style="width:50%;"
  24. @change="getAllChangeTwo(scope)" :disabled="prescription.is_medicine_status" >
  25. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  26. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  27. <el-option :label="scope.row.drug.dose_unit"
  28. v-if="scope.row.drug.dose_unit != scope.row.drug.min_unit"
  29. :value="scope.row.drug.dose_unit"></el-option>
  30. </el-select>
  31. </div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  35. <template slot-scope="scope">
  36. <el-select :disabled="prescription.is_medicine_status" v-model="scope.row.delivery_way" placeholder="请选择">
  37. <el-option
  38. v-for="(item,index) in drugways"
  39. :key="index"
  40. :label="item.name"
  41. :value="item.name">
  42. </el-option>
  43. </el-select>
  44. </template>
  45. </el-table-column>
  46. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  47. <template slot-scope="scope">
  48. <el-select :disabled="prescription.is_medicine_status" v-model="scope.row.execution_frequency" placeholder="请选择" @change="getAllChangeTwo(scope)">
  49. <el-option
  50. v-for="item,index in efs"
  51. :key="index"
  52. :label="item.name"
  53. :value="item.name">
  54. </el-option>
  55. </el-select>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center" prop="day" width="70" label="天数">
  59. <template slot-scope="scope">
  60. <div style="display:flex;align-items:center;">
  61. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.day" @input="getAllChangeTwo(scope)" placeholder=""></el-input>
  62. {{'天'}}
  63. </div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column align="center" prop="prescribing_number" width="120" label="总量">
  67. <template slot-scope="scope">
  68. <div style="display:flex;align-items:center;">
  69. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.prescribing_number" @input="changePrescribingNumber(scope)"
  70. style="width:50%" placeholder=""></el-input>
  71. <!-- <div> {{scope.row.prescribing_number_unit}}</div> -->
  72. <el-select :disabled="prescription.is_medicine_status" v-model="scope.row.prescribing_number_unit" placeholder="请选择" style="width:50%;"
  73. @change="getPrescribingNumberUnit(scope)">
  74. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  75. <el-option :label="scope.row.drug.max_unit"
  76. v-if="scope.row.drug.min_unit != scope.row.drug.max_unit"
  77. :value="scope.row.drug.max_unit"></el-option>
  78. </el-select>
  79. </div>
  80. </template>
  81. </el-table-column>
  82. <el-table-column align="center" prop="retail_price" width="80" label="单价">
  83. <template slot-scope="scope">
  84. <div style="display:flex;align-items:center;">
  85. <el-input v-model="scope.row.retail_price" placeholder="" readonly></el-input>
  86. <div>{{'元'}}</div>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column align="center" prop="hosp_appr_flag" width="100" label="医院审批标志">
  91. <template slot-scope="scope">
  92. <el-select :disabled="prescription.is_medicine_status" v-model="scope.row.hosp_appr_flag" placeholder="请选择">
  93. <el-option label="审批通过" value="1"></el-option>
  94. <el-option label="无须审批" value="3"></el-option>
  95. <el-option label="审批不通过" value="2"></el-option>
  96. </el-select>
  97. </template>
  98. </el-table-column>
  99. <el-table-column align="center" prop="remark" width="80" label="国家编码">
  100. <template slot-scope="scope">
  101. <el-input v-model="scope.row.drug.medical_insurance_number" placeholder=""></el-input>
  102. </template>
  103. </el-table-column>
  104. <el-table-column align="center" prop="is_self_drug" width="100" label="医嘱性质" v-if="this.$store.getters.xt_user.org_id == 10206 || this.$store.getters.xt_user.org_id == 0">
  105. <template slot-scope="scope">
  106. <el-select :disabled="prescription.is_medicine_status" v-model="scope.row.is_self_drug" placeholder="请选择">
  107. <el-option label="非自备药" value="0"></el-option>
  108. <el-option label="自备药" value="1"></el-option>
  109. </el-select>
  110. </template>
  111. </el-table-column>
  112. <el-table-column align="center" prop="drug_way_count" width="100" label="给药途径次数" >
  113. <template slot-scope="scope">
  114. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.drug_way_count" :title="scope.row.drug_way_count" placeholder=""></el-input>
  115. </template>
  116. </el-table-column>
  117. <el-table-column align="center" prop="remark" width="50" label="备注">
  118. <template slot-scope="scope">
  119. <el-input :disabled="prescription.is_medicine_status" v-model="scope.row.remark" :title="scope.row.remark" placeholder=""></el-input>
  120. </template>
  121. </el-table-column>
  122. <el-table-column align="center" width="40" prop="name" label="操作">
  123. <template slot-scope="scope">
  124. <i class="el-icon-delete" @click="deleteDrug(scope.$index, scope.row)"></i>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <el-table v-if="activeType == 2" :data="prescription.project" border style="width: 99%;"
  129. :row-style="{ color: '#303133' }"
  130. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  131. <el-table-column align="center" type="index" width="40" label="序号"></el-table-column>
  132. <el-table-column align="center" prop="project_name" label="名称">
  133. <template slot-scope="scope"><span :title="scope.row.project_name">{{ scope.row.project_name }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="center" prop="statistical_classification" width="100" label="组">
  137. <template slot-scope="scope">{{scope.row.statistical_classification}}
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="center" prop="single_dose" width="80" label="单次用量">
  141. <template slot-scope="scope">
  142. <div style="display:flex;align-items:center;">
  143. <el-input v-model="scope.row.single_dose" @input="getProjectSingleDose(scope)"
  144. placeholder=""></el-input>
  145. <div>{{scope.row.unit}}</div>
  146. </div>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" prop="delivery_way" width="80" label="用法">
  150. <template slot-scope="scope">
  151. <el-autocomplete
  152. style="width:100%;"
  153. class="inline-input"
  154. v-model="scope.row.delivery_way"
  155. :fetch-suggestions="querySearch2"
  156. placeholder="请输入内容"
  157. ></el-autocomplete>
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="center" prop="execution_frequency" width="80" label="频率">
  161. <template slot-scope="scope">
  162. <el-input v-model="scope.row.execution_frequency" @input="getProjectSingleDose(scope)"
  163. placeholder=""></el-input>
  164. </template>
  165. </el-table-column>
  166. <el-table-column align="center" prop="number_days" width="70" label="天数">
  167. <template slot-scope="scope">
  168. <div style="display:flex;align-items:center;">
  169. <el-input v-model="scope.row.number_days" @input="getProjectSingleDose(scope)"
  170. placeholder=""></el-input>
  171. <div>{{'天'}}</div>
  172. </div>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="center" prop="total" width="70" label="总量">
  176. <template slot-scope="scope">
  177. <div style="display:flex;align-items:center;">
  178. <el-input v-model="scope.row.total" style="width:60%" placeholder=""></el-input>
  179. <div>{{scope.row.unit}}</div>
  180. </div>
  181. </template>
  182. </el-table-column>
  183. <el-table-column align="center" prop="name" width="70" label="单价">
  184. <template slot-scope="scope">
  185. <div style="display:flex;align-items:center;">
  186. <el-input v-model="scope.row.price" placeholder="" readonly></el-input>
  187. <div>{{'元'}}</div>
  188. </div>
  189. </template>
  190. </el-table-column>
  191. <el-table-column align="center" prop="name" width="50" label="国家编码">
  192. <template slot-scope="scope" v-if="scope.row.type==3">
  193. <el-input v-model="scope.row.good_info.medical_insurance_number"></el-input>
  194. </template>
  195. <template slot-scope="scope" v-if="scope.row.type==2">
  196. <el-input v-model="scope.row.project.medical_code"></el-input>
  197. </template>
  198. </el-table-column>
  199. <el-table-column align="center" prop="name" width="50" label="备注">
  200. <template slot-scope="scope">
  201. <el-input v-model="scope.row.remark" :title="scope.row.remark"></el-input>
  202. </template>
  203. </el-table-column>
  204. <el-table-column align="center" width="40" prop="name" label="操作">
  205. <template slot-scope="scope">
  206. <i class="el-icon-delete" @click="deleteProject(scope.row,scope.$index)"></i>
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. <div class="additionalBox">
  211. <div class="additionalOne" v-for="(item,index) in prescription.addition" :key="index">
  212. <span :title="item.item_name">{{item.item_name}}</span>
  213. <el-input v-model="item.price" placeholder="" style="width:50px;"></el-input>
  214. <el-input v-model="item.count" placeholder="" style="width:50px;"></el-input>
  215. <i class="el-icon-delete deleteIcon" @click="delAddition(index,item)"></i>
  216. </div>
  217. </div>
  218. </div>
  219. </template>
  220. <script>
  221. import { getDictionaryDataConfig } from '@/utils/data'
  222. import { delHisAddition, delHisAdvice, delHisProject, getInitData,getHisDoctorAdviceInfo } from '@/api/his/his'
  223. export default {
  224. props: {
  225. preDrugs: Array,
  226. activeType: Number,
  227. addtions_charge: Array,
  228. prescription: {
  229. type: Object,
  230. default: function() {
  231. return {
  232. name: '',
  233. advices: [],
  234. project: [],
  235. drugways: [],
  236. efs: [],
  237. drugList:[],
  238. adviceList:{}
  239. }
  240. }
  241. }
  242. },
  243. data() {
  244. return {
  245. advices: [],
  246. tableData: [],
  247. newoptions: [{
  248. value: '1',
  249. label: '1'
  250. }, {
  251. value: '2',
  252. label: '2'
  253. }, {
  254. value: '3',
  255. label: '3'
  256. }, {
  257. value: '4',
  258. label: '4'
  259. }, {
  260. value: '5',
  261. label: '5'
  262. }],
  263. value: '1',
  264. input: 1,
  265. efs: [],
  266. drugways: []
  267. }
  268. },
  269. methods: {
  270. createFilter(queryString) {
  271. return (restaurant) => {
  272. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  273. }
  274. },
  275. querySearch2(queryString, cb) {
  276. var restaurants = this.getDictionaryDataConfig('system', 'project_use')
  277. restaurants.map(item => {
  278. item.value = item.name
  279. })
  280. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  281. // 调用 callback 返回建议列表的数据
  282. cb(results)
  283. },
  284. delAddition(index, addition) {
  285. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  286. this.$message.error('该处方已经结算或记账,无法删除')
  287. return
  288. }
  289. this.$confirm('附加费删除后不可恢复,是否确认删除', '删除', {
  290. confirmButtonText: '确 定',
  291. cancelButtonText: '取 消',
  292. type: 'warning'
  293. }).then(() => {
  294. this.$nextTick(function() {
  295. if (addition.id == 0) {
  296. this.prescription.addition.splice(index, 1)
  297. } else {
  298. let params = {
  299. 'id': addition.id
  300. }
  301. delHisAddition(params).then(response => {
  302. if (response.data.state == 0) {
  303. this.$message.error(response.data.msg)
  304. return false
  305. } else {
  306. var temp2 = this.deepClone(this.prescription.addition)
  307. temp2.splice(index, 1)
  308. this.prescription.addition = temp2
  309. this.$message.success(response.data.data.msg)
  310. }
  311. })
  312. }
  313. })
  314. })
  315. .catch(() => {
  316. })
  317. },
  318. getInitData() {
  319. getInitData().then(response => {
  320. if (response.data.state == 0) {
  321. this.$message.error(response.data.msg)
  322. return false
  323. } else {
  324. this.drugways = response.data.data.drugways
  325. this.efs = response.data.data.efs
  326. this.drugList = response.data.data.drugs
  327. }
  328. })
  329. }, deleteDrug: function(index, row) {
  330. if (this.prescription.is_medicine_status){
  331. this.$message.error('该处方包含已发药的药品,无法删除')
  332. return
  333. }
  334. if (this.prescription.order_status == 2 || this.prescription.order_status ==5) {
  335. this.$message.error('该处方已经结算或记账,无法删除')
  336. return
  337. }
  338. this.$confirm('药品删除后不可恢复,是否确认删除', '删除', {
  339. confirmButtonText: '确 定',
  340. cancelButtonText: '取 消',
  341. type: 'warning'
  342. }).then(() => {
  343. this.$nextTick(function() {
  344. if (row.advice_id == 0) {
  345. this.prescription.advices.splice(index, 1)
  346. } else {
  347. let params = {
  348. 'id': row.advice_id
  349. }
  350. delHisAdvice(params).then(response => {
  351. if (response.data.state == 0) {
  352. this.$message.error(response.data.msg)
  353. return false
  354. } else {
  355. var temp2 = this.deepClone(this.prescription.advices)
  356. temp2.splice(index, 1)
  357. this.prescription.advices = temp2
  358. this.$message.success(response.data.data.msg)
  359. this.$emit("getSunziValue",temp2)
  360. }
  361. })
  362. }
  363. })
  364. })
  365. .catch(() => {
  366. })
  367. }, deepClone(source) {
  368. if (!source && typeof source !== 'object') {
  369. throw new Error('error arguments', 'shallowClone')
  370. }
  371. const targetObj = source.constructor === Array ? [] : {}
  372. Object.keys(source).forEach((keys) => {
  373. if (source[keys] && typeof source[keys] === 'object') {
  374. targetObj[keys] = this.deepClone(source[keys])
  375. } else {
  376. targetObj[keys] = source[keys]
  377. }
  378. })
  379. return targetObj
  380. },
  381. setNewData: function(data) {
  382. this.prescription = data
  383. // this.prescription.advices = data.advices
  384. },
  385. getDictionaryDataConfig(module, filed_name) {
  386. return getDictionaryDataConfig(module, filed_name)
  387. },
  388. getGroup(id) {
  389. var name = ''
  390. var statistics_category = getDictionaryDataConfig('system', 'statistics_category')
  391. // console.log('2235', statistics_category)
  392. for (let i = 0; i < statistics_category.length; i++) {
  393. if (id == statistics_category[i].id) {
  394. name = statistics_category[i].name
  395. }
  396. }
  397. return name
  398. },
  399. deleteProject(row, i) {
  400. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  401. this.$message.error('该处方已经结算或记账,无法删除')
  402. return
  403. }
  404. this.$confirm('项目删除后不可恢复,是否确认删除', '删除', {
  405. confirmButtonText: '确 定',
  406. cancelButtonText: '取 消',
  407. type: 'warning'
  408. }).then(() => {
  409. if (row.id == 0) {
  410. this.prescription.project.splice(i, 1)
  411. } else {
  412. let params = {
  413. 'id': row.id
  414. }
  415. delHisProject(params).then(response => {
  416. if (response.data.state == 0) {
  417. this.$message.error(response.data.msg)
  418. return false
  419. } else {
  420. for (let i = 0; i < this.prescription.project.length; i++) {
  421. if (this.prescription.project[i].id == row.id) {
  422. this.prescription.project.splice(i, 1)
  423. }
  424. }
  425. this.$message.success(response.data.data.msg)
  426. }
  427. })
  428. }
  429. })
  430. .catch(() => {
  431. })
  432. },
  433. getAllChange(scope) {
  434. console.log("scope23322332233232",scope)
  435. // if (this.prescription.is_medicine_status){
  436. // this.$message.error('该处方已经结算或记账,无法删除')
  437. //
  438. // }
  439. if(this.$store.getters.xt_user.org_id != 10206) {
  440. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  441. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  442. console.log(1)
  443. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  444. } else {
  445. console.log(12)
  446. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  447. }
  448. } else {
  449. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  450. console.log(123)
  451. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose)
  452. } else {
  453. console.log(1234)
  454. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose / scope.row.drug.min_number)
  455. }
  456. }
  457. if (scope.row.prescribing_number == 0) {
  458. scope.row.prescribing_number = 1
  459. }
  460. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  461. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  462. if (scope.row.prescribing_number > scope.row.drug.sum_count) {
  463. this.$message.error(scope.row.drug_name + '库存不足')
  464. }
  465. } else {
  466. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  467. this.$message.error(scope.row.drug_name + '库存不足')
  468. }
  469. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  470. }
  471. }
  472. },
  473. getAllChangeTwo(scope) {
  474. if (this.prescription.is_medicine_status){
  475. this.$message.error('该处方包含已发药的药品,无法修改')
  476. return
  477. }
  478. if(this.$store.getters.xt_user.org_id != 10206) {
  479. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  480. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  481. console.log(1)
  482. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  483. } else {
  484. console.log(12)
  485. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  486. }
  487. } else {
  488. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  489. console.log(123)
  490. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose)
  491. } else {
  492. console.log(1234)
  493. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose / scope.row.drug.min_number)
  494. }
  495. }
  496. if (scope.row.prescribing_number == 0) {
  497. scope.row.prescribing_number = 1
  498. }
  499. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  500. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  501. if (scope.row.drug.is_user != 1) {
  502. if (scope.row.prescribing_number > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  503. this.$message.error(scope.row.drug_name + '库存不足')
  504. }
  505. }
  506. } else {
  507. if (scope.row.drug.is_user != 1) {
  508. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  509. this.$message.error(scope.row.drug_name + '库存不足')
  510. }
  511. }
  512. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  513. }
  514. }
  515. },
  516. getPrescribingNumberUnit(scope) {
  517. if (this.prescription.is_medicine_status){
  518. this.$message.error('该处方包含已发药的药品,无法修改')
  519. return
  520. }
  521. console.log('scope',scope)
  522. // if(scope.row.drug.min_unit == scope.row.single_dose_unit){
  523. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  524. // scope.row.prescribing_number = scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day
  525. // }else{
  526. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency)) * scope.row.day / scope.row.drug.min_number)
  527. // }
  528. // }else{
  529. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  530. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose)
  531. // }else{
  532. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose / scope.row.drug.min_number)
  533. // }
  534. // }
  535. // if(scope.row.prescribing_number == 0){
  536. // scope.row.prescribing_number = 1
  537. // }
  538. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  539. scope.row.retail_price = scope.row.drug.min_price
  540. // if (scope.row.prescribing_number > scope.row.drug.total) {
  541. // this.$message.error(scope.row.drug_name + '库存不足')
  542. // }
  543. } else {
  544. // if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total) {
  545. // this.$message.error(scope.row.drug_name + '库存不足')
  546. // }
  547. scope.row.retail_price = scope.row.drug.retail_price
  548. }
  549. },
  550. changePrescribingNumber(scope) {
  551. if (this.prescription.is_medicine_status){
  552. this.$message.error('该处方包含已发药的药品,无法修改')
  553. return
  554. }
  555. // var max_number = 0
  556. // if(scope.row.prescribing_number_unit == scope.row.drug.max_unit){
  557. // max_number = parseInt(scope.row.prescribing_number) * scope.row.drug.min_number
  558. // }
  559. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  560. // max_number = parseInt(scope.row.prescribing_number)
  561. // }
  562. // console.log("修改的数量",max_number)
  563. // //查询该药品库存
  564. // if(this.drugList.length > 0){
  565. // var stock_number = 0
  566. // for(let i=0;i<this.drugList.length;i++){
  567. // if(scope.row.id == this.drugList[i].id){
  568. // for(let j=0;j<this.drugList[i].stock_in.length;j++){
  569. // stock_number += this.drugList[i].stock_in[j].stock_max_number * this.drugList[i].min_number + this.drugList[i].stock_in[j].stock_min_number
  570. // }
  571. // }
  572. // }
  573. // console.log("库存数量",stock_number)
  574. // }
  575. // if(scope.row.advice_id > 0){
  576. // //获取该药品上一次出库的的数量
  577. // getHisDoctorAdviceInfo(scope.row.advice_id).then(response=>{
  578. // if(response.data.state == 1){
  579. // var out_count = 0
  580. // var adviceList = response.data.data.advice
  581. // if(adviceList.prescribing_number_unit == adviceList.drug.max_number){
  582. // out_count = adviceList.prescribing_number * adviceList.drug.min_number
  583. // }
  584. // if(adviceList.prescribing_number_unit == adviceList.drug.min_unit){
  585. // out_count = adviceList.prescribing_number
  586. // }
  587. // //如果更改的数量大于修改之前的数量
  588. // if(max_number > out_count){
  589. // if((max_number - out_count)>stock_number){
  590. // this.$message.error(scope.row.drug_name + '库存不足')
  591. // }
  592. // }
  593. // }
  594. // })
  595. // }
  596. // if(scope.row.advice_id == 0){
  597. // if(max_number > stock_number){
  598. // this.$message.error(scope.row.drug_name + '库存不足')
  599. // }
  600. // }
  601. if(this.$store.getters.xt_user.org_id != 10206) {
  602. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  603. if (scope.row.drug.is_user != 1) {
  604. if (parseInt(scope.row.prescribing_number) > scope.row.drug.sum_count) {
  605. this.$message.error(scope.row.drug_name + '库存不足')
  606. }
  607. }
  608. } else {
  609. if (scope.row.drug.is_user != 1 && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  610. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  611. this.$message.error(scope.row.drug_name + '库存不足')
  612. }
  613. }
  614. }
  615. }
  616. },
  617. getProjectSingleDose(scope) {
  618. this.prescription.project[scope.$index].total = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.number_days ? scope.row.number_days : 1)
  619. if (this.prescription.project[scope.$index].total == 0) {
  620. this.prescription.project[scope.$index].total = 1
  621. }
  622. },
  623. getProjectDay(scope) {
  624. this.prescription.project[scope.$index].total = scope.row.single_dose * scope.row.number_days
  625. if (this.prescription.project[scope.$index].total == 0) {
  626. this.prescription.project[scope.$index].total = 1
  627. }
  628. },
  629. getNum(execution_frequency) {
  630. let arr = [
  631. { name: '立即执行', count: 1 },
  632. { name: '透析时', count: 1 },
  633. { name: '透析1h一次', count: 1 },
  634. { name: '透析2h一次', count: 1 },
  635. { name: '透析3h一次', count: 1 },
  636. { name: '每日一次', count: 1 },
  637. { name: '每日两次', count: 2 },
  638. { name: '每日三次', count: 3 },
  639. { name: '每晚一次', count: 1 },
  640. { name: '每晚', count: 1 },
  641. { name: '上机前', count: 1 },
  642. { name: '下机前', count: 1 },
  643. { name: '透析后立即', count: 1 },
  644. { name: '持续使用', count: 1 },
  645. { name: '临时开药', count: 1 },
  646. { name: '临睡前', count: 1 },
  647. { name: '隔日一次', count: 1 },
  648. { name: '隔三日一次', count: 1 },
  649. { name: '每二小时一次', count: 12 },
  650. { name: '每四小时一次', count: 6 },
  651. { name: '每六小时一次', count: 4 },
  652. { name: '每八小时一次', count: 3 }
  653. ]
  654. let num = ''
  655. arr.map(item => {
  656. if (item.name == execution_frequency) {
  657. num = item.count
  658. }
  659. })
  660. if (num == '') {
  661. num = 1
  662. }
  663. return num
  664. },
  665. }, mounted() {
  666. this.getInitData()
  667. },
  668. watch: {
  669. 'prescription.advices': {
  670. handler(newVal, oldVal) {
  671. console.log("检查我我我我",this.prescription.advices)
  672. console.log("检查我我我我",this.prescription.project)
  673. },
  674. deep: true
  675. }
  676. // "prescription.project":{
  677. // handler(newVal,oldVal){
  678. // newVal.map((item,index) => {
  679. // if(item.single_dose != oldVal[index].single_dose || item.number_days != oldVal[index].number_days){
  680. // item.total = item.single_dose * item.number_days
  681. // }
  682. // })
  683. // },
  684. // deep:true
  685. // }
  686. }
  687. }
  688. </script>
  689. <style lang="scss">
  690. .prescriptionTable {
  691. .el-input__inner {
  692. padding: 0 5px;
  693. }
  694. .additionalBox {
  695. margin-top: 20px;
  696. display: flex;
  697. flex-wrap: wrap;
  698. .additionalOne {
  699. margin-right: 20px;
  700. margin-bottom: 10px;
  701. display: flex;
  702. align-items: center;
  703. > span {
  704. white-space: nowrap;
  705. overflow: hidden;
  706. text-overflow: ellipsis;
  707. width: 80px;
  708. display: inline-block;
  709. font-size: 14px;
  710. }
  711. }
  712. .deleteIcon {
  713. color: red;
  714. margin-left: 5px;
  715. }
  716. }
  717. .el-table th .cell, .el-table td .cell {
  718. padding: 0 2px;
  719. white-space: pre-line;
  720. }
  721. .el-icon-delete {
  722. color: red;
  723. }
  724. }
  725. </style>