prescriptionTable.vue 34KB

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