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

prescriptionTable.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <div class="prescriptionTable">
  3. <el-table v-if="activeType == 1" :data="prescription.advices" border style="width: 99%;" :row-style="{ color: '#303133' }"
  4. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  5. <el-table-column align="center" type="index" width="40" label="序号"></el-table-column>
  6. <el-table-column align="center" prop="drug_name" label="名称">
  7. <template slot-scope="scope"><span :title="scope.row.drug_name">{{ scope.row.drug_name }}</span></template>
  8. </el-table-column>
  9. <el-table-column align="center" prop="single_dose" width="120" label="单次用量">
  10. <template slot-scope="scope">
  11. <div style="display:flex;align-items:center;">
  12. <el-input v-model="scope.row.single_dose" @input="getAllChange(scope)" style="width:50%;"></el-input>
  13. <!-- <div>{{scope.row.single_dose_unit}}</div> -->
  14. <el-select v-model="scope.row.single_dose_unit" placeholder="请选择" style="width:50%;" @change="getAllChange(scope)">
  15. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  16. <el-option :label="scope.row.drug.dose_unit" v-if="scope.row.drug.dose_unit != scope.row.drug.min_unit" :value="scope.row.drug.dose_unit"></el-option>
  17. </el-select>
  18. </div>
  19. </template>
  20. </el-table-column>
  21. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  22. <template slot-scope="scope">
  23. <el-select v-model="scope.row.delivery_way" placeholder="请选择">
  24. <el-option
  25. v-for="(item,index) in drugways"
  26. :key="index"
  27. :label="item.name"
  28. :value="item.name">
  29. </el-option>
  30. </el-select>
  31. </template>
  32. </el-table-column>
  33. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  34. <template slot-scope="scope">
  35. <el-select v-model="scope.row.execution_frequency" placeholder="请选择" @change="getAllChange(scope)">
  36. <el-option
  37. v-for="item,index in efs"
  38. :key="index"
  39. :label="item.name"
  40. :value="item.name">
  41. </el-option>
  42. </el-select>
  43. </template>
  44. </el-table-column>
  45. <el-table-column align="center" prop="day" width="70" label="天数">
  46. <template slot-scope="scope">
  47. <div style="display:flex;align-items:center;">
  48. <el-input v-model="scope.row.day" @input="getAllChange(scope)" placeholder=""></el-input>{{'天'}}
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column align="center" prop="prescribing_number" width="120" label="总量">
  53. <template slot-scope="scope">
  54. <div style="display:flex;align-items:center;">
  55. <el-input v-model="scope.row.prescribing_number" @input="changePrescribingNumber(scope)" style="width:50%" placeholder=""></el-input>
  56. <!-- <div> {{scope.row.prescribing_number_unit}}</div> -->
  57. <el-select v-model="scope.row.prescribing_number_unit" placeholder="请选择" style="width:50%;" @change="getPrescribingNumberUnit(scope)">
  58. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  59. <el-option :label="scope.row.drug.max_unit" v-if="scope.row.drug.min_unit != scope.row.drug.max_unit" :value="scope.row.drug.max_unit"></el-option>
  60. </el-select>
  61. </div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column align="center" prop="retail_price" width="80" label="单价">
  65. <template slot-scope="scope">
  66. <div style="display:flex;align-items:center;">
  67. <el-input v-model="scope.row.retail_price" placeholder="" readonly></el-input>
  68. <div>{{'元'}}</div>
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column align="center" prop="remark" width="50" label="备注">
  73. <template slot-scope="scope">
  74. <el-input v-model="scope.row.remark" :title="scope.row.remark" placeholder=""></el-input>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" width="40" prop="name" label="操作">
  78. <template slot-scope="scope">
  79. <i class="el-icon-delete" @click="deleteDrug(scope.$index, scope.row)"></i>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <el-table v-if="activeType == 2" :data="prescription.project" border style="width: 99%;" :row-style="{ color: '#303133' }"
  84. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  85. <el-table-column align="center" type="index" width="40" label="序号"></el-table-column>
  86. <el-table-column align="center" prop="project_name" label="名称">
  87. <template slot-scope="scope"><span :title="scope.row.project_name">{{ scope.row.project_name }}</span></template>
  88. </el-table-column>
  89. <el-table-column align="center" prop="statistical_classification" width="100" label="组">
  90. <template slot-scope="scope">{{scope.row.type == 2?getGroup(scope.row.statistical_classification):"耗材"}}</template>
  91. </el-table-column>
  92. <el-table-column align="center" prop="single_dose" width="80" label="单次用量">
  93. <template slot-scope="scope">
  94. <div style="display:flex;align-items:center;">
  95. <el-input v-model="scope.row.single_dose" @input="getProjectSingleDose(scope)" placeholder=""></el-input>
  96. <div>{{scope.row.unit}}</div>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column align="center" prop="delivery_way" width="80" label="用法">
  101. <template slot-scope="scope">
  102. <el-autocomplete
  103. style="width:100%;"
  104. class="inline-input"
  105. v-model="scope.row.delivery_way"
  106. :fetch-suggestions="querySearch2"
  107. placeholder="请输入内容"
  108. ></el-autocomplete>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" prop="execution_frequency" width="80" label="频率">
  112. <template slot-scope="scope">
  113. <el-input v-model="scope.row.execution_frequency" @input="getProjectSingleDose(scope)" placeholder=""></el-input>
  114. </template>
  115. </el-table-column>
  116. <el-table-column align="center" prop="number_days" width="70" label="天数">
  117. <template slot-scope="scope">
  118. <div style="display:flex;align-items:center;">
  119. <el-input v-model="scope.row.number_days" @input="getProjectSingleDose(scope)" placeholder=""></el-input>
  120. <div>{{'天'}}</div>
  121. </div>
  122. </template>
  123. </el-table-column>
  124. <el-table-column align="center" prop="total" width="70" label="总量">
  125. <template slot-scope="scope">
  126. <div style="display:flex;align-items:center;">
  127. <el-input v-model="scope.row.total" style="width:60%" placeholder=""></el-input>
  128. <div>{{scope.row.unit}}</div>
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column align="center" prop="name" width="70" label="单价">
  133. <template slot-scope="scope">
  134. <div style="display:flex;align-items:center;">
  135. <el-input v-model="scope.row.price" placeholder="" readonly></el-input>
  136. <div>{{'元'}}</div>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="center" prop="name" width="50" label="备注">
  141. <template slot-scope="scope">
  142. <el-input v-model="scope.row.remark" :title="scope.row.remark"></el-input>
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="center" width="40" prop="name" label="操作">
  146. <template slot-scope="scope">
  147. <i class="el-icon-delete" @click="deleteProject(scope.row,scope.$index)"></i>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <div class="additionalBox">
  152. <div class="additionalOne" v-for="(item,index) in prescription.addition" :key="index">
  153. <span :title="item.item_name">{{item.item_name}}</span>
  154. <el-input v-model="item.price" placeholder="" style="width:50px;"></el-input>
  155. <el-input v-model="item.count" placeholder="" style="width:50px;"></el-input>
  156. <i class="el-icon-delete deleteIcon" @click="delAddition(index,item)"></i>
  157. </div>
  158. </div>
  159. </div>
  160. </template>
  161. <script>
  162. import { getDictionaryDataConfig} from "@/utils/data";
  163. import { getInitData,delHisAdvice,delHisProject,delHisAddition } from '@/api/his/his'
  164. export default {
  165. props: {
  166. preDrugs: Array,
  167. activeType: Number,
  168. addtions_charge:Array,
  169. prescription:{
  170. type:Object,
  171. default: function () {
  172. return {
  173. name:"",
  174. advices:[],
  175. project:[],
  176. drugways:[],
  177. efs:[],
  178. };
  179. }
  180. },
  181. },
  182. data() {
  183. return {
  184. advices:[],
  185. tableData: [],
  186. newoptions: [{
  187. value: '1',
  188. label: '1'
  189. }, {
  190. value: '2',
  191. label: '2'
  192. }, {
  193. value: '3',
  194. label: '3'
  195. }, {
  196. value: '4',
  197. label: '4'
  198. }, {
  199. value: '5',
  200. label: '5'
  201. }],
  202. value: '1',
  203. input: 1,
  204. efs:[],
  205. drugways:[]
  206. }
  207. },
  208. methods:{
  209. createFilter(queryString) {
  210. return (restaurant) => {
  211. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  212. }
  213. },
  214. querySearch2(queryString, cb) {
  215. var restaurants = this.getDictionaryDataConfig("system","project_use")
  216. restaurants.map(item => {
  217. item.value = item.name
  218. })
  219. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  220. // 调用 callback 返回建议列表的数据
  221. cb(results)
  222. },
  223. delAddition(index, addition){
  224. if(this.prescription.order_status == 2){
  225. this.$message.error('该处方已经结算,无法删除')
  226. return
  227. }
  228. this.$confirm("附加费删除后不可恢复,是否确认删除", "删除", {
  229. confirmButtonText: "确 定",
  230. cancelButtonText: "取 消",
  231. type: "warning"
  232. }).then(() => {
  233. this.$nextTick(function(){
  234. if(addition.id == 0){
  235. this.prescription.addition.splice(index, 1)
  236. }else{
  237. let params = {
  238. 'id': addition.id,
  239. }
  240. delHisAddition(params).then(response => {
  241. if (response.data.state == 0) {
  242. this.$message.error(response.data.msg)
  243. return false
  244. } else {
  245. var temp2 = this.deepClone(this.prescription.addition)
  246. temp2.splice(index, 1)
  247. this.prescription.addition = temp2
  248. this.$message.success(response.data.data.msg)
  249. }
  250. })
  251. }
  252. });
  253. })
  254. .catch(() => {});
  255. },
  256. getInitData(){
  257. getInitData().then(response => {
  258. if (response.data.state == 0) {
  259. this.$message.error(response.data.msg)
  260. return false
  261. } else {
  262. this.drugways = response.data.data.drugways
  263. this.efs = response.data.data.efs
  264. }
  265. })
  266. },deleteDrug:function(index, row){
  267. if(this.prescription.order_status == 2){
  268. this.$message.error('该处方已经结算,无法删除')
  269. return
  270. }
  271. this.$confirm("药品删除后不可恢复,是否确认删除", "删除", {
  272. confirmButtonText: "确 定",
  273. cancelButtonText: "取 消",
  274. type: "warning"
  275. }).then(() => {
  276. this.$nextTick(function(){
  277. if(row.advice_id == 0){
  278. this.prescription.advices.splice(index, 1)
  279. }else{
  280. let params = {
  281. 'id': row.advice_id,
  282. }
  283. delHisAdvice(params).then(response => {
  284. if (response.data.state == 0) {
  285. this.$message.error(response.data.msg)
  286. return false
  287. } else {
  288. var temp2 = this.deepClone(this.prescription.advices)
  289. temp2.splice(index, 1)
  290. this.prescription.advices = temp2
  291. this.$message.success(response.data.data.msg)
  292. }
  293. })
  294. }
  295. });
  296. })
  297. .catch(() => {});
  298. },deepClone(source) {
  299. if (!source && typeof source !== 'object') {
  300. throw new Error('error arguments', 'shallowClone')
  301. }
  302. const targetObj = source.constructor === Array ? [] : {}
  303. Object.keys(source).forEach((keys) => {
  304. if (source[keys] && typeof source[keys] === 'object') {
  305. targetObj[keys] = this.deepClone(source[keys])
  306. } else {
  307. targetObj[keys] = source[keys]
  308. }
  309. })
  310. return targetObj
  311. },
  312. setNewData:function(data){
  313. this.prescription = data
  314. // this.prescription.advices = data.advices
  315. },
  316. getDictionaryDataConfig(module, filed_name) {
  317. return getDictionaryDataConfig(module, filed_name)
  318. },
  319. getGroup(id){
  320. var name = ""
  321. var statistics_category = getDictionaryDataConfig('system','statistics_category')
  322. console.log("2235",statistics_category)
  323. for(let i=0;i<statistics_category.length;i++){
  324. if(id == statistics_category[i].id){
  325. name = statistics_category[i].name
  326. }
  327. }
  328. return name
  329. },
  330. deleteProject(row,i){
  331. if(this.prescription.order_status == 2){
  332. this.$message.error('该处方已经结算,无法删除')
  333. return
  334. }
  335. this.$confirm("项目删除后不可恢复,是否确认删除", "删除", {
  336. confirmButtonText: "确 定",
  337. cancelButtonText: "取 消",
  338. type: "warning"
  339. }).then(() => {
  340. if(row.id == 0){
  341. this.prescription.project.splice(i, 1)
  342. }else{
  343. let params = {
  344. 'id': row.id,
  345. }
  346. delHisProject(params).then(response => {
  347. if (response.data.state == 0) {
  348. this.$message.error(response.data.msg)
  349. return false
  350. } else {
  351. for (let i = 0; i < this.prescription.project.length; i++){
  352. if(this.prescription.project[i].id == row.id){
  353. this.prescription.project.splice(i, 1)
  354. }
  355. }
  356. this.$message.success(response.data.data.msg)
  357. }
  358. })
  359. }
  360. })
  361. .catch(() => {});
  362. },
  363. getAllChange(scope){
  364. if(scope.row.drug.min_unit == scope.row.single_dose_unit){
  365. if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  366. console.log(1)
  367. 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)
  368. }else{
  369. console.log(12)
  370. 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)
  371. }
  372. }else{
  373. if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  374. console.log(123)
  375. 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)
  376. }else{
  377. console.log(1234)
  378. 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)
  379. }
  380. }
  381. if(scope.row.prescribing_number == 0){
  382. scope.row.prescribing_number = 1
  383. }
  384. if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  385. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  386. if(scope.row.prescribing_number > scope.row.drug.total){
  387. this.$message.error(scope.row.drug_name + '库存不足')
  388. }
  389. }else{
  390. if((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total){
  391. this.$message.error(scope.row.drug_name + '库存不足')
  392. }
  393. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  394. }
  395. },
  396. getPrescribingNumberUnit(scope){
  397. // console.log('scope',scope)
  398. // if(scope.row.drug.min_unit == scope.row.single_dose_unit){
  399. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  400. // scope.row.prescribing_number = scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day
  401. // }else{
  402. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency)) * scope.row.day / scope.row.drug.min_number)
  403. // }
  404. // }else{
  405. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  406. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose)
  407. // }else{
  408. // 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)
  409. // }
  410. // }
  411. // if(scope.row.prescribing_number == 0){
  412. // scope.row.prescribing_number = 1
  413. // }
  414. if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  415. scope.row.retail_price = scope.row.drug.min_price
  416. if(scope.row.prescribing_number > scope.row.drug.total){
  417. this.$message.error(scope.row.drug_name + '库存不足')
  418. }
  419. }else{
  420. if((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total){
  421. this.$message.error(scope.row.drug_name + '库存不足')
  422. }
  423. scope.row.retail_price = scope.row.drug.retail_price
  424. }
  425. },
  426. changePrescribingNumber(scope){
  427. if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  428. if(parseInt(scope.row.prescribing_number) > scope.row.drug.total){
  429. this.$message.error(scope.row.drug_name + '库存不足')
  430. }
  431. }else{
  432. if((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total){
  433. this.$message.error(scope.row.drug_name + '库存不足')
  434. }
  435. }
  436. },
  437. getProjectSingleDose(scope){
  438. 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)
  439. if(this.prescription.project[scope.$index].total == 0){
  440. this.prescription.project[scope.$index].total = 1
  441. }
  442. },
  443. getProjectDay(scope){
  444. this.prescription.project[scope.$index].total = scope.row.single_dose * scope.row.number_days
  445. if(this.prescription.project[scope.$index].total == 0){
  446. this.prescription.project[scope.$index].total = 1
  447. }
  448. },
  449. getNum(execution_frequency){
  450. let arr = [
  451. {name:'立即执行',count:1},
  452. {name:'透析时',count:1},
  453. {name:'透析1h一次',count:1},
  454. {name:'透析2h一次',count:1},
  455. {name:'透析3h一次',count:1},
  456. {name:'每日一次',count:1},
  457. {name:'每日两次',count:2},
  458. {name:'每日三次',count:3},
  459. {name:'每晚一次',count:1},
  460. {name:'每晚',count:1},
  461. {name:'上机前',count:1},
  462. {name:'下机前',count:1},
  463. {name:'透析后立即',count:1},
  464. {name:'持续使用',count:1},
  465. {name:'临时开药',count:1},
  466. {name:'临睡前',count:1},
  467. {name:'隔日一次',count:1},
  468. {name:'隔三日一次',count:1},
  469. {name:'每二小时一次',count:12},
  470. {name:'每四小时一次',count:6},
  471. {name:'每六小时一次',count:4},
  472. {name:'每八小时一次',count:3},
  473. ]
  474. let num = ''
  475. arr.map(item => {
  476. if(item.name == execution_frequency){
  477. num = item.count
  478. }
  479. })
  480. if(num == ''){
  481. num = 1
  482. }
  483. return num
  484. }
  485. },mounted(){
  486. this.getInitData()
  487. },
  488. watch:{
  489. "prescription.advices":{
  490. handler(newVal,oldVal){
  491. },
  492. deep:true
  493. },
  494. // "prescription.project":{
  495. // handler(newVal,oldVal){
  496. // newVal.map((item,index) => {
  497. // if(item.single_dose != oldVal[index].single_dose || item.number_days != oldVal[index].number_days){
  498. // item.total = item.single_dose * item.number_days
  499. // }
  500. // })
  501. // },
  502. // deep:true
  503. // }
  504. }
  505. }
  506. </script>
  507. <style lang="scss">
  508. .prescriptionTable {
  509. .el-input__inner{
  510. padding: 0 5px;
  511. }
  512. .additionalBox{
  513. margin-top: 20px;
  514. display: flex;
  515. flex-wrap: wrap;
  516. .additionalOne{
  517. margin-right:20px;
  518. margin-bottom:10px;
  519. display: flex;
  520. align-items: center;
  521. >span{
  522. white-space: nowrap;
  523. overflow: hidden;
  524. text-overflow: ellipsis;
  525. width:80px;
  526. display: inline-block;
  527. font-size: 14px;
  528. }
  529. }
  530. .deleteIcon{
  531. color:red;
  532. margin-left:5px;
  533. }
  534. }
  535. .el-table th .cell, .el-table td .cell {
  536. padding: 0 2px;
  537. white-space: pre-line;
  538. }
  539. .el-icon-delete {
  540. color: red;
  541. }
  542. }
  543. </style>