deskPrescription.vue 60KB

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