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

deskPrescription.vue 36KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <div style="height: calc(100% - 36px);display: flex;flex-direction: column;margin-top: 36px;">
  3. <!-- <div style="border-top:1px solid #e5e5e5;margin-top:5px;">
  4. <div class="mainCell" style="margin-bottom:10px;float:right">
  5. <el-button size="small" @click="open(1)" type="primary" style="margin-left:10px;">保存</el-button>
  6. <el-button size="small" @click="open(2)" type="primary">打印</el-button>
  7. <el-button size="small" @click="open(4)" type="primary">选择模板</el-button>
  8. <el-button size="small" @click="open(5)" type="primary">存模板</el-button>
  9. </div>
  10. </div> -->
  11. <div class="backColor"></div>
  12. <div class="mainCenter">
  13. <div class="centerLeft">
  14. <el-form :model="form" ref="form" label-width="80px">
  15. <el-form-item label="姓名:" prop="name">
  16. <el-input v-model="patientInfo.name" placeholder="" readonly></el-input>
  17. </el-form-item>
  18. <el-form-item label="证件号: " prop="name">
  19. <el-input v-model="patientInfo.id_card_no" placeholder="" readonly></el-input>
  20. </el-form-item>
  21. <!--<el-form-item label="挂号类型: " prop="name">-->
  22. <!--<el-input v-model="hisPatientInfo.register_type" placeholder="" readonly></el-input>-->
  23. <!--</el-form-item>-->
  24. <el-form-item label="挂号类型: " prop="name">
  25. <el-select style="margin-right:5px;" v-model="register_type" placeholder="">
  26. <el-option
  27. v-for="(item,index) in getDictionaryDataConfig('system','register_type')"
  28. :key="index"
  29. :label="item.name"
  30. :value="item.name">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="诊断:" prop="name">
  35. <el-autocomplete
  36. style="width:100%;"
  37. class="inline-input"
  38. v-model="state1"
  39. :fetch-suggestions="querySearch"
  40. placeholder="请输入内容"
  41. ></el-autocomplete>
  42. </el-form-item>
  43. <el-form-item label="过敏史及特殊病史: " prop="name">
  44. <el-autocomplete
  45. style="width:100%;"
  46. class="inline-input"
  47. v-model="state2"
  48. :fetch-suggestions="querySearch2"
  49. placeholder="请输入内容"
  50. ></el-autocomplete>
  51. </el-form-item>
  52. </el-form>
  53. <div class="tabsBox">
  54. <!--<el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>-->
  55. <el-tabs class="preTabs" v-model="editableTabsValue" type="card" closable @tab-remove="removeTab"
  56. :before-leave="moreState" @tab-click="tabclickEvent">
  57. <el-tab-pane
  58. v-for="(item, index) in prescriptions"
  59. :key="index"
  60. :label="item.name"
  61. :name="item.name"
  62. >
  63. </el-tab-pane>
  64. <el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span>
  65. </el-tab-pane>
  66. <div class="RP">Rp</div>
  67. <prescription-table ref="prescription_tables" :prescription="curPrescriptions" :preDrugs="preDrugs"
  68. :activeType="customTabIndex"></prescription-table>
  69. </el-tabs>
  70. </div>
  71. <div class="costBox">
  72. <span>医生:</span>
  73. <el-select style="margin-right:5px;" v-model="doctorValue" placeholder="">
  74. <el-option
  75. v-for="(item,index) in doctors"
  76. :key="index"
  77. :label="item.user_name"
  78. :value="item.user_name">
  79. </el-option>
  80. </el-select>
  81. <span>科室:</span>
  82. <el-select style="margin-right:5px;" v-model="departmentValue" placeholder="">
  83. <el-option
  84. v-for="(item,index) in getDictionaryDataConfig('system','department')"
  85. :key="index"
  86. :label="item.name"
  87. :value="item.name">
  88. </el-option>
  89. </el-select>
  90. <span>总计:</span>
  91. <span style="color:red;">{{ getTotal() }}</span>元
  92. </div>
  93. </div>
  94. <div class='centerRight'>
  95. <div class="rightTab">
  96. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  97. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  98. </div>
  99. <template>
  100. <div style="height:84%;overflow-y: auto;margin-bottom: 60px;" v-show="showOne">
  101. <el-tabs class="rightTabs" v-model="activeName">
  102. <el-tab-pane label="药品列表" name="1">
  103. <div style="margin-bottom:5px;">
  104. <el-input style="width:50%;" v-model="input" placeholder=""></el-input>
  105. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  106. <el-option
  107. label="全部"
  108. value="0">
  109. </el-option>
  110. <el-option
  111. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  112. :key="index"
  113. :label="item.name"
  114. :value="item.id">
  115. </el-option>
  116. </el-select>
  117. </div>
  118. <el-table ref="multipleTable" :data="drugs" border @select='selectDrugs' style="width: 100%;"
  119. :row-style="{ color: '#303133' }"
  120. @select-all="changeAllGoodInfoTableData"
  121. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  122. highlight-current-row>
  123. <el-table-column align="center" type="selection" width="40"></el-table-column>
  124. <el-table-column align="center" prop="name" label="名称">
  125. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  126. </el-table-column>
  127. <el-table-column align="center" label="规格" width="60">
  128. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  129. </el-table-column>
  130. <el-table-column align="center" label="单价" width="40">
  131. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  132. </el-table-column>
  133. </el-table>
  134. </el-tab-pane>
  135. <el-tab-pane label="医嘱模板" name="2">
  136. <div style="margin-bottom:5px;">
  137. <el-input style="width:50%;" v-model="input" placeholder=""></el-input>
  138. <el-select style="float: right;width: 49%;" v-model="value" placeholder="">
  139. <el-option
  140. v-for="item in options"
  141. :key="item.value"
  142. :label="item.label"
  143. :value="item.value">
  144. </el-option>
  145. </el-select>
  146. </div>
  147. <el-table ref="multipleTableTwo" :data="advices_template" border style="width: 100%;"
  148. :row-style="{ color: '#303133' }"
  149. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  150. highlight-current-row>
  151. <el-table-column align="center" type="selection" width="40"></el-table-column>
  152. <el-table-column align="center" prop="name" label="名称">
  153. <template slot-scope="scope">{{}}</template>
  154. </el-table-column>
  155. <el-table-column align="center" label="规格" width="60">
  156. <template slot-scope="scope">33</template>
  157. </el-table-column>
  158. <el-table-column align="center" label="库存" width="60">
  159. <template slot-scope="scope">22</template>
  160. </el-table-column>
  161. <el-table-column align="center" label="单价" width="40">
  162. <template slot-scope="scope">12</template>
  163. </el-table-column>
  164. </el-table>
  165. </el-tab-pane>
  166. </el-tabs>
  167. </div>
  168. <div style="height:84%;overflow-y: auto;margin-bottom: 60px;" v-show="showTwo">
  169. <el-tabs class="rightTabs" v-model="activeName">
  170. <el-tab-pane label="项目列表" name="1">
  171. <el-table ref="tables" :data="tabProject" border @select='selectChange' style="width: 100%;"
  172. :row-style="{ color: '#303133' }"
  173. @select-all="changeAllGoodInfoTableDataTwo"
  174. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  175. highlight-current-row>
  176. <el-table-column align="center" type="selection" width="40"></el-table-column>
  177. <el-table-column align="center" prop="name" label="名称">
  178. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  179. </el-table-column>
  180. <el-table-column align="center" label="规格" width="60">
  181. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  182. </el-table-column>
  183. <el-table-column align="center" label="单价" width="40">
  184. <template slot-scope="scope">{{ scope.row.price }}</template>
  185. </el-table-column>
  186. </el-table>
  187. </el-tab-pane>
  188. <el-tab-pane label="项目组套" name="2">
  189. <el-table :data="tabPrjectTeam" border style="width: 100%;" :row-style="{ color: '#303133' }"
  190. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  191. highlight-current-row
  192. @select='selectTeam'>
  193. <el-table-column align="center" type="selection" width="40"></el-table-column>
  194. <el-table-column align="center" prop="name" label="名称">
  195. <template slot-scope="scope">{{scope.row.project_team}}</template>
  196. </el-table-column>
  197. </el-table>
  198. </el-tab-pane>
  199. </el-tabs>
  200. </div>
  201. <div class="comfirmBox">
  202. <!-- <div>
  203. <span>药品类型:</span>
  204. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  205. <el-option
  206. label="全部"
  207. value="0">
  208. </el-option>
  209. <el-option
  210. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  211. :key="index"
  212. :label="item.name"
  213. :value="item.id">
  214. </el-option>
  215. </el-select>
  216. </div> -->
  217. <el-button type="primary" size="small" @click="comfirm">确定添加</el-button>
  218. </div>
  219. </template>
  220. </div>
  221. </div>
  222. <additionalCharges ref='additionalCharges' :hisPatientInfo="hisPatientInfo" :patientInfo="patientInfo"></additionalCharges>
  223. <select-template ref='selectTemplate'></select-template>
  224. <save-template ref='saveTemplate'></save-template>
  225. </div>
  226. </template>
  227. <script>
  228. import {
  229. createHisPrescription,
  230. delHisPrescription,
  231. getInitData,
  232. getPatientInfo,
  233. getSchedulePatientList,
  234. } from '@/api/his/his'
  235. import { getDictionaryDataConfig } from '@/utils/data'
  236. import prescriptionTable from './prescriptionTable'
  237. import selectTemplate from './selectTemplate'
  238. import saveTemplate from './saveTemplate'
  239. import additionalCharges from './additionalCharges'
  240. import { addProjectTeam, getAllProjectTeam, getHisProject, getPojectListById } from '@/api/project/project'
  241. export default {
  242. props: {
  243. patientInfo: Object,
  244. hisPatientInfo: Object,
  245. prescriptions: Array,
  246. record_date: String,
  247. other_sick: {
  248. type: Array,
  249. default: []
  250. },
  251. diagnoses: {
  252. type: Array,
  253. default: []
  254. }
  255. },
  256. components: {
  257. selectTemplate,
  258. saveTemplate,
  259. prescriptionTable,
  260. additionalCharges
  261. },
  262. data() {
  263. return {
  264. register_type:"",
  265. value: '',
  266. form: {
  267. name: ''
  268. },
  269. drugs: [],
  270. allDrugs: [],
  271. advices_template: [],
  272. editableTabsValue: '处方1',
  273. editableTabs: [{
  274. title: '处方1',
  275. name: '1'
  276. }],
  277. tabIndex: 1,
  278. currenet_inedx: 0,
  279. rightTab: 1,
  280. activeName: '1',
  281. curPrescriptions: this.prescriptions[0],
  282. drugTableData: [],
  283. preDrugs: [],
  284. curDrugs: [],
  285. doctorOptions: [],
  286. doctorValue: '',
  287. departmentOptions: [],
  288. departmentValue: '',
  289. total: 0,
  290. state1: '',
  291. state2: '',
  292. customTabIndex: 1,
  293. options: [],
  294. tabProject: [],
  295. strids: '',
  296. showOne: true,
  297. showTwo: false,
  298. tableData: [],
  299. tabPrjectTeam: [],
  300. teamList: [],
  301. doctors: [],
  302. departMent: [],
  303. curStatus: 0
  304. }
  305. },
  306. methods: {
  307. getTotal() {
  308. var total = 0
  309. for (let i = 0; i < this.prescriptions.length; i++) {
  310. if (this.prescriptions[i].advices != null) {
  311. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  312. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  313. }
  314. }
  315. if (this.prescriptions[i].project != null) {
  316. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  317. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  318. }
  319. }
  320. }
  321. return Math.floor(total * 100) / 100
  322. },
  323. createFilter(queryString) {
  324. return (restaurant) => {
  325. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  326. }
  327. },
  328. querySearch(queryString, cb) {
  329. var restaurants = this.diagnoses
  330. console.log(restaurants)
  331. restaurants.map(item => {
  332. item.value = item.name
  333. })
  334. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  335. // 调用 callback 返回建议列表的数据
  336. cb(results)
  337. },
  338. querySearch2(queryString, cb) {
  339. var restaurants = this.other_sick
  340. restaurants.map(item => {
  341. item.value = item.name
  342. })
  343. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  344. // 调用 callback 返回建议列表的数据
  345. cb(results)
  346. },
  347. changeKind(val) {
  348. this.drugs = []
  349. if(val == 0){
  350. this.drugs = this.allDrugs
  351. }else{
  352. for (let i = 0; i < this.allDrugs.length; i++){
  353. if (this.allDrugs[i].drug_type == val){
  354. this.drugs.push(this.allDrugs[i])
  355. }
  356. }
  357. }
  358. },
  359. getDictionaryDataConfig(module, filed_name) {
  360. return getDictionaryDataConfig(module, filed_name)
  361. },
  362. getInitData() {
  363. getInitData().then(response => {
  364. if (response.data.state == 0) {
  365. this.$message.error(response.data.msg)
  366. return false
  367. } else {
  368. this.drugs = response.data.data.drugs
  369. this.allDrugs = response.data.data.drugs
  370. this.advices_template = response.data.data.advices_template
  371. this.doctors = response.data.data.doctors
  372. }
  373. })
  374. },
  375. tabclickEvent(val) {
  376. for (let i = 0; i < this.prescriptions.length; i++) {
  377. console.log(this.prescriptions[i].name)
  378. if (this.prescriptions[i].name == val.name) {
  379. this.curPrescriptions = this.prescriptions[i]
  380. this.teamList = []
  381. this.curDrugs = []
  382. this.$refs.multipleTable.clearSelection()
  383. this.$refs.tables.clearSelection()
  384. //用来区分处方属于项目还是药品
  385. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  386. this.customTabIndex = 1
  387. this.curStatus = 1
  388. this.rightTab = 1
  389. this.showOne = true
  390. this.showTwo = false
  391. }
  392. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  393. this.customTabIndex = 2
  394. this.curStatus = 2
  395. this.rightTab = 2
  396. this.showTwo = true
  397. this.showOne = false
  398. }
  399. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  400. this.customTabIndex = this.rightTab
  401. this.curStatus = 0
  402. }
  403. }
  404. }
  405. },
  406. clearData() {
  407. console.log("111111")
  408. this.curPrescriptions = []
  409. this.curStatus = 0
  410. this.curDrugs = []
  411. this.preDrugs = []
  412. this.teamList = []
  413. },
  414. setData(data,info) {
  415. this.curStatus = 0
  416. this.prescriptions = data
  417. this.curPrescriptions = this.prescriptions[0]
  418. if(this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0 ){
  419. this.curStatus = 1
  420. this.customTabIndex= 1
  421. this.rightTab = 1
  422. this.showOne = true
  423. this.showTwo = false
  424. }
  425. if(this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0 ){
  426. this.curStatus = 2
  427. this.customTabIndex= 2
  428. this.rightTab = 2
  429. this.showOne = false
  430. this.showTwo = true
  431. }
  432. this.state1 = info.diagnosis
  433. this.state2 = info.sick_history
  434. this.doctorValue = info.doctor
  435. this.departmentValue = info.departments
  436. // console.log(this.$refs)
  437. // this.$nextTick(() => {
  438. // this.$refs.prescription_tables.setNewData(this.prescriptions[0])
  439. // })
  440. },
  441. moreState(tab, event) {
  442. if (tab == 'more') {
  443. return false
  444. }
  445. },
  446. open(index) {
  447. if(this.doctorValue.length <= 0){
  448. this.$message.error("医生不能为空")
  449. return
  450. }
  451. if(this.departmentValue.length <= 0){
  452. this.$message.error("科室不能为空")
  453. return
  454. }
  455. if (index == 1) {
  456. let params = {
  457. patient_id: this.patientInfo.id,
  458. diagnose: this.state1,
  459. sick_history: this.state2,
  460. doctor: this.doctorValue,
  461. department: this.departmentValue,
  462. record_date: this.record_date,
  463. his_patient_id: this.hisPatientInfo.id
  464. }
  465. for (let i = 0; i < this.prescriptions.length; i++) {
  466. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  467. this.prescriptions[i]['type'] = 1
  468. }
  469. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  470. this.prescriptions[i]['type'] = 2
  471. }
  472. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  473. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  474. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  475. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  476. }
  477. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  478. this.prescriptions[i].project[b].price = parseFloat(this.prescriptions[i].project[b].price)
  479. }
  480. }
  481. let data = {
  482. 'prescriptions': this.prescriptions
  483. }
  484. createHisPrescription(data, params).then(response => {
  485. if (response.data.state == 1) {
  486. // this.prescriptions = []
  487. this.$message.success('保存成功')
  488. }
  489. })
  490. } else if (index == 2) {
  491. this.$router.push('/outpatientDoctorStation/print')
  492. } else if (index == 4) {
  493. this.$refs.selectTemplate.show()
  494. } else if (index == 5) {
  495. this.$refs.saveTemplate.show()
  496. }
  497. },
  498. addTab(targetName) {
  499. ++this.tabIndex
  500. let newTabName = '处方' + this.tabIndex
  501. this.prescriptions.push({
  502. id: 0,
  503. name: newTabName,
  504. advices: [],
  505. project: []
  506. })
  507. this.editableTabsValue = newTabName
  508. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  509. this.curStatus = 0
  510. },
  511. removeTab(targetName) {
  512. this.$confirm("处方删除后不可恢复,是否确认删除", "删除", {
  513. confirmButtonText: "确 定",
  514. cancelButtonText: "取 消",
  515. type: "warning"
  516. }).then(() => {
  517. let id = 0
  518. for (let i = 0; i < this.prescriptions.length; i++) {
  519. if (this.prescriptions[i].name == targetName) {
  520. id = this.prescriptions[i].id
  521. }
  522. }
  523. if (id == 0) {
  524. let tabs = this.prescriptions
  525. let activeName = this.editableTabsValue
  526. if (activeName === targetName) {
  527. tabs.forEach((tab, index) => {
  528. if (tab.name === targetName) {
  529. let nextTab = tabs[index + 1] || tabs[index - 1]
  530. if (nextTab) {
  531. activeName = nextTab.name
  532. }
  533. }
  534. })
  535. }
  536. this.editableTabsValue = activeName
  537. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  538. for (let i = 0; i < this.prescriptions.length; i++) {
  539. if (activeName == this.prescriptions[i].name) {
  540. this.curPrescriptions = this.prescriptions[i]
  541. if(this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0){
  542. this.curStatus = 1
  543. }
  544. if(this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0){
  545. this.curStatus = 2
  546. }
  547. }
  548. }
  549. if (this.prescriptions.length == 0) {
  550. this.curPrescriptions = []
  551. this.curStatus = 0
  552. }
  553. }
  554. else {
  555. let params = {
  556. 'id': id
  557. }
  558. delHisPrescription(params).then(response => {
  559. if (response.data.state == 1) {
  560. this.$message.success('删除成功')
  561. let tabs = this.prescriptions
  562. let activeName = this.editableTabsValue
  563. if (activeName === targetName) {
  564. tabs.forEach((tab, index) => {
  565. if (tab.name === targetName) {
  566. let nextTab = tabs[index + 1] || tabs[index - 1]
  567. if (nextTab) {
  568. activeName = nextTab.name
  569. }
  570. }
  571. })
  572. }
  573. this.editableTabsValue = activeName
  574. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  575. for (let i = 0; i < this.prescriptions.length; i++) {
  576. if (activeName == this.prescriptions[i].name) {
  577. this.curPrescriptions = this.prescriptions[i]
  578. if(this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0){
  579. this.curStatus = 1
  580. }
  581. if(this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0){
  582. this.curStatus = 2
  583. }
  584. }
  585. }
  586. if (this.prescriptions.length == 0) {
  587. this.curPrescriptions = []
  588. this.curStatus = 0
  589. }
  590. } else {
  591. this.$message.success(response.data.msg)
  592. }
  593. })
  594. }
  595. })
  596. .catch(() => {});
  597. },
  598. clickTab(index) {
  599. if (index == 1){
  600. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  601. this.$message.error("当前处方为项目,无法切换为药品,需要新开处方")
  602. return
  603. }
  604. }else{
  605. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  606. this.$message.error("当前处方为药品,无法切换为项目,需要新开处方")
  607. return
  608. }
  609. }
  610. if (index == 1) {
  611. this.teamList = []
  612. this.$refs.tables.clearSelection()
  613. this.showOne = true
  614. this.showTwo = false
  615. this.$nextTick(() => {
  616. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  617. })
  618. this.customTabIndex = 1
  619. }
  620. if (index == 2) {
  621. this.curDrugs = []
  622. this.$refs.multipleTable.clearSelection()
  623. this.showTwo = true
  624. this.showOne = false
  625. this.$nextTick(() => {
  626. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  627. })
  628. this.customTabIndex = 2
  629. }
  630. this.rightTab = index
  631. //用来区分处方属于项目还是药品
  632. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  633. this.customTabIndex = 1
  634. this.curStatus =1
  635. }
  636. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  637. this.customTabIndex = 2
  638. this.curStatus =2
  639. }
  640. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  641. // this.customTabIndex = this.rightTab
  642. this.customTabIndex = index
  643. this.curStatus =0
  644. }
  645. }, changeAllGoodInfoTableData: function(selection) {
  646. this.curDrugs = selection
  647. }, addCharges() {
  648. this.$refs.additionalCharges.show()
  649. },
  650. selectDrugs(selection, row) {
  651. this.curDrugs = selection
  652. },
  653. comfirm() {
  654. if (this.curStatus == 1 && this.rightTab == 2) {
  655. this.$message.error('改处方是药品,无法添加项目')
  656. this.teamList = []
  657. this.$refs.tables.clearSelection()
  658. return
  659. }
  660. if (this.curStatus ==2 && this.rightTab == 1) {
  661. this.$message.error('改处方是项目,无法添加药品')
  662. this.curDrugs = []
  663. this.$refs.multipleTable.clearSelection()
  664. return
  665. }
  666. for (let i = 0; i < this.teamList.length; i++){
  667. for (let a = 0; a < this.curPrescriptions.project.length; a++){
  668. if(this.teamList[i].id == this.curPrescriptions.project[a].project_id){
  669. this.$message.error('改处方存在相同的项目,无法添加相同的项目')
  670. return
  671. }
  672. }
  673. }
  674. console.log(this.curDrugs)
  675. console.log(this.curPrescriptions.advices)
  676. for (let i = 0; i < this.curDrugs.length; i++){
  677. for (let a = 0; a < this.curPrescriptions.advices.length; a++){
  678. if(this.curDrugs[i].id == this.curPrescriptions.advices[i].id){
  679. this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  680. return
  681. }
  682. }
  683. }
  684. for (let i = 0; i < this.prescriptions.length; i++) {
  685. if (this.prescriptions[i].name == this.editableTabsValue) {
  686. var temp = this.deepClone(this.curDrugs)
  687. var temp2 = this.deepClone(this.teamList)
  688. console.log(temp2)
  689. if (temp.length > 0) {
  690. for (let b = 0; b < temp.length; b++) {
  691. let obj = {
  692. advice_id: 0,
  693. id: temp[b].id,
  694. drug_name: temp[b].drug_name,
  695. single_dose: temp[b].single_dose,
  696. delivery_way: temp[b].delivery_way,
  697. execution_frequency: temp[b].execution_frequency,
  698. retail_price: temp[b].retail_price.toString(),
  699. remark: '',
  700. prescribing_number: temp[b].prescribing_number,
  701. single_dose_unit: temp[b].min_unit,
  702. prescribing_number_unit: temp[b].min_unit,
  703. min_unit: temp[b].min_unit,
  704. medical_insurance_number:temp[b].medical_insurance_number,
  705. }
  706. this.prescriptions[i].advices.push(obj)
  707. }
  708. this.curStatus = 1
  709. }
  710. if (temp2.length > 0) {
  711. for (let b = 0; b < temp2.length; b++) {
  712. let obj = {
  713. id: 0,
  714. project_id: temp2[b].id,
  715. project_name: temp2[b].project_name,
  716. statistical_classification: temp2[b].statistical_classification,
  717. single_dose: temp2[b].single_dose,
  718. delivery_way: temp2[b].delivery_way,
  719. execution_frequency: temp2[b].execution_frequency,
  720. number_days: temp2[b].number_days,
  721. total:temp2[b].total,
  722. price:temp2[b].price,
  723. remark:"",
  724. medical_code:temp2[b].medical_code,
  725. }
  726. console.log(obj)
  727. this.prescriptions[i].project.push(obj)
  728. }
  729. this.curStatus = 2
  730. }
  731. this.curPrescriptions = this.prescriptions[i]
  732. this.$refs.multipleTable.clearSelection()
  733. this.$refs.tables.clearSelection()
  734. }
  735. }
  736. this.curDrugs = []
  737. this.preDrugs = []
  738. this.teamList = []
  739. }, changeAllGoodInfoTableDataTwo(row) {
  740. this.teamList = row
  741. },
  742. selectChange(row) {
  743. this.teamList = row
  744. },
  745. getlist() {
  746. getHisProject().then(response => {
  747. if (response.data.state == 1) {
  748. var project = response.data.data.project
  749. console.log('project', project)
  750. this.tabProject = project
  751. }
  752. })
  753. }, deepClone(source) {
  754. if (!source && typeof source !== 'object') {
  755. throw new Error('error arguments', 'shallowClone')
  756. }
  757. const targetObj = source.constructor === Array ? [] : {}
  758. Object.keys(source).forEach((keys) => {
  759. if (source[keys] && typeof source[keys] === 'object') {
  760. targetObj[keys] = this.deepClone(source[keys])
  761. } else {
  762. targetObj[keys] = source[keys]
  763. }
  764. })
  765. return targetObj
  766. },
  767. getAllProjectTeam() {
  768. getAllProjectTeam().then(response => {
  769. if (response.data.state == 1) {
  770. var team = response.data.data.team
  771. console.log('team', team)
  772. this.tabPrjectTeam = team
  773. }
  774. })
  775. },
  776. selectTeam(row) {
  777. var arr = []
  778. for (let i = 0; i < row.length; i++) {
  779. arr.push(row[i].project_id)
  780. }
  781. var ids = arr.join(',')
  782. var strArr = ids.split(',')
  783. var res = []//接收不重复的数据
  784. for (var i = 0; i < strArr.length; i++) {
  785. var flag = true
  786. for (var j = 0; j < i; j++) {
  787. if (strArr[i] === strArr[j]) {
  788. flag = false
  789. break
  790. }
  791. }
  792. if (flag) {
  793. res.push(strArr[i])
  794. }
  795. }
  796. var idstr = res.join(',')
  797. const params = {
  798. project_id: idstr
  799. }
  800. getPojectListById(params).then(response => {
  801. if (response.data.state == 1) {
  802. var project = response.data.data.project
  803. console.log('project222', project)
  804. this.teamList = []
  805. this.teamList = project
  806. }
  807. })
  808. }
  809. },
  810. created() {
  811. this.getInitData()
  812. //获取所有项目
  813. this.getlist()
  814. //获取所以项目组套
  815. this.getAllProjectTeam()
  816. }
  817. }
  818. </script>
  819. <style lang="scss" scoped>
  820. .new-main-contain {
  821. height: 100%;
  822. display: flex;
  823. flex-direction: column;
  824. }
  825. .app-container {
  826. height: 100%;
  827. }
  828. .mainCell {
  829. height: 36px;
  830. display: flex;
  831. align-items: center;
  832. }
  833. .mainLeft {
  834. width: 200px;
  835. height: 100%;
  836. display: flex;
  837. flex-direction: column;
  838. .el-radio {
  839. margin-right: 5px;
  840. }
  841. }
  842. .mainRight {
  843. margin-left: 20px;
  844. flex: 1;
  845. height: 100%;
  846. display: flex;
  847. flex-direction: column;
  848. .cellSpan {
  849. min-width: 80px;
  850. display: inline-block;
  851. margin-right: 10px;
  852. }
  853. }
  854. .mainCenter {
  855. display: flex;
  856. flex: 1;
  857. }
  858. .centerLeft {
  859. flex: 1;
  860. display: flex;
  861. flex-direction: column;
  862. position: relative;
  863. .el-form-item {
  864. width: 32%;
  865. margin-right: 1%;
  866. float: left;
  867. }
  868. .el-form-item__label {
  869. text-align: left;
  870. }
  871. }
  872. .backColor {
  873. background: #f6f8f9;
  874. height: 5px;
  875. margin-bottom: 5px;
  876. }
  877. .RP {
  878. color: #409EFF;
  879. font-size: 20px;
  880. margin-bottom: 5px;
  881. }
  882. .tabsBox {
  883. position: relative;
  884. height: 76%;
  885. overflow-y: auto;
  886. margin-bottom: 60px;
  887. .el-tabs__item {
  888. padding: 0 10px;
  889. }
  890. }
  891. .preTabs {
  892. height: 100%;
  893. }
  894. .costBox {
  895. width: 100%;
  896. height: 60px;
  897. background: #fff;
  898. position: absolute;
  899. bottom: 0;
  900. display: flex;
  901. align-items: center;
  902. }
  903. .addTab {
  904. position: absolute;
  905. right: 0;
  906. top: 6px;
  907. z-index: 20;
  908. }
  909. .centerRight {
  910. width: 300px;
  911. margin-left: 5px;
  912. display: flex;
  913. flex-direction: column;
  914. position: relative;
  915. }
  916. .rightTab {
  917. height: 40px;
  918. width: 100%;
  919. border: 1px solid #d2d2d2;
  920. box-sizing: border-box;
  921. p {
  922. width: 50%;
  923. height: 40px;
  924. line-height: 40px;
  925. text-align: center;
  926. background: #eee;
  927. float: left;
  928. }
  929. > p:last-child {
  930. border-left: 1px solid #d2d2d2;
  931. float: right;
  932. }
  933. .activeP {
  934. background: #409EFF;
  935. color: #fff;
  936. }
  937. }
  938. .comfirmBox {
  939. width: 100%;
  940. height: 60px;
  941. background: #fff;
  942. position: absolute;
  943. bottom: 0;
  944. display: flex;
  945. align-items: center;
  946. justify-content: space-between;
  947. }
  948. </style>
  949. <style lang="scss">
  950. .centerLeft {
  951. .el-form-item__label {
  952. text-align: left;
  953. }
  954. }
  955. .tabsBox {
  956. .el-tabs__item {
  957. padding: 0 10px;
  958. }
  959. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2) {
  960. padding: 0 10px;
  961. }
  962. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:last-child {
  963. padding: 0 10px;
  964. }
  965. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  966. padding: 0 10px;
  967. }
  968. }
  969. .centerRight {
  970. .el-tabs__nav-scroll {
  971. display: flex;
  972. }
  973. .el-tabs__nav {
  974. margin: 0 auto;
  975. }
  976. .el-table th .cell, .el-table td .cell {
  977. padding: 0 2px;
  978. }
  979. }
  980. .preTabs {
  981. .el-tabs__content {
  982. }
  983. }
  984. .rightTabs {
  985. height: 100%;
  986. .el-tabs__content {
  987. }
  988. }
  989. #tab-more {
  990. .el-icon-close {
  991. display: none;
  992. }
  993. }
  994. </style>