deskPrescription.vue 63KB

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