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

prescriptionTemplatedetail.vue 71KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013
  1. <template>
  2. <div class="main-contain new-main-contain">
  3. <div style="height: calc(100% - 0px);display: flex;flex-direction: column;">
  4. <div style="display:flex;justify-content: space-between;align-items:center;margin:10px 0;padding:0 10px;color:#606266;">
  5. <div style="font-size:14px;">姓名:{{ $route.query.patient_name }}</div>
  6. <el-button size="small" @click="save" type="primary">保存</el-button>
  7. </div>
  8. <div class="mainCenter" style="padding:0 10px;" v-loading="loading">
  9. <div class="centerLeft">
  10. <el-form :model="tempForm" ref="tempForm" label-width="80px"
  11. style="display: flex;flex-wrap: wrap;justify-content: space-between;">
  12. <el-form-item label="模版名称:" prop="name" label-position="right">
  13. <el-input v-model="tempForm.name" placeholder=""></el-input>
  14. </el-form-item>
  15. <el-form-item label="透析模式: " prop="mode_id" label-position="right">
  16. <el-select v-model="tempForm.mode_id" style="width:100%;" placeholder="请选择">
  17. <el-option
  18. v-for="item in modeOptions"
  19. :key="item.id"
  20. :label="item.name"
  21. :value="item.id"
  22. ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-form>
  26. <div class="tabsBox">
  27. <el-tabs class="preTabs" v-model="editableTabsValue" type="border-card"
  28. closable
  29. @tab-remove="removeTab"
  30. :before-leave="moreState" @tab-click="tabclickEvent">
  31. <el-tab-pane
  32. v-for="(item, index) in prescriptions"
  33. :key="index"
  34. :label="item.name"
  35. :name="item.name"
  36. >
  37. </el-tab-pane>
  38. <el-tab-pane name="more" closable><span slot="label"><i
  39. class="el-icon-plus"
  40. @click="addTab"></i></span>
  41. </el-tab-pane>
  42. <!--<prescription-table ref="prescription_tables"-->
  43. <!--:prescription="curPrescriptions"-->
  44. <!--:preDrugs="preDrugs"-->
  45. <!--:activeType="customTabIndex"></prescription-table>-->
  46. <prescription-template-table ref="prescription_tables"
  47. :prescription="curPrescriptions"
  48. :preDrugs="preDrugs"
  49. :activeType="customTabIndex"></prescription-template-table>
  50. </el-tabs>
  51. </div>
  52. </div>
  53. <div class='centerRight'>
  54. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  55. :before-leave='beforeLeave'>
  56. <el-tab-pane label="药品" :name="1">
  57. </el-tab-pane>
  58. <el-tab-pane label="项目" :name="2">
  59. </el-tab-pane>
  60. <div style="height:100%;" v-show="showOne">
  61. <el-tabs class="rightTabs" v-model="drug_activeName">
  62. <el-tab-pane label="药品列表" name="1">
  63. <div style="margin-bottom:5px;display:flex;">
  64. <el-input style="width:50%;" @input="searchAction"
  65. @keyup.enter.native='searchAction'
  66. v-model.trim="search_keyword"
  67. placeholder="请输入药品名字"></el-input>
  68. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder=""
  69. @change="changeKind">
  70. <el-option
  71. label="全部"
  72. value="0">
  73. </el-option>
  74. <el-option
  75. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  76. :key="index"
  77. :label="item.name"
  78. :value="item.id">
  79. </el-option>
  80. </el-select>
  81. </div>
  82. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  83. <el-table ref="multipleTable"
  84. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  85. :data="drugs" border @select='selectDrugs'
  86. :row-style="{ color: '#303133' }"
  87. @select-all="changeAllGoodInfoTableData"
  88. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  89. highlight-current-row>
  90. <el-table-column type="selection" width="40"
  91. align="center"></el-table-column>
  92. <el-table-column label="名称">
  93. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  94. </el-table-column>
  95. <el-table-column label="规格" width="60">
  96. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  97. </el-table-column>
  98. <el-table-column label="单价" width="40">
  99. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  100. </el-table-column>
  101. </el-table>
  102. </div>
  103. </el-tab-pane>
  104. </el-tabs>
  105. </div>
  106. <div style="height:100%;" v-show="showTwo">
  107. <div style="height:100%;" v-show="showTwo">
  108. <el-tabs class="rightTabs" v-model="activeName">
  109. <el-tab-pane label="项目列表" name="1">
  110. <div style="margin-bottom:5px;">
  111. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  112. <el-input style="width:50%;" @input="searchProjectAction"
  113. @keyup.enter.native='searchProjectAction'
  114. v-model.trim="search_project_keyword"
  115. placeholder="请输入项目名称"></el-input>
  116. <el-select style="float: right;width: 49%;" v-model="value" placeholder=""
  117. @change="changeClass">
  118. <el-option
  119. label="全部"
  120. value="0">
  121. </el-option>
  122. <el-option
  123. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  124. :key="index"
  125. :label="item.name"
  126. :value="item.id">
  127. </el-option>
  128. </el-select>
  129. </div>
  130. <div style="width: 100%;flex:1;overflow-y: auto;">
  131. <el-table ref="tables"
  132. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  133. :data="tabProject" border @select='selectChange'
  134. :row-style="{ color: '#303133' }"
  135. @select-all="changeAllGoodInfoTableDataTwo"
  136. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  137. highlight-current-row>
  138. <el-table-column type="selection" width="40"
  139. align="center"></el-table-column>
  140. <el-table-column prop="name" label="名称">
  141. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  142. </el-table-column>
  143. <el-table-column label="规格" width="60">
  144. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  145. </el-table-column>
  146. <el-table-column label="单价" width="40">
  147. <template slot-scope="scope">{{ scope.row.price }}</template>
  148. </el-table-column>
  149. </el-table>
  150. </div>
  151. </el-tab-pane>
  152. <el-tab-pane label="项目组套" name="2">
  153. <div style="width: 100%;flex:1;overflow-y: auto;">
  154. <el-table :data="tabPrjectTeam" border ref="tabProjectTeam"
  155. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  156. :row-style="{ color: '#303133' }"
  157. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  158. highlight-current-row
  159. @select='selectTeam'>
  160. <el-table-column type="selection" width="40"
  161. align="center"></el-table-column>
  162. <el-table-column prop="name" label="名称">
  163. <template slot-scope="scope">{{scope.row.project_team}}</template>
  164. </el-table-column>
  165. </el-table>
  166. </div>
  167. </el-tab-pane>
  168. </el-tabs>
  169. </div>
  170. </div>
  171. </el-tabs>
  172. <template>
  173. <div class="comfirmBox">
  174. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  175. </div>
  176. </template>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </template>
  182. <script>
  183. import { createdTemplate, delHisPrescriptionInfoTemplate, getPrescriptionTemplateInfo } from '@/api/his/his_config'
  184. import {
  185. createHisPrescription,
  186. delHisPrescription,
  187. editHisPrescription,
  188. getCallHisPrescription,
  189. getDayOrMonthHisPrescription,
  190. getInitData,
  191. getNextOrLastHisPrescription,
  192. getPatientInfo,
  193. getSchedulePatientList
  194. } from '@/api/his/his'
  195. import { getDictionaryDataConfig } from '@/utils/data'
  196. import prescriptionTable from './components/prescriptionTable'
  197. import {
  198. addProjectTeam,
  199. getAllProjectList,
  200. getAllProjectTeam,
  201. getHisProject,
  202. getPojectListById
  203. } from '@/api/project/project'
  204. import { uParseTime } from '@/utils/tools'
  205. import PrescriptionTemplateTable from './components/prescriptionTemplateTable'
  206. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  207. const moment = require('moment')
  208. export default {
  209. props: {
  210. patientInfo: Object,
  211. hisPatientInfo: Object,
  212. prescriptions: Array,
  213. record_date: String,
  214. search_keyword: '',
  215. month_prescriptions: Array,
  216. isloading: false,
  217. loading: false,
  218. other_sick: {
  219. type: Array,
  220. default: function() {
  221. return []
  222. }
  223. }
  224. },
  225. components: {
  226. PrescriptionTemplateTable,
  227. prescriptionTable,
  228. BreadCrumb
  229. },
  230. data() {
  231. return {
  232. crumbs: [
  233. { path: false, name: '门诊医生站' },
  234. { path: false, name: '处方模版' },
  235. { path: false, name: '模版详情' },
  236. ],
  237. tempForm: {
  238. name: '',
  239. mode_id: ''
  240. },
  241. modeOptions: this.$store.getters.treatment_mode,
  242. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  243. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  244. isLastOrNextVisible: false,
  245. multipleTableHeight: '',
  246. register_type: 1,
  247. value: '0',
  248. search_project_keyword: '',
  249. drugs: [],
  250. allDrugs: [],
  251. advices_template: [],
  252. additions: [],
  253. editableTabsValueTwo: '处方1',
  254. editableTabsValue: '处方1',
  255. editableTabs: [{
  256. title: '处方1',
  257. name: '1'
  258. }],
  259. curDayPrescriptions: null,
  260. dayPrescriptions: [],
  261. currenet_inedx: 0,
  262. rightTab: 1,
  263. activeName: '1',
  264. drug_activeName: '1',
  265. curPrescriptions: null,
  266. drugTableData: [],
  267. preDrugs: [],
  268. curDrugs: [],
  269. doctorOptions: [],
  270. doctorValue: '',
  271. departmentOptions: [],
  272. departmentValue: '',
  273. total: 0,
  274. request_record_date: '',
  275. state2: '',
  276. customTabIndex: 1,
  277. options: [],
  278. tabProject: [],
  279. allProject: [],
  280. strids: '',
  281. showOne: true,
  282. showTwo: false,
  283. tableData: [],
  284. tabPrjectTeam: [],
  285. teamList: [],
  286. doctors: [],
  287. departMent: [],
  288. curStatus: 0,
  289. isShowDayPrescription: false,
  290. monthCustomTabIndex: 1,
  291. order_status: '',
  292. register_types: [
  293. { id: 1, name: '医保' },
  294. { id: 2, name: '自费' }
  295. ],
  296. pickerOptions: {
  297. disabledDate(time) {
  298. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  299. return time.getTime() > Date.now() || time.getTime() < threeMonths
  300. }
  301. },
  302. department: [],
  303. sick: [],
  304. diagnoses: [],
  305. diagnose: 1,
  306. state1: 1,
  307. curTotal: 0,
  308. prescription_id: 0,
  309. tempDrugs: [],
  310. dayorMonth: 'day',
  311. hisList: []
  312. }
  313. },
  314. methods: {
  315. save() {
  316. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  317. this.$message.error('请先开处方')
  318. return
  319. }
  320. if (this.tempForm.name.length <= 0) {
  321. this.$message.error('模版名称不能为空')
  322. return
  323. }
  324. if (this.tempForm.mode_id <= 0) {
  325. this.$message.error('透析模式不能为空')
  326. return
  327. }
  328. let params = {
  329. name: this.tempForm.name,
  330. mode_id: this.tempForm.mode_id,
  331. patient_id: this.$route.query.patient_id,
  332. id: this.$route.query.id
  333. }
  334. for (let i = 0; i < this.prescriptions.length; i++) {
  335. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  336. this.prescriptions[i]['type'] = 1
  337. }
  338. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  339. this.prescriptions[i]['type'] = 2
  340. }
  341. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  342. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  343. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  344. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  345. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  346. }
  347. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  348. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  349. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  350. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  351. }
  352. }
  353. let data = {
  354. 'prescriptions': this.prescriptions
  355. }
  356. createdTemplate(params, data).then(response => {
  357. if (response.data.state == 1) {
  358. this.$message.success('保存成功')
  359. }else{
  360. this.$message.error(response.data.msg)
  361. }
  362. })
  363. },
  364. changeClass(id) {
  365. this.tabProject = []
  366. if (id == 0) {
  367. this.tabProject = this.allProject
  368. } else {
  369. for (let i = 0; i < this.allProject.length; i++) {
  370. if (this.allProject[i].cost_classify == id) {
  371. this.tabProject.push(this.allProject[i])
  372. }
  373. }
  374. }
  375. },
  376. formatDecimal(num, decimal) {
  377. num = num.toString()
  378. let index = num.indexOf('.')
  379. if (index !== -1) {
  380. num = num.substring(0, decimal + index + 1)
  381. } else {
  382. num = num.substring(0)
  383. }
  384. return parseFloat(num).toFixed(decimal)
  385. },
  386. setValue(val) {
  387. this.prescriptions = []
  388. this.prescriptions = val
  389. this.$refs.next_or_last_prescription.close()
  390. var nowDate = new Date()
  391. var nowYear = nowDate.getFullYear()
  392. var nowMonth = nowDate.getMonth() + 1
  393. var nowDay = nowDate.getDate()
  394. var hours = nowDate.getHours()
  395. var min = nowDate.getMinutes()
  396. var nowTime =
  397. nowYear +
  398. '-' +
  399. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  400. '-' +
  401. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  402. ':' + (min < 10 ? '0' + min : min)
  403. for (let i = 0; i < this.prescriptions.length; i++) {
  404. this.prescriptions[i].name = '处方' + (i + 1)
  405. this.prescriptions[i]['pre_time'] = nowTime
  406. if (i == 0) {
  407. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  408. this.customTabIndex = 1
  409. this.curStatus = 1
  410. this.rightTab = 1
  411. this.showOne = true
  412. this.showTwo = false
  413. }
  414. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  415. this.customTabIndex = 2
  416. this.curStatus = 2
  417. this.rightTab = 2
  418. this.showTwo = true
  419. this.showOne = false
  420. }
  421. }
  422. }
  423. this.curPrescriptions = this.prescriptions[0]
  424. this.request_record_date = this.record_date
  425. this.$emit('setData', this.prescriptions)
  426. },
  427. GetNextOrLastHisPrescription(params) {
  428. getNextOrLastHisPrescription(params).then(response => {
  429. if (response.data.state == 1) {
  430. if (this.dayorMonth == 'day') {
  431. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  432. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  433. } else {
  434. this.$message.error('当前处于月结,无法使用上一方或下一方功能')
  435. }
  436. } else {
  437. this.$message.error(response.data.msg)
  438. }
  439. })
  440. },
  441. selectTemplate(selection, row) {
  442. this.tempDrugs = selection
  443. }, changeTemplateData(selection) {
  444. this.tempDrugs = selection
  445. },
  446. searchProjectAction() {
  447. if (this.search_project_keyword.length == 0) {
  448. this.tabProject = this.allProject
  449. } else {
  450. let arr = []
  451. for (let i = 0; i < this.allProject.length; i++) {
  452. if (this.allProject[i].project_name.indexOf(this.search_project_keyword) != -1 ) {
  453. arr = arr.concat(this.allProject[i])
  454. }
  455. }
  456. this.tabProject = arr
  457. }
  458. },
  459. searchAction() {
  460. if (this.search_keyword.length == 0) {
  461. this.drugs = this.allDrugs
  462. } else {
  463. let arr = []
  464. for (let i = 0; i < this.drugs.length; i++) {
  465. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1 || this.drugs[i].wubi.indexOf(this.search_keyword) != -1 || this.drugs[i].pinyin.indexOf(this.search_keyword) != -1) {
  466. arr = arr.concat(this.drugs[i])
  467. }
  468. }
  469. this.drugs = arr
  470. }
  471. },
  472. createFilter(queryString) {
  473. return (restaurant) => {
  474. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  475. }
  476. },
  477. querySearch2(queryString, cb) {
  478. var restaurants = this.other_sick
  479. restaurants.map(item => {
  480. item.value = item.name
  481. })
  482. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  483. // 调用 callback 返回建议列表的数据
  484. cb(results)
  485. },
  486. changeKind(val) {
  487. this.drugs = []
  488. if (val == 0) {
  489. this.drugs = this.allDrugs
  490. } else {
  491. for (let i = 0; i < this.allDrugs.length; i++) {
  492. if (this.allDrugs[i].drug_type == val) {
  493. this.drugs.push(this.allDrugs[i])
  494. }
  495. }
  496. }
  497. },
  498. getDictionaryDataConfig(module, filed_name) {
  499. return getDictionaryDataConfig(module, filed_name)
  500. },
  501. getInitData() {
  502. getInitData().then(response => {
  503. if (response.data.state == 0) {
  504. this.$message.error(response.data.msg)
  505. return false
  506. } else {
  507. this.drugs = response.data.data.drugs
  508. this.allDrugs = response.data.data.drugs
  509. this.advices_template = response.data.data.advices_template
  510. this.doctors = response.data.data.doctors
  511. for (let i = 0; i < this.doctors.length; i++) {
  512. if (this.doctors[i].user_type == 1) {
  513. this.doctors.splice(i, 1)
  514. }
  515. }
  516. this.department = response.data.data.department
  517. this.sick = response.data.data.sick
  518. this.diagnoses = response.data.data.diagnose
  519. this.additions = response.data.data.additions
  520. }
  521. })
  522. },
  523. tabclickEvent(val) {
  524. for (let i = 0; i < this.prescriptions.length; i++) {
  525. if (this.prescriptions[i].name == val.name) {
  526. this.prescription_id = this.prescriptions[i].id
  527. this.$emit('event1', this.prescription_id)
  528. this.curPrescriptions = this.prescriptions[i]
  529. this.teamList = []
  530. this.curDrugs = []
  531. this.$refs.multipleTable.clearSelection()
  532. this.$refs.tables.clearSelection()
  533. //用来区分处方属于项目还是药品
  534. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  535. this.customTabIndex = 1
  536. this.curStatus = 1
  537. this.rightTab = 1
  538. this.showOne = true
  539. this.showTwo = false
  540. }
  541. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  542. this.customTabIndex = 2
  543. this.curStatus = 2
  544. this.rightTab = 2
  545. this.showTwo = true
  546. this.showOne = false
  547. }
  548. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  549. this.customTabIndex = this.rightTab
  550. this.curStatus = 0
  551. }
  552. }
  553. }
  554. if (this.curPrescriptions.order_status == 0) {
  555. this.order_status = ''
  556. }
  557. if (this.curPrescriptions.order_status == 1) {
  558. this.order_status = '未收费'
  559. }
  560. if (this.curPrescriptions.order_status == 2) {
  561. this.order_status = '已结算'
  562. }
  563. if (this.curPrescriptions.order_status == 3) {
  564. this.order_status = '已退费'
  565. }
  566. },
  567. clearData() {
  568. this.curPrescriptions = []
  569. this.curStatus = 0
  570. this.curDrugs = []
  571. this.preDrugs = []
  572. this.teamList = []
  573. },
  574. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data) {
  575. for (let i = 0; i < doctors.length; i++) {
  576. if (doctors[i].user_type == 1) {
  577. doctors.splice(i, 1)
  578. }
  579. }
  580. this.curMonthPrescriptions = {}
  581. this.curPrescriptions = {}
  582. this.prescription_id = data[0].id
  583. this.editableTabsValue = '处方1'
  584. this.dayorMonth = 'day'
  585. this.$emit('event1', this.prescription_id)
  586. this.curStatus = 0
  587. this.curPrescriptions = {}
  588. this.curMonthPrescriptions = {}
  589. if (month_data && month_data.length > 0) {
  590. this.curMonthPrescriptions = month_data[0]
  591. } else {
  592. this.curMonthPrescriptions = {}
  593. }
  594. if (data && data.length > 0) {
  595. this.curPrescriptions = data[0]
  596. } else {
  597. this.curPrescriptions = {}
  598. }
  599. this.diagnose = info.diagnosis
  600. if (this.diagnose == 0) {
  601. for (let i = 0; i < this.diagnoses.length; i++) {
  602. this.diagnose = this.diagnoses[0].id
  603. }
  604. }
  605. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  606. this.curStatus = 1
  607. this.customTabIndex = 1
  608. this.rightTab = 1
  609. this.showOne = true
  610. this.showTwo = false
  611. }
  612. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  613. this.curStatus = 2
  614. this.customTabIndex = 2
  615. this.rightTab = 2
  616. this.showOne = false
  617. this.showTwo = true
  618. }
  619. this.state1 = info.sick_type
  620. if (this.state1 == 0) {
  621. this.state1 = ''
  622. for (let i = 0; i < this.sick.length; i++) {
  623. this.state1 = this.sick[0].id
  624. }
  625. }
  626. this.state2 = info.sick_history
  627. if (this.state2 == 0) {
  628. this.state2 = ''
  629. }
  630. if (info.prescription_status == 0) {
  631. this.order_status = ''
  632. }
  633. if (this.curPrescriptions.order_status == 1) {
  634. this.order_status = '未收费'
  635. }
  636. if (this.curPrescriptions.order_status == 2) {
  637. this.order_status = '已结算'
  638. }
  639. if (this.curPrescriptions.order_status == 3) {
  640. this.order_status = '已退费'
  641. }
  642. if (info.id > 0) {
  643. this.doctorValue = info.doctor_id
  644. this.departmentValue = info.departments
  645. } else {
  646. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  647. this.doctorValue = hisPatientInfo.doctor
  648. this.departmentValue = hisPatientInfo.department
  649. } else {
  650. if (admin_info.user_type == 2 || admin_info.user_type == 1) {
  651. this.doctorValue = admin_info.admin_user_id
  652. if (admin_info.department_id == 0) {
  653. if (this.department.length > 0) {
  654. if (department && department.length > 0) {
  655. this.departmentValue = department[0].id
  656. } else {
  657. this.departmentValue = ''
  658. }
  659. } else {
  660. this.departmentValue = ''
  661. }
  662. } else {
  663. this.departmentValue = admin_info.department_id
  664. }
  665. } else {
  666. this.doctorValue = doctors[0].admin_user_id
  667. }
  668. if (this.doctorValue == 0) {
  669. this.doctorValue = ''
  670. }
  671. }
  672. }
  673. if (info.register_type == 0) {
  674. for (let i = 0; i < this.register.length; i++) {
  675. this.register_type = this.register[0].value
  676. }
  677. } else {
  678. this.register_type = info.register_type
  679. }
  680. },
  681. moreState(tab, event) {
  682. if (tab == 'more') {
  683. return false
  684. }
  685. }, open_three() {
  686. this.$refs.saveTemplate.show(this.prescriptions)
  687. }, open_two() {
  688. if (this.dayorMonth == 'day') {
  689. if (this.patientInfo == null || this.patientInfo.id == 0) {
  690. this.$message.error('请选择患者')
  691. return
  692. }
  693. let params = {
  694. end_time: this.record_date,
  695. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  696. patient_id: this.patientInfo.id,
  697. p_type: 2
  698. }
  699. getCallHisPrescription(params).then(response => {
  700. if (response.data.state == 1) {
  701. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  702. } else {
  703. this.$message.error(response.data.msg)
  704. }
  705. })
  706. } else {
  707. this.$message.error('当前属于月结状态,无法试用处方调用')
  708. }
  709. },
  710. open(index, isLoading) {
  711. if (this.dayorMonth == 'day') {
  712. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  713. this.$message.error('请先开处方')
  714. return
  715. }
  716. }
  717. if (this.dayorMonth == 'day') {
  718. if (this.doctorValue.length <= 0) {
  719. this.$message.error('医生不能为空')
  720. return
  721. }
  722. if (this.departmentValue.length <= 0) {
  723. this.$message.error('科室不能为空')
  724. return
  725. }
  726. if (this.state1 <= 0) {
  727. this.$message.error('疾病类型不能为空')
  728. return
  729. }
  730. if (index == 1) {
  731. let params = {
  732. p_type: 2,
  733. patient_id: this.patientInfo.id,
  734. diagnose: this.diagnose,
  735. sick_type: this.state1,
  736. sick_history: this.state2,
  737. doctor: this.doctorValue,
  738. department: this.departmentValue,
  739. record_date: this.record_date,
  740. his_patient_id: this.hisPatientInfo.id,
  741. reg_type: this.register_type
  742. }
  743. for (let i = 0; i < this.prescriptions.length; i++) {
  744. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  745. this.prescriptions[i]['type'] = 1
  746. }
  747. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  748. this.prescriptions[i]['type'] = 2
  749. }
  750. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  751. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  752. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  753. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  754. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  755. }
  756. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  757. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  758. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  759. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  760. }
  761. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  762. this.prescriptions[i].addition[b].id = parseInt(this.prescriptions[i].addition[b].id)
  763. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  764. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  765. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  766. }
  767. }
  768. let data = {
  769. 'prescriptions': this.prescriptions
  770. }
  771. isLoading = true
  772. createHisPrescription(data, params).then(response => {
  773. if (response.data.state == 1) {
  774. this.$emit('change', this.patientInfo.id)
  775. this.$message.success('保存成功')
  776. }
  777. })
  778. } else if (index == 2) {
  779. this.$router.push('/outpatientDoctorStation/print')
  780. } else if (index == 4) {
  781. } else if (index == 5) {
  782. this.$refs.saveTemplate.show()
  783. }
  784. } else if (this.dayorMonth == 'month') {
  785. if (this.isShowDayPrescription) {
  786. // if (this.curDayPrescriptions.order_status == 2) {
  787. // this.$message.error('当前处方已经结算,无法保存')
  788. // return
  789. // }
  790. if (this.doctorValue.length <= 0) {
  791. this.$message.error('医生不能为空')
  792. return
  793. }
  794. if (this.departmentValue.length <= 0) {
  795. this.$message.error('科室不能为空')
  796. return
  797. }
  798. if (index == 1) {
  799. let params = {
  800. patient_id: this.patientInfo.id,
  801. diagnose: this.diagnose,
  802. sick_type: this.state1,
  803. sick_history: this.state2,
  804. doctor: this.doctorValue,
  805. department: this.departmentValue,
  806. record_date: this.end_time,
  807. his_patient_id: this.hisPatientInfo.id,
  808. reg_type: this.register_type,
  809. p_type: 2
  810. }
  811. var month_prescriptions = this.deepClone(this.month_prescriptions)
  812. for (let i = 0; i < month_prescriptions.length; i++) {
  813. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  814. month_prescriptions[i]['type'] = 1
  815. }
  816. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  817. month_prescriptions[i]['type'] = 2
  818. }
  819. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  820. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  821. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  822. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  823. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  824. }
  825. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  826. console.log('~~~~~~~')
  827. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  828. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  829. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  830. }
  831. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  832. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  833. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  834. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  835. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  836. }
  837. }
  838. let data = {
  839. 'prescriptions': month_prescriptions
  840. }
  841. editHisPrescription(data, params).then(response => {
  842. if (response.data.state == 1) {
  843. this.month_prescriptions = month_prescriptions
  844. this.$message.success('编辑成功')
  845. }
  846. })
  847. }
  848. }
  849. }
  850. },
  851. addTab(targetName) {
  852. // if (this.curPrescriptions.order_status == 2) {
  853. // this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  854. // return
  855. // }
  856. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  857. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  858. return
  859. }
  860. this.tabIndex = this.prescriptions.length
  861. ++this.tabIndex
  862. let newTabName = '处方' + this.tabIndex
  863. var nowDate = new Date()
  864. var nowYear = nowDate.getFullYear()
  865. var nowMonth = nowDate.getMonth() + 1
  866. var nowDay = nowDate.getDate()
  867. var hours = nowDate.getHours()
  868. var min = nowDate.getMinutes()
  869. var nowTime =
  870. nowYear +
  871. '-' +
  872. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  873. '-' +
  874. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  875. ':' + (min < 10 ? '0' + min : min)
  876. this.prescriptions.push({
  877. id: 0,
  878. name: newTabName,
  879. order_status: 0,
  880. advices: [],
  881. project: [],
  882. addition: [],
  883. pre_time: this.prescriptions[0].pre_time
  884. // pre_time: nowTime
  885. })
  886. this.editableTabsValue = newTabName
  887. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  888. this.curStatus = 0
  889. if (this.curPrescriptions.order_status == 0) {
  890. this.order_status = '未收费'
  891. }
  892. if (this.curPrescriptions.order_status == 1) {
  893. this.order_status = '未收费'
  894. }
  895. if (this.curPrescriptions.order_status == 2) {
  896. this.order_status = '已结算'
  897. }
  898. if (this.curPrescriptions.order_status == 3) {
  899. this.order_status = '已退费'
  900. }
  901. },
  902. removeTab(targetName) {
  903. if (targetName == '处方1') {
  904. this.$message.error('该处方无法删除')
  905. return
  906. }
  907. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  908. confirmButtonText: '确 定',
  909. cancelButtonText: '取 消',
  910. type: 'warning'
  911. }).then(() => {
  912. let id = 0
  913. for (let i = 0; i < this.prescriptions.length; i++) {
  914. if (this.prescriptions[i].name == targetName) {
  915. id = this.prescriptions[i].id
  916. }
  917. }
  918. if (id == 0) {
  919. let tabs = this.prescriptions
  920. let activeName = this.editableTabsValue
  921. if (activeName === targetName) {
  922. tabs.forEach((tab, index) => {
  923. if (tab.name === targetName) {
  924. let nextTab = tabs[index + 1] || tabs[index - 1]
  925. if (nextTab) {
  926. activeName = nextTab.name
  927. }
  928. }
  929. })
  930. }
  931. this.editableTabsValue = activeName
  932. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  933. for (let i = 0; i < this.prescriptions.length; i++) {
  934. if (activeName == this.prescriptions[i].name) {
  935. this.curPrescriptions = this.prescriptions[i]
  936. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  937. this.curStatus = 1
  938. }
  939. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  940. this.curStatus = 2
  941. }
  942. }
  943. }
  944. if (this.prescriptions.length == 0) {
  945. this.curPrescriptions = []
  946. this.curStatus = 0
  947. }
  948. } else {
  949. let params = {
  950. 'id': id
  951. }
  952. delHisPrescriptionInfoTemplate(params).then(response => {
  953. if (response.data.state == 1) {
  954. this.$message.success('删除成功')
  955. let tabs = this.prescriptions
  956. let activeName = this.editableTabsValue
  957. if (activeName === targetName) {
  958. tabs.forEach((tab, index) => {
  959. if (tab.name === targetName) {
  960. let nextTab = tabs[index + 1] || tabs[index - 1]
  961. if (nextTab) {
  962. activeName = nextTab.name
  963. }
  964. }
  965. })
  966. }
  967. this.editableTabsValue = activeName
  968. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  969. for (let i = 0; i < this.prescriptions.length; i++) {
  970. if (activeName == this.prescriptions[i].name) {
  971. this.curPrescriptions = this.prescriptions[i]
  972. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  973. this.curStatus = 1
  974. }
  975. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  976. this.curStatus = 2
  977. }
  978. }
  979. }
  980. if (this.prescriptions.length == 0) {
  981. this.curPrescriptions = []
  982. this.curStatus = 0
  983. }
  984. } else {
  985. this.$message.success(response.data.msg)
  986. }
  987. })
  988. }
  989. }).catch(() => {
  990. })
  991. },
  992. beforeLeave(activeName, oldActiveName) {
  993. let index = activeName
  994. if (index == 1) {
  995. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  996. return false
  997. }
  998. } else {
  999. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1000. return false
  1001. }
  1002. }
  1003. },
  1004. clickTab(tab) {
  1005. let index = parseInt(tab.name)
  1006. if (index == 1) {
  1007. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1008. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  1009. return
  1010. }
  1011. } else {
  1012. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1013. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  1014. return
  1015. }
  1016. }
  1017. if (index == 1) {
  1018. this.teamList = []
  1019. this.$refs.tables.clearSelection()
  1020. this.showOne = true
  1021. this.showTwo = false
  1022. this.$nextTick(() => {
  1023. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1024. })
  1025. this.customTabIndex = 1
  1026. }
  1027. if (index == 2) {
  1028. this.curDrugs = []
  1029. this.$refs.multipleTable.clearSelection()
  1030. this.showTwo = true
  1031. this.showOne = false
  1032. this.$nextTick(() => {
  1033. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1034. })
  1035. this.customTabIndex = 2
  1036. }
  1037. this.rightTab = index
  1038. //用来区分处方属于项目还是药品
  1039. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1040. this.customTabIndex = 1
  1041. this.curStatus = 1
  1042. }
  1043. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1044. this.customTabIndex = 2
  1045. this.curStatus = 2
  1046. }
  1047. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1048. // this.customTabIndex = this.rightTab
  1049. this.customTabIndex = index
  1050. this.curStatus = 0
  1051. }
  1052. }, changeAllGoodInfoTableData: function(selection) {
  1053. this.curDrugs = selection
  1054. }, addCharges() {
  1055. this.$refs.additionalCharges.show()
  1056. },
  1057. selectDrugs(selection, row) {
  1058. this.curDrugs = selection
  1059. },
  1060. comfirm() {
  1061. console.log('222222222222', this.curPrescriptions)
  1062. // if (this.curPrescriptions.order_status == 2) {
  1063. // this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  1064. // this.teamList = []
  1065. // this.curDrugs = []
  1066. // this.tempDrugs = []
  1067. // this.$refs.tables.clearSelection()
  1068. // this.$refs.multipleTableTwo.clearSelection()
  1069. // this.$refs.multipleTable.clearSelection()
  1070. // return
  1071. // }
  1072. if (this.curStatus == 1 && this.rightTab == 2) {
  1073. this.$message.error('改处方是药品,无法添加项目')
  1074. this.teamList = []
  1075. this.$refs.tables.clearSelection()
  1076. return
  1077. }
  1078. if (this.curStatus == 2 && this.rightTab == 1) {
  1079. this.$message.error('改处方是项目,无法添加药品')
  1080. this.curDrugs = []
  1081. this.tempDrugs = []
  1082. this.$refs.multipleTable.clearSelection()
  1083. this.$refs.multipleTableTwo.clearSelection()
  1084. return
  1085. }
  1086. for (let i = 0; i < this.teamList.length; i++) {
  1087. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1088. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  1089. this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  1090. return
  1091. }
  1092. }
  1093. }
  1094. console.log(this.curDrugs)
  1095. console.log(this.curPrescriptions.advices)
  1096. for (let i = 0; i < this.curDrugs.length; i++) {
  1097. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1098. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  1099. this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  1100. return
  1101. }
  1102. }
  1103. }
  1104. let templateDrugs = []
  1105. for (let i = 0; i < this.tempDrugs.length; i++) {
  1106. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  1107. templateDrugs.push(this.tempDrugs[i].advices[a])
  1108. }
  1109. }
  1110. // for (let i = 0; i < templateDrugs.length; i++) {
  1111. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1112. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  1113. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1114. // return
  1115. //
  1116. // }
  1117. // }
  1118. // }
  1119. for (let i = 0; i < this.prescriptions.length; i++) {
  1120. if (this.prescriptions[i].name == this.editableTabsValue) {
  1121. var temp = this.deepClone(this.curDrugs)
  1122. var temp2 = this.deepClone(this.teamList)
  1123. var temp3 = this.deepClone(templateDrugs)
  1124. if (temp3.length > 0) {
  1125. for (let b = 0; b < temp3.length; b++) {
  1126. let obj = {
  1127. advice_id: 0,
  1128. id: temp3[b].id,
  1129. drug_name: temp3[b].advice_name,
  1130. single_dose: temp3[b].single_dose,
  1131. delivery_way: temp3[b].delivery_way,
  1132. execution_frequency: temp3[b].execution_frequency,
  1133. retail_price: temp3[b].drug.retail_price.toString(),
  1134. remark: '',
  1135. day: 1,
  1136. prescribing_number: temp3[b].prescribing_number,
  1137. single_dose_unit: temp3[b].drug.min_unit,
  1138. prescribing_number_unit: temp3[b].drug.max_unit,
  1139. medical_insurance_number: temp3[b].drug.medical_insurance_number
  1140. }
  1141. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1142. obj.prescribing_number = 1
  1143. }
  1144. this.prescriptions[i].advices.push(obj)
  1145. }
  1146. this.curStatus = 1
  1147. }
  1148. if (temp.length > 0) {
  1149. for (let b = 0; b < temp.length; b++) {
  1150. let obj = {
  1151. advice_id: 0,
  1152. id: temp[b].id,
  1153. drug_name: temp[b].drug_name,
  1154. single_dose: temp[b].single_dose,
  1155. delivery_way: temp[b].delivery_way,
  1156. execution_frequency: temp[b].execution_frequency,
  1157. retail_price: temp[b].retail_price.toString(),
  1158. remark: '',
  1159. day: 1,
  1160. prescribing_number: temp[b].prescribing_number,
  1161. single_dose_unit: temp[b].min_unit,
  1162. prescribing_number_unit: temp[b].max_unit,
  1163. medical_insurance_number: temp[b].medical_insurance_number,
  1164. drug: temp[b]
  1165. }
  1166. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1167. obj.prescribing_number = 1
  1168. }
  1169. this.prescriptions[i].advices.push(obj)
  1170. }
  1171. this.curStatus = 1
  1172. }
  1173. // if(this.activeName == 2){
  1174. //
  1175. // for(let i = 0; i<temp2.length;i++){
  1176. // for(let j=0;j<this.hisList.length;j++){
  1177. // if(temp2[i].id == this.hisList[j].project_id){
  1178. // temp2[i].total = this.hisList[j].number
  1179. // }
  1180. // }
  1181. // }
  1182. // }
  1183. if (temp2.length > 0) {
  1184. for (let b = 0; b < temp2.length; b++) {
  1185. let obj = {
  1186. id: 0,
  1187. project_id: temp2[b].id,
  1188. project_name: temp2[b].project_name,
  1189. statistical_classification: temp2[b].statistical_classification,
  1190. single_dose: temp2[b].single_dose,
  1191. delivery_way: temp2[b].delivery_way,
  1192. execution_frequency: temp2[b].execution_frequency,
  1193. number_days: temp2[b].number_days,
  1194. total: temp2[b].total,
  1195. price: temp2[b].price,
  1196. remark: '',
  1197. medical_code: temp2[b].medical_code,
  1198. unit: temp2[b].unit,
  1199. type: temp2[b].type
  1200. }
  1201. if (obj.total == 0 || obj.total == undefined) {
  1202. obj.total = 1
  1203. }
  1204. if (obj.type == 3) {
  1205. obj.single_dose = 1
  1206. }
  1207. this.prescriptions[i].project.push(obj)
  1208. }
  1209. this.curStatus = 2
  1210. }
  1211. this.curPrescriptions = this.prescriptions[i]
  1212. this.$refs.multipleTable.clearSelection()
  1213. this.$refs.tables.clearSelection()
  1214. }
  1215. }
  1216. this.curDrugs = []
  1217. this.preDrugs = []
  1218. this.teamList = []
  1219. }, changeAllGoodInfoTableDataTwo(row) {
  1220. this.teamList = row
  1221. },
  1222. selectChange(row) {
  1223. this.teamList = row
  1224. }, getPrescriptionTemplateInfo() {
  1225. let params = {
  1226. id: this.$route.query.id
  1227. }
  1228. getPrescriptionTemplateInfo(params).then(response => {
  1229. if (response.data.state == 0) {
  1230. this.$message.error(response.data.msg)
  1231. return false
  1232. } else {
  1233. this.prescriptions = []
  1234. // console.log(this.tempForm)
  1235. if (response.data.data.template.id > 0) {
  1236. this.tempForm.name = response.data.data.template.name
  1237. this.tempForm.mode_id = response.data.data.template.mode
  1238. for (let i = 0; i < response.data.data.prescriptions.length; i++) {
  1239. var prescription = response.data.data.prescriptions[i]
  1240. let tempAdvice = []
  1241. let tempProject = []
  1242. let tempAddition = []
  1243. //药品
  1244. for (let b = 0; b < prescription.advices.length; b++) {
  1245. let obj = {
  1246. advice_id: prescription.advices[b].id,
  1247. drug_name: prescription.advices[b].advice_name,
  1248. single_dose: prescription.advices[b].single_dose,
  1249. delivery_way: prescription.advices[b].delivery_way,
  1250. execution_frequency: prescription.advices[b].execution_frequency,
  1251. retail_price: prescription.advices[b].price.toString(),
  1252. remark: prescription.advices[b].remark,
  1253. day: prescription.advices[b].day,
  1254. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1255. single_dose_unit: prescription.advices[b].single_dose_unit,
  1256. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1257. medical_insurance_number: prescription.advices[b].med_list_codg,
  1258. id: prescription.advices[b].drug_id,
  1259. drug: prescription.advices[b].drug,
  1260. }
  1261. tempAdvice.push(obj)
  1262. }
  1263. //项目
  1264. for (let b = 0; b < prescription.project.length; b++) {
  1265. let obj = {
  1266. id: prescription.project[b].id,
  1267. project_id: prescription.project[b].project_id,
  1268. project_name: prescription.project[b].project.project_name,
  1269. statistical_classification: prescription.project[b].project.statistical_classification,
  1270. single_dose: prescription.project[b].single_dose,
  1271. delivery_way: prescription.project[b].delivery_way,
  1272. execution_frequency: prescription.project[b].execution_frequency,
  1273. number_days: prescription.project[b].day,
  1274. total: prescription.project[b].count.toString(),
  1275. price: prescription.project[b].price,
  1276. remark: prescription.project[b].remark,
  1277. medical_code: prescription.project[b].project.medical_code,
  1278. unit: prescription.project[b].project.unit,
  1279. type: prescription.project[b].type
  1280. }
  1281. if (prescription.project[b].type == 2) {
  1282. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1283. obj['medical_code'] = prescription.project[b].project.medical_code
  1284. obj['project_name'] = prescription.project[b].project.project_name
  1285. } else if (prescription.project[b].type == 3) {
  1286. obj['statistical_classification'] = ''
  1287. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1288. obj['project_name'] = prescription.project[b].good_info.good_name
  1289. }
  1290. tempProject.push(obj)
  1291. }
  1292. // var preTime = nowTime
  1293. let index = i + 1
  1294. let obj = {
  1295. id: prescription.id,
  1296. name: '处方' + index,
  1297. advices: tempAdvice,
  1298. project: tempProject,
  1299. addition: tempAddition,
  1300. order_status: 1
  1301. // pre_time: preTime
  1302. }
  1303. this.prescriptions.push(obj)
  1304. }
  1305. if (this.prescriptions.length > 0) {
  1306. this.curPrescriptions = this.prescriptions[0]
  1307. console.log( this.curPrescriptions)
  1308. }
  1309. } else {
  1310. let obj = {
  1311. id: 0,
  1312. name: '处方1',
  1313. advices: [],
  1314. project: [],
  1315. addition: [],
  1316. order_status: 0
  1317. }
  1318. this.prescriptions.push(obj)
  1319. this.curPrescriptions = this.prescriptions[0]
  1320. }
  1321. console.log(this.prescriptions)
  1322. console.log(this.curPrescriptions)
  1323. }
  1324. })
  1325. },
  1326. getlist() {
  1327. this.tabProject = []
  1328. getHisProject().then(response => {
  1329. if (response.data.state == 1) {
  1330. var project = response.data.data.project
  1331. for (let i = 0; i < project.length; i++) {
  1332. let obj = {
  1333. id: project[i].id,
  1334. project_name: project[i].project_name,
  1335. statistical_classification: project[i].statistical_classification,
  1336. single_dose: project[i].single_dose,
  1337. delivery_way: project[i].delivery_way,
  1338. execution_frequency: project[i].execution_frequency,
  1339. number_days: project[i].number_days,
  1340. price: project[i].price,
  1341. medical_code: project[i].medical_code,
  1342. unit: project[i].unit,
  1343. type: 2
  1344. }
  1345. this.tabProject.push(obj)
  1346. }
  1347. var good_info = response.data.data.good_info
  1348. for (let i = 0; i < good_info.length; i++) {
  1349. let obj = {
  1350. id: good_info[i].id,
  1351. project_name: good_info[i].good_name,
  1352. statistical_classification: 0,
  1353. single_dose: 1,
  1354. delivery_way: '',
  1355. execution_frequency: '',
  1356. number_days: 1,
  1357. price: good_info[i].retail_price,
  1358. medical_code: good_info[i].medical_insurance_number,
  1359. unit: this.getGoodUnit(good_info[i].good_unit),
  1360. type: 3
  1361. }
  1362. this.tabProject.push(obj)
  1363. }
  1364. this.allProject = this.tabProject
  1365. }
  1366. })
  1367. }, deepClone(source) {
  1368. if (!source && typeof source !== 'object') {
  1369. throw new Error('error arguments', 'shallowClone')
  1370. }
  1371. const targetObj = source.constructor === Array ? [] : {}
  1372. Object.keys(source).forEach((keys) => {
  1373. if (source[keys] && typeof source[keys] === 'object') {
  1374. targetObj[keys] = this.deepClone(source[keys])
  1375. } else {
  1376. targetObj[keys] = source[keys]
  1377. }
  1378. })
  1379. return targetObj
  1380. }, getGoodUnit(id) {
  1381. var goodUnit = this.$store.getters.good_unit
  1382. for (let i = 0; i < goodUnit.length; i++) {
  1383. if (goodUnit[i].id == id) {
  1384. return goodUnit[i].name
  1385. }
  1386. }
  1387. },
  1388. getAllProjectTeam() {
  1389. getAllProjectTeam().then(response => {
  1390. if (response.data.state == 1) {
  1391. var team = response.data.data.team
  1392. console.log('team2222', team)
  1393. this.tabPrjectTeam = team
  1394. this.projectList = team
  1395. }
  1396. })
  1397. },
  1398. selectTeam(row) {
  1399. console.log('row', row)
  1400. var arr = []
  1401. for (let i = 0; i < row.length; i++) {
  1402. arr.push(row[i].item_id)
  1403. }
  1404. var ids = arr.join(',')
  1405. var strArr = ids.split(',')
  1406. var res = []//接收不重复的数据
  1407. for (var i = 0; i < strArr.length; i++) {
  1408. var flag = true
  1409. for (var j = 0; j < i; j++) {
  1410. if (strArr[i] === strArr[j]) {
  1411. flag = false
  1412. break
  1413. }
  1414. }
  1415. if (flag) {
  1416. res.push(strArr[i])
  1417. }
  1418. }
  1419. var idstr = res.join(',')
  1420. const params = {
  1421. project_id: idstr
  1422. }
  1423. getPojectListById(params).then(response => {
  1424. if (response.data.state == 1) {
  1425. this.teamList = []
  1426. var project = response.data.data.project
  1427. for (let i = 0; i < project.length; i++) {
  1428. if (project[i].type == 2) {
  1429. let obj = {
  1430. id: project[i].project_id,
  1431. project_name: project[i].project.project_name,
  1432. statistical_classification: project[i].project.statistical_classification,
  1433. single_dose: project[i].project.single_dose,
  1434. delivery_way: project[i].project.delivery_way,
  1435. execution_frequency: project[i].project.execution_frequency,
  1436. number_days: project[i].project.number_days,
  1437. total: project[i].number,
  1438. price: project[i].project.price,
  1439. remark: '',
  1440. medical_code: project[i].project.medical_code,
  1441. unit: project[i].project.unit,
  1442. type: project[i].type
  1443. }
  1444. if (obj.total == 0 || obj.total == undefined) {
  1445. obj.total = 1
  1446. }
  1447. this.teamList.push(obj)
  1448. } else if (project[i].type == 3) {
  1449. let obj = {
  1450. id: project[i].project_id,
  1451. project_name: project[i].good_info.good_name,
  1452. statistical_classification: '',
  1453. single_dose: '',
  1454. delivery_way: '',
  1455. execution_frequency: '',
  1456. number_days: '',
  1457. total: project[i].number,
  1458. price: project[i].good_info.retail_price,
  1459. remark: '',
  1460. medical_code: project[i].good_info.medical_insurance_number,
  1461. unit: project[i].good_info.unit,
  1462. type: project[i].type
  1463. }
  1464. if (obj.total == 0 || obj.total == undefined) {
  1465. obj.total = 1
  1466. }
  1467. this.teamList.push(obj)
  1468. console.log(this.teamList)
  1469. }
  1470. }
  1471. }
  1472. })
  1473. }, changeDoctor(val) {
  1474. for (let i = 0; i < this.doctors.length; i++) {
  1475. if (this.doctors[i].admin_user_id == this.doctorValue) {
  1476. this.departmentValue = this.doctors[i].department_id
  1477. }
  1478. }
  1479. if (this.departmentValue == 0) {
  1480. this.departmentValue = ''
  1481. }
  1482. },
  1483. changeDayOrMonth(tab) {
  1484. if (this.dayorMonth == 'day') {
  1485. } else if (this.dayorMonth == 'month') {
  1486. }
  1487. },
  1488. getAllProjectList() {
  1489. getAllProjectList().then(response => {
  1490. if (response.data.state == 1) {
  1491. var hisprojectlist = response.data.data.hisprojectlist
  1492. console.log('hisprojectlist', hisprojectlist)
  1493. this.hisList = hisprojectlist
  1494. }
  1495. })
  1496. },
  1497. clearSelection() {
  1498. this.$refs.tabProjectTeam.clearSelection()
  1499. }
  1500. }, created() {
  1501. this.getPrescriptionTemplateInfo()
  1502. this.getInitData()
  1503. //获取所有项目
  1504. this.getlist()
  1505. //获取所以项目组套
  1506. this.getAllProjectTeam()
  1507. this.getAllProjectList()
  1508. this.$nextTick(() => {
  1509. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1510. })
  1511. }
  1512. }
  1513. </script>
  1514. <style lang="scss" scoped>
  1515. .new-main-contain {
  1516. height: 100%;
  1517. display: flex;
  1518. flex-direction: column;
  1519. }
  1520. .app-container {
  1521. height: 100%;
  1522. }
  1523. .mainCell {
  1524. height: 36px;
  1525. display: flex;
  1526. align-items: center;
  1527. }
  1528. .mainLeft {
  1529. width: 200px;
  1530. height: 100%;
  1531. display: flex;
  1532. flex-direction: column;
  1533. margin-top: 2px;
  1534. .el-radio {
  1535. margin-right: 5px;
  1536. }
  1537. }
  1538. .mainRight {
  1539. margin-left: 20px;
  1540. flex: 1;
  1541. height: 100%;
  1542. display: flex;
  1543. flex-direction: column;
  1544. .cellSpan {
  1545. min-width: 80px;
  1546. display: inline-block;
  1547. margin-right: 10px;
  1548. }
  1549. }
  1550. .mainCenter {
  1551. display: flex;
  1552. flex: 1;
  1553. height: 100%;
  1554. }
  1555. .centerLeft {
  1556. flex: 1;
  1557. display: flex;
  1558. flex-direction: column;
  1559. position: relative;
  1560. .el-form-item {
  1561. width: 33%;
  1562. margin-bottom: 14px;
  1563. }
  1564. .el-form-item__label {
  1565. text-align: left;
  1566. }
  1567. }
  1568. .backColor {
  1569. background: #f6f8f9;
  1570. height: 5px;
  1571. margin-bottom: 5px;
  1572. }
  1573. .RP {
  1574. color: #409EFF;
  1575. font-size: 14px;
  1576. margin-bottom: 5px;
  1577. }
  1578. .tabsBox {
  1579. position: relative;
  1580. flex: 1;
  1581. overflow-y: auto;
  1582. margin-bottom: 60px;
  1583. /*/ / margin-top: 4 px;*/
  1584. .el-tabs__item {
  1585. padding: 0 10px;
  1586. }
  1587. }
  1588. .preTabs {
  1589. height: 100%;
  1590. display: flex;
  1591. flex-direction: column;
  1592. .el-tabs__content {
  1593. flex: 1;
  1594. overflow-y: auto;
  1595. }
  1596. }
  1597. .costBox {
  1598. width: 100%;
  1599. height: 60px;
  1600. background: #fff;
  1601. position: absolute;
  1602. bottom: 0;
  1603. display: flex;
  1604. align-items: center;
  1605. justify-content: space-between;
  1606. }
  1607. .statusRed {
  1608. color: red;
  1609. }
  1610. .addTab {
  1611. position: absolute;
  1612. right: 8px;
  1613. top: 3px;
  1614. z-index: 20;
  1615. }
  1616. .centerRight {
  1617. width: 300px;
  1618. margin-left: 10px;
  1619. display: flex;
  1620. flex-direction: column;
  1621. position: relative;
  1622. }
  1623. .rightTab {
  1624. height: 40px;
  1625. width: 100%;
  1626. border: 1px solid #d2d2d2;
  1627. box-sizing: border-box;
  1628. p {
  1629. width: 50%;
  1630. height: 40px;
  1631. line-height: 40px;
  1632. text-align: center;
  1633. background: #eee;
  1634. float: left;
  1635. }
  1636. > p:last-child {
  1637. border-left: 1px solid #d2d2d2;
  1638. float: right;
  1639. }
  1640. .activeP {
  1641. background: #409EFF;
  1642. color: #fff;
  1643. }
  1644. }
  1645. .rightTabs {
  1646. display: flex;
  1647. flex-direction: column;
  1648. }
  1649. .comfirmBox {
  1650. width: 100%;
  1651. height: 60px;
  1652. background: #fff;
  1653. position: absolute;
  1654. bottom: 0;
  1655. display: flex;
  1656. align-items: center;
  1657. justify-content: space-between;
  1658. z-index: 99;
  1659. }
  1660. .borderCard {
  1661. height: 100%;
  1662. display: flex;
  1663. flex-direction: column;
  1664. margin-bottom: 60px;
  1665. .el-tabs--border-card > .el-tabs__content {
  1666. padding: 0;
  1667. }
  1668. }
  1669. </style>
  1670. <style lang="scss">
  1671. .borderCard {
  1672. .el-tabs__nav {
  1673. width: 100%;
  1674. }
  1675. .el-tabs__item {
  1676. width: 50%;
  1677. text-align: center;
  1678. }
  1679. .el-tabs__content {
  1680. padding: 5px;
  1681. flex: 1;
  1682. }
  1683. }
  1684. .centerLeft {
  1685. .el-form-item__label {
  1686. text-align: left;
  1687. }
  1688. }
  1689. .tabsBox {
  1690. .el-tabs__item {
  1691. padding: 0 10px;
  1692. }
  1693. .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) {
  1694. padding: 0 10px;
  1695. }
  1696. .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 {
  1697. padding: 0 10px;
  1698. }
  1699. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  1700. padding: 0 10px;
  1701. }
  1702. }
  1703. .centerRight {
  1704. .el-tabs__nav-scroll {
  1705. display: flex;
  1706. }
  1707. .el-tabs__nav {
  1708. margin: 0 auto;
  1709. }
  1710. .el-table th .cell, .el-table td .cell {
  1711. padding: 0 2px;
  1712. }
  1713. }
  1714. .preTabs {
  1715. .el-tabs__content {
  1716. flex: 1;
  1717. overflow-y: auto;
  1718. padding: 5px 0 5px 5px;
  1719. }
  1720. }
  1721. .rightTabs {
  1722. height: 100%;
  1723. .el-tabs__nav {
  1724. width: auto;
  1725. }
  1726. .el-tabs__header {
  1727. margin-bottom: 5px;
  1728. }
  1729. .el-tabs__item {
  1730. width: auto;
  1731. text-align: inherit;
  1732. }
  1733. .el-tabs__content {
  1734. flex: 1;
  1735. overflow-y: auto;
  1736. }
  1737. .el-tab-pane {
  1738. display: flex;
  1739. flex-direction: column;
  1740. height: 100%;
  1741. }
  1742. }
  1743. #tab-more {
  1744. .el-icon-close {
  1745. display: none;
  1746. }
  1747. }
  1748. ::-webkit-scrollbar {
  1749. height: 15px;
  1750. }
  1751. </style>