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

drugDetail.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div>
  3. <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
  4. <div>
  5. <el-input size="small" style="width:150px;" v-model="keywords"
  6. @keyup.enter.native='searchAction'
  7. placeholder="请输入药品名称"
  8. class="filter-item"/>
  9. <el-button size="small" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
  10. <el-date-picker
  11. v-model="chargeDate"
  12. type="daterange"
  13. value-format="yyyy-MM-dd"
  14. range-separator="至"
  15. start-placeholder="开始日期"
  16. @change="changeDate"
  17. end-placeholder="结束日期">
  18. </el-date-picker>
  19. </div>
  20. </div>
  21. <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
  22. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  23. max-height="600"
  24. highlight-current-row>
  25. <el-table-column align="center" prop="name" label="序号">
  26. <template slot-scope="scope">
  27. {{scope.$index + 1}}
  28. </template>
  29. </el-table-column>
  30. <el-table-column align="center" prop="name" label="日期">
  31. <template slot-scope="scope">
  32. {{getTime(scope.row.advice_date)}}
  33. </template>
  34. </el-table-column>
  35. <el-table-column align="center" prop="name" label="药品类型">
  36. <template slot-scope="scope">
  37. {{getDrugTypeName(scope.row.drug_id)}}
  38. </template>
  39. </el-table-column>
  40. <el-table-column align="center" prop="name" label="药品名称">
  41. <template slot-scope="scope">
  42. {{getDrugName(scope.row.drug_id)}}
  43. </template>
  44. </el-table-column>
  45. <el-table-column align="center" prop="name" label="规格">
  46. <template slot-scope="scope">
  47. {{getSpecialName(scope.row.drug_id)}}
  48. </template>
  49. </el-table-column>
  50. <el-table-column align="center" prop="name" label="数量">
  51. <template slot-scope="scope">
  52. {{getCount(scope.row.child,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column align="center" prop="total" label="操作">
  56. <template slot-scope="scope">
  57. <div style="color: #589ff8" @click="jump(scope.row.child,scope.row.min_number,scope.row.drug_id,scope.row.max_unit,scope.row.min_unit)">使用明细</div>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <el-dialog
  62. title="药品明细"
  63. :visible.sync="dialogVisible"
  64. width="60%">
  65. <div style="margin-bottom:10px"> <span>药品类型:{{getDrugTypeName(drug_id)}}</span>
  66. <span>药品名称:{{getDrugName(drug_id)}}</span>
  67. </div>
  68. <span>
  69. <el-table :data="tableList" border :row-style="{ color: '#303133' }" ref="table"
  70. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  71. max-height="600"
  72. highlight-current-row>
  73. <el-table-column align="center" prop="name" label="序号">
  74. <template slot-scope="scope">
  75. {{scope.$index + 1}}
  76. </template>
  77. </el-table-column>
  78. <el-table-column align="center" prop="name" label="使用日期">
  79. <template slot-scope="scope">
  80. {{getTime(scope.row.advice_date)}}
  81. </template>
  82. </el-table-column>
  83. <el-table-column align="center" prop="name" label="患者名字">
  84. <template slot-scope="scope">
  85. {{getPatientName(scope.row.patient_id)}}
  86. </template>
  87. </el-table-column>
  88. <el-table-column align="center" prop="name" label="数量">
  89. <template slot-scope="scope">
  90. <span v-if="scope.row.prescribing_number_unit == max_unit">{{scope.row.prescribing_number/min_number}}</span>
  91. <span v-if="scope.row.prescribing_number_unit == min_unit && max_unit!=min_unit">{{scope.row.prescribing_number}}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column align="center" prop="name" label="单位">
  95. <template slot-scope="scope">
  96. {{scope.row.prescribing_number_unit}}
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </span>
  101. <span slot="footer" class="dialog-footer">
  102. <el-button @click="dialogVisible = false">取 消</el-button>
  103. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  104. </span>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  110. import {getDrugDetailSummary} from "@/api/stock"
  111. import { uParseTime } from '@/utils/tools'
  112. import { min } from 'moment'
  113. const moment = require('moment')
  114. export default {
  115. components: {
  116. BreadCrumb
  117. },
  118. data() {
  119. return {
  120. detail_loading: false,
  121. tempArr: [],
  122. pos: 0,
  123. sameRowArr: [],
  124. keywords: '',
  125. tableData: [],
  126. chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
  127. limit:10,
  128. page:1,
  129. total:0,
  130. drugList:[],
  131. drugTypeList:[],
  132. dialogVisible:false,
  133. tableList:[],
  134. patients:[],
  135. min_number:0,
  136. drug_type:"",
  137. drug_id:0,
  138. max_unit:"",
  139. min_unit:"",
  140. }
  141. },
  142. methods:{
  143. changeDate(){
  144. this.tableData = []
  145. this.getlist()
  146. },
  147. getlist(){
  148. let start_time = this.chargeDate[0]
  149. let end_time = this.chargeDate[1]
  150. var params = {
  151. start_time: start_time,
  152. end_time: end_time,
  153. keyword: this.keywords,
  154. limit:this.limit,
  155. page:this.page,
  156. }
  157. getDrugDetailSummary(params).then(response=>{
  158. if(response.data.state == 1){
  159. var list = response.data.data.list
  160. var total = response.data.data.total
  161. var drug = response.data.data.drug
  162. this.patients = response.data.data.patients
  163. for(let i =0;i<list.length;i++){
  164. for(let j=0;j<drug.length;j++){
  165. if(list[i].drug_id == drug[j].id){
  166. if(list[i].child!=null && list[i].child.length > 0){
  167. for(let z=0;z<list[i].child.length;z++){
  168. if(list[i].child[z].prescribing_number_unit == drug[j].max_unit){
  169. list[i].child[z].prescribing_number = parseInt(list[i].child[z].prescribing_number) * drug[j].min_number
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. this.drugList = drug
  177. this.total = total
  178. this.drugTypeList = response.data.data.drugTypeList
  179. for(let i=0;i<list.length;i++){
  180. list[i].min_number = 0
  181. list[i].max_unit = ""
  182. list[i].min_unit = ""
  183. for(let j=0;j<drug.length;j++){
  184. if(list[i].drug_id == drug[j].id){
  185. list[i].min_number = drug[j].min_number
  186. list[i].max_unit = drug[j].max_unit
  187. list[i].min_unit = drug[j].min_unit
  188. this.tableData.push(list[i])
  189. }
  190. }
  191. }
  192. }
  193. })
  194. },
  195. getTime(val) {
  196. if(val < 0){
  197. return ""
  198. }
  199. if(val == ""){
  200. return ""
  201. }else {
  202. return uParseTime(val, '{y}-{m}-{d}')
  203. }
  204. },
  205. getDrugName(id){
  206. var drug_name = ""
  207. for(let i=0;i<this.drugList.length;i++){
  208. if(id == this.drugList[i].id){
  209. drug_name = this.drugList[i].drug_name
  210. }
  211. }
  212. return drug_name
  213. },
  214. getSpecialName(id){
  215. var specification_name = ""
  216. for(let i=0;i<this.drugList.length;i++){
  217. if(id == this.drugList[i].id){
  218. specification_name = this.drugList[i].dose + this.drugList[i].dose_unit +"*" + this.drugList[i].min_number +this.drugList[i].min_unit +"/" + this.drugList[i].max_unit;
  219. }
  220. }
  221. return specification_name
  222. },
  223. searchAction(){
  224. this.tableData = []
  225. this.getlist()
  226. },
  227. getDrugTypeName(drug_id){
  228. var drug_type = ""
  229. for(let i=0;i<this.drugList.length;i++){
  230. if(drug_id == this.drugList[i].id){
  231. drug_type = this.drugList[i].drug_type
  232. }
  233. }
  234. var type_name = ""
  235. for(let i=0;i<this.drugTypeList.length;i++ ){
  236. if(drug_type == this.drugTypeList[i].value){
  237. type_name = this.drugTypeList[i].name
  238. }
  239. }
  240. return type_name
  241. },
  242. getCount(val,min_number,max_unit,min_unit){
  243. var total = 0
  244. var min_str = ""
  245. var max_str = ""
  246. if(val!=null && val!=undefined && val.length > 0){
  247. for(let i=0;i<val.length;i++){
  248. total += parseInt(val[i].prescribing_number)
  249. }
  250. }
  251. if (total < min_number){
  252. min_str = total + min_unit
  253. }
  254. if (total == 0) {
  255. min_str = ""
  256. max_str = ""
  257. }
  258. if (total >=min_number) {
  259. if(parseInt(total/min_number)!=0){
  260. max_str = parseInt(total/min_number) + max_unit
  261. }
  262. if(total%min_number!=0){
  263. min_str = total%min_number + min_unit
  264. }
  265. }
  266. return max_str + min_str
  267. },
  268. jump(val,min_number,drug_id,max_unit,min_unit){
  269. console.log("max_unit23232233",max_unit)
  270. console.log("min_unit23232233",min_unit)
  271. this.dialogVisible = true
  272. this.tableList= val
  273. this.min_number = min_number
  274. this.max_unit = max_unit
  275. this.min_unit = min_unit
  276. this.drug_id = drug_id
  277. },
  278. getPatientName(id){
  279. var name = ""
  280. for(let i=0;i<this.patients.length;i++){
  281. if(id == this.patients[i].id){
  282. name = this.patients[i].name
  283. }
  284. }
  285. return name
  286. }
  287. },
  288. created() {
  289. this.getlist()
  290. }
  291. }
  292. </script>