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

deskPrescription.vue 118KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107
  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" v-loading="loading">
  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" label-position="right">
  27. <el-select style="width:100%;" v-model="register_type" placeholder="">
  28. <el-option
  29. v-for="(item,index) in register"
  30. :key="index"
  31. :label="item.label"
  32. :value="item.value">
  33. </el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="疾病类型:" prop="name" label-position="right">
  37. <el-select style="width:100%;" v-model="state1" placeholder="">
  38. <el-option
  39. v-for="(item,index) in sick"
  40. :key="index"
  41. :label="item.class_name"
  42. :value="item.id">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="诊断:" prop="name" label-position="right">
  47. <el-select style="width:100%;" v-model="diagnose" placeholder="">
  48. <el-option
  49. v-for="(item,index) in diagnoses"
  50. :key="index"
  51. :label="item.class_name"
  52. :value="item.id">
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item label="过敏病史: " prop="name" label-position="right">
  57. <el-autocomplete
  58. style="width:100%;"
  59. class="inline-input"
  60. v-model="state2"
  61. :fetch-suggestions="querySearch2"
  62. placeholder="请输入内容"
  63. ></el-autocomplete>
  64. </el-form-item>
  65. </el-form>
  66. <div class="tabsBox">
  67. <el-button v-if="dayorMonth == 'day'" type="text" class="addTab" @click="addCharges"
  68. icon="el-icon-circle-plus">附加收费
  69. </el-button>
  70. <div class="RP" v-if="dayorMonth == 'month'">Rp
  71. <el-date-picker
  72. v-model="start_time"
  73. prefix-icon="el-icon-date"
  74. @change="changeTime"
  75. :editable="false"
  76. style="width: 150px;"
  77. type="date"
  78. placeholder="选择开始时间"
  79. align="right"
  80. format="yyyy-MM-dd"
  81. :picker-options="pickerBeginDateBefore"
  82. value-format="yyyy-MM-dd">
  83. </el-date-picker>
  84. <span class>-</span>
  85. <el-date-picker
  86. v-model="end_time"
  87. prefix-icon="el-icon-date"
  88. @change="changeEndTime"
  89. :editable="false"
  90. :picker-options="pickerBeginDateAfter"
  91. style="width: 150px;"
  92. type="date"
  93. placeholder="选择结束时间"
  94. align="right"
  95. format="yyyy-MM-dd"
  96. value-format="yyyy-MM-dd">
  97. </el-date-picker>
  98. </div>
  99. <el-tabs v-show="dayorMonth == 'day'" class="preTabs" v-model="editableTabsValue" type="border-card"
  100. closable
  101. @tab-remove="removeTab"
  102. :before-leave="moreState" @tab-click="tabclickEvent">
  103. <el-tab-pane
  104. v-for="(item, index) in prescriptions"
  105. :key="index"
  106. :label="item.name"
  107. :name="item.name"
  108. >
  109. <div class="RP">Rp
  110. <el-date-picker
  111. v-model="item.pre_time"
  112. type="datetime"
  113. :clearable="false"
  114. format="yyyy-MM-dd HH:mm"
  115. value-format="yyyy-MM-dd HH:mm"
  116. placeholder="选择日期">
  117. </el-date-picker>
  118. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  119. <el-button
  120. round
  121. size="small"
  122. @click="openLast(3)"
  123. >上一方
  124. </el-button>
  125. <el-button
  126. round
  127. size="small"
  128. @click="openNext(4)"
  129. >下一方
  130. </el-button>
  131. </div>
  132. </div>
  133. </el-tab-pane>
  134. <el-tab-pane name="more" closable v-if="dayorMonth == 'day'"><span slot="label"><i
  135. class="el-icon-plus"
  136. @click="addTab"></i></span>
  137. </el-tab-pane>
  138. <prescription-table v-if="dayorMonth == 'day'" ref="prescription_tables"
  139. :prescription="curPrescriptions"
  140. :preDrugs="preDrugs"
  141. :activeType="customTabIndex"></prescription-table>
  142. </el-tabs>
  143. <el-tabs v-show="dayorMonth == 'month'" class="preTabs" v-model="editableTabsValueTwo"
  144. type="border-card"
  145. :before-leave="moreState" @tab-click="monthTabclickEvent">
  146. <el-tab-pane
  147. v-for="(item, index) in month_prescriptions"
  148. :key="index"
  149. :label="item.name"
  150. :name="item.name"
  151. >
  152. </el-tab-pane>
  153. <month-prescription-table v-if="dayorMonth == 'month' && !isShowDayPrescription"
  154. ref="month_prescription_tables"
  155. :prescription="curMonthPrescriptions"
  156. :activeType="monthCustomTabIndex"></month-prescription-table>
  157. <day-prescription-table v-if="dayorMonth == 'month' && isShowDayPrescription"
  158. ref="month_prescription_tables" :prescription="curDayPrescriptions"
  159. :activeType="monthCustomTabIndex"></day-prescription-table>
  160. </el-tabs>
  161. </div>
  162. <div class="costBox">
  163. <div>
  164. <span><span style="color: red">*</span>医生:</span>
  165. <el-select style="margin-right:5px;width:140px;" v-model="doctorValue" placeholder=""
  166. @change="changeDoctor">
  167. <el-option
  168. v-for="(item,index) in doctors"
  169. :key="index"
  170. :label="item.user_name"
  171. :value="item.admin_user_id">
  172. </el-option>
  173. </el-select>
  174. <span> <span style="color: red">*</span>科室:</span>
  175. <el-select style="margin-right:5px;width:140px;" v-model="departmentValue" placeholder="">
  176. <el-option
  177. v-for="(item,index) in department"
  178. :key="index"
  179. :label="item.name"
  180. :value="item.id">
  181. </el-option>
  182. </el-select>
  183. <span>当前处方总价:</span>
  184. <span style="color:red;" v-if="dayorMonth == 'day'">{{getTotalOne()?getTotalOne():''}}元</span>
  185. <span style="color:red;" v-if="dayorMonth == 'month'">{{getTotalTwo()?getTotalTwo():''}}元</span>
  186. <span style="margin-left:10px;">总价:</span>
  187. <span style="color:red;" v-if="dayorMonth == 'day'">{{ getTotal()?getTotal():''}}元</span>
  188. <span style="color:red;"
  189. v-if="dayorMonth == 'month'">{{ getMonthTotal()?getMonthTotal():''}}元</span>
  190. </div>
  191. <span :class="order_status == '未收费' ? 'statusRed' : ''">{{order_status}}</span>
  192. </div>
  193. </div>
  194. <div class='centerRight'>
  195. <!-- <div class="rightTab">
  196. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  197. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  198. </div> -->
  199. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  200. :before-leave='beforeLeave'>
  201. <el-tab-pane label="药品" :name="1">
  202. </el-tab-pane>
  203. <el-tab-pane label="项目" :name="2">
  204. </el-tab-pane>
  205. <div style="height:100%;" v-show="showOne">
  206. <el-tabs class="rightTabs" v-model="drug_activeName">
  207. <el-tab-pane label="药品列表" name="1">
  208. <div style="margin-bottom:5px;display:flex;">
  209. <el-input style="width:50%;" @input="searchAction"
  210. @keyup.enter.native='searchAction'
  211. v-model.trim="search_keyword"
  212. placeholder="请输入药品名字"></el-input>
  213. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder=""
  214. @change="changeKind">
  215. <el-option
  216. label="全部"
  217. value="0">
  218. </el-option>
  219. <el-option
  220. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  221. :key="index"
  222. :label="item.name"
  223. :value="item.id">
  224. </el-option>
  225. </el-select>
  226. </div>
  227. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  228. <el-table ref="multipleTable"
  229. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  230. :data="drugs" border @select='selectDrugs'
  231. :row-style="{ color: '#303133' }"
  232. @select-all="changeAllGoodInfoTableData"
  233. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  234. highlight-current-row>
  235. <el-table-column type="selection" width="40" align="center"></el-table-column>
  236. <el-table-column label="名称">
  237. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  238. </el-table-column>
  239. <el-table-column label="规格" width="60">
  240. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  241. </el-table-column>
  242. <el-table-column label="库存" width="60">
  243. <template slot-scope="scope">
  244. {{scope.row.total}}{{scope.row.total?scope.row.min_unit:''}}
  245. <!--/ {{-->
  246. <!--scope.row.total * (scope.row.dose / scope.row.min_number)}}-->
  247. <!--{{(scope.row.total * (scope.row.dose /-->
  248. <!--scope.row.min_number))?scope.row.max_unit:''}}-->
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="单价" width="40">
  252. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  253. </el-table-column>
  254. </el-table>
  255. <div>{{3*(2/3)}}</div>
  256. </div>
  257. </el-tab-pane>
  258. <!--<el-tab-pane label="医嘱模板" name="2">-->
  259. <!--<div style="margin-bottom:5px;">-->
  260. <!--&lt;!&ndash;<el-input style="width:50%;" v-model="input" placeholder=""></el-input>&ndash;&gt;-->
  261. <!--<el-select style="float: right;width: 49%;" v-model="value" placeholder="">-->
  262. <!--<el-option-->
  263. <!--v-for="item in options"-->
  264. <!--:key="item.value"-->
  265. <!--:label="item.label"-->
  266. <!--:value="item.value">-->
  267. <!--</el-option>-->
  268. <!--</el-select>-->
  269. <!--</div>-->
  270. <!--<div style="width: 100%;flex:1;overflow-y: auto;">-->
  271. <!--<el-table ref="multipleTableTwo" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"-->
  272. <!--:data="advices_template" border-->
  273. <!--:row-style="{ color: '#303133' }"-->
  274. <!--:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"-->
  275. <!--highlight-current-row-->
  276. <!--@select='selectTemplate'-->
  277. <!--@select-all="changeTemplateData"-->
  278. <!--&gt;-->
  279. <!--<el-table-column type="selection" width="40" align="center"></el-table-column>-->
  280. <!--<el-table-column prop="name" label="名称">-->
  281. <!--<template slot-scope="scope">{{scope.row.name}}</template>-->
  282. <!--</el-table-column>-->
  283. <!--&lt;!&ndash;<el-table-column label="规格" width="60">&ndash;&gt;-->
  284. <!--&lt;!&ndash;<template slot-scope="scope">33</template>&ndash;&gt;-->
  285. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  286. <!--&lt;!&ndash;<el-table-column label="库存" width="60">&ndash;&gt;-->
  287. <!--&lt;!&ndash;<template slot-scope="scope">22</template>&ndash;&gt;-->
  288. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  289. <!--&lt;!&ndash;<el-table-column label="单价" width="40">&ndash;&gt;-->
  290. <!--&lt;!&ndash;<template slot-scope="scope">12</template>&ndash;&gt;-->
  291. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  292. <!--</el-table>-->
  293. <!--</div>-->
  294. <!--</el-tab-pane>-->
  295. </el-tabs>
  296. </div>
  297. <div style="height:100%;" v-show="showTwo">
  298. <el-tabs class="rightTabs" v-model="activeName">
  299. <el-tab-pane label="项目列表" name="1">
  300. <div style="margin-bottom:5px;">
  301. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  302. <el-input style="width:50%;" @input="searchProjectAction"
  303. @keyup.enter.native='searchProjectAction'
  304. v-model.trim="search_project_keyword"
  305. placeholder="请输入项目名称"></el-input>
  306. <el-select style="float: right;width: 49%;" v-model="value" placeholder=""
  307. @change="changeClass">
  308. <el-option
  309. label="全部"
  310. value="0">
  311. </el-option>
  312. <el-option
  313. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  314. :key="index"
  315. :label="item.name"
  316. :value="item.id">
  317. </el-option>
  318. </el-select>
  319. </div>
  320. <div style="width: 100%;flex:1;overflow-y: auto;">
  321. <el-table ref="tables"
  322. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  323. :data="tabProject" border @select='selectChange'
  324. :row-style="{ color: '#303133' }"
  325. @select-all="changeAllGoodInfoTableDataTwo"
  326. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  327. highlight-current-row>
  328. <el-table-column type="selection" width="40" align="center"></el-table-column>
  329. <el-table-column prop="name" label="名称">
  330. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  331. </el-table-column>
  332. <el-table-column label="规格" width="60">
  333. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  334. </el-table-column>
  335. <el-table-column label="单价" width="40">
  336. <template slot-scope="scope">{{ scope.row.price }}</template>
  337. </el-table-column>
  338. </el-table>
  339. </div>
  340. </el-tab-pane>
  341. <el-tab-pane label="项目组套" name="2">
  342. <div style="width: 100%;flex:1;overflow-y: auto;">
  343. <el-table :data="tabPrjectTeam" border ref="tabProjectTeam"
  344. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  345. :row-style="{ color: '#303133' }"
  346. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  347. highlight-current-row
  348. @select='selectTeam'>
  349. <el-table-column type="selection" width="40" align="center"></el-table-column>
  350. <el-table-column prop="name" label="名称">
  351. <template slot-scope="scope">{{scope.row.project_team}}</template>
  352. </el-table-column>
  353. </el-table>
  354. </div>
  355. </el-tab-pane>
  356. </el-tabs>
  357. </div>
  358. </el-tabs>
  359. <template>
  360. <div class="comfirmBox">
  361. <!-- <div>
  362. <span>药品类型:</span>
  363. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  364. <el-option
  365. label="全部"
  366. value="0">
  367. </el-option>
  368. <el-option
  369. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  370. :key="index"
  371. :label="item.name"
  372. :value="item.id">
  373. </el-option>
  374. </el-select>
  375. </div> -->
  376. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  377. </div>
  378. </template>
  379. </div>
  380. </div>
  381. <additionalCharges v-on:setData="setCharge" ref='additionalCharges' :hisPatientInfo="hisPatientInfo"
  382. :patientInfo="patientInfo" :additions="additions"></additionalCharges>
  383. <select-template ref='selectTemplate'></select-template>
  384. <save-template ref='saveTemplate' v-on:save_template="saveTemplate"></save-template>
  385. <next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue"
  386. v-on:cancel="cancel"></next-or-last-prescription>
  387. <!--<next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue" v-on:cancel="cancel"></next-or-last-prescription>-->
  388. <call-prescription ref='call_prescription' v-on:call="call" v-on:call-cancel="callCancel"></call-prescription>
  389. </div>
  390. </template>
  391. <script>
  392. import MonthPrescriptionTable from '../../outpatientCharges/components/monthPrescriptionTable'
  393. import {
  394. createdTemplate,
  395. createHisPrescription,
  396. delHisPrescription,
  397. editHisPrescription,
  398. getCallHisPrescription,
  399. getDayOrMonthHisPrescription,
  400. getInitData,
  401. getNextOrLastHisPrescription,
  402. getPatientInfo,
  403. getSchedulePatientList
  404. } from '@/api/his/his'
  405. import { getDictionaryDataConfig } from '@/utils/data'
  406. import prescriptionTable from './prescriptionTable'
  407. import selectTemplate from './selectTemplate'
  408. import saveTemplate from './saveTemplate'
  409. import additionalCharges from './additionalCharges'
  410. import {
  411. addProjectTeam,
  412. getAllProjectList,
  413. getAllProjectTeam,
  414. getHisProject,
  415. getPojectListById
  416. } from '@/api/project/project'
  417. import { uParseTime } from '@/utils/tools'
  418. import NextOrLastPrescription from './nextOrLastPrescription'
  419. import CallPrescription from './callPrescription'
  420. import DayPrescriptionTable from '../../outpatientCharges/components/dayPrescriptionTable'
  421. const moment = require('moment')
  422. export default {
  423. props: {
  424. patientInfo: Object,
  425. hisPatientInfo: Object,
  426. prescriptions: Array,
  427. record_date: String,
  428. search_keyword: '',
  429. month_prescriptions: Array,
  430. isloading: false,
  431. loading: false,
  432. other_sick: {
  433. type: Array,
  434. default: function() {
  435. return []
  436. }
  437. }
  438. },
  439. components: {
  440. DayPrescriptionTable,
  441. MonthPrescriptionTable,
  442. CallPrescription,
  443. NextOrLastPrescription,
  444. selectTemplate,
  445. saveTemplate,
  446. prescriptionTable,
  447. additionalCharges
  448. },
  449. data() {
  450. return {
  451. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  452. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  453. register: [
  454. { value: 11, label: '普通门诊' },
  455. { value: 12, label: '门诊挂号' },
  456. { value: 13, label: '急诊' },
  457. { value: 14, label: '门诊特殊病' },
  458. { value: 15, label: '门诊统筹' },
  459. { value: 16, label: '门诊慢性病' },
  460. { value: 21, label: '普通住院' }
  461. ],
  462. isLastOrNextVisible: false,
  463. multipleTableHeight: '',
  464. register_type: '',
  465. value: '0',
  466. search_project_keyword: '',
  467. form: {
  468. name: ''
  469. },
  470. drugs: [],
  471. allDrugs: [],
  472. advices_template: [],
  473. additions: [],
  474. editableTabsValueTwo: '处方1',
  475. editableTabsValue: '处方1',
  476. editableTabs: [{
  477. title: '处方1',
  478. name: '1'
  479. }],
  480. tabIndex: this.prescriptions.length,
  481. curDayPrescriptions: null,
  482. dayPrescriptions: [],
  483. currenet_inedx: 0,
  484. rightTab: 1,
  485. activeName: '1',
  486. drug_activeName: '1',
  487. curPrescriptions: null,
  488. curMonthPrescriptions: this.month_prescriptions[0],
  489. drugTableData: [],
  490. preDrugs: [],
  491. curDrugs: [],
  492. doctorOptions: [],
  493. doctorValue: '',
  494. departmentOptions: [],
  495. departmentValue: '',
  496. total: 0,
  497. request_record_date: '',
  498. state2: '',
  499. customTabIndex: 1,
  500. options: [],
  501. tabProject: [],
  502. allProject: [],
  503. strids: '',
  504. showOne: true,
  505. showTwo: false,
  506. tableData: [],
  507. tabPrjectTeam: [],
  508. teamList: [],
  509. doctors: [],
  510. departMent: [],
  511. curStatus: 0,
  512. isShowDayPrescription: false,
  513. monthCustomTabIndex: 1,
  514. order_status: '',
  515. register_types: [
  516. { id: 1, name: '医保' },
  517. { id: 2, name: '自费' }
  518. ],
  519. pickerOptions: {
  520. disabledDate(time) {
  521. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  522. return time.getTime() > Date.now() || time.getTime() < threeMonths
  523. }
  524. },
  525. department: [],
  526. sick: [],
  527. diagnoses: [],
  528. diagnose: "",
  529. state1: '',
  530. curTotal: 0,
  531. prescription_id: 0,
  532. tempDrugs: [],
  533. dayorMonth: 'day',
  534. pickerBeginDateBefore: {
  535. disabledDate: (time) => {
  536. let beginDateVal = this.end_time
  537. if (beginDateVal) {
  538. return time.getTime() > new Date(beginDateVal).getTime()
  539. }
  540. }
  541. },
  542. pickerBeginDateAfter: {
  543. disabledDate: (time) => {
  544. let beginDateVal = this.start_time
  545. if (beginDateVal) {
  546. return time.getTime() <= new Date(beginDateVal).getTime()
  547. }
  548. }
  549. },
  550. hisList: []
  551. }
  552. },
  553. methods: {
  554. changeClass(id) {
  555. this.tabProject = []
  556. if (id == 0) {
  557. this.tabProject = this.allProject
  558. } else {
  559. for (let i = 0; i < this.allProject.length; i++) {
  560. if (this.allProject[i].cost_classify == id) {
  561. this.tabProject.push(this.allProject[i])
  562. }
  563. }
  564. }
  565. },
  566. setMonthPrescription(month_prescriptions) {
  567. this.month_prescriptions = []
  568. let drug_month_prescriptions = {
  569. advices: []
  570. }
  571. let drug_ids = []
  572. let project_month_prescriptions = {
  573. project: []
  574. }
  575. let project_ids = []
  576. let addition_month_prescriptions = {
  577. addition: []
  578. }
  579. let additions_ids = []
  580. for (let i = 0; i < month_prescriptions.length; i++) {
  581. if (month_prescriptions[i].type == 1) { //药品
  582. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  583. let obj = {
  584. id: month_prescriptions[i].advices[a].drug_id,
  585. price: month_prescriptions[i].advices[a].price
  586. }
  587. drug_ids.push(obj)
  588. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  589. }
  590. } else if (month_prescriptions[i].type == 2) { //项目
  591. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  592. let obj = {
  593. id: month_prescriptions[i].project[a].project_id,
  594. price: month_prescriptions[i].project[a].price
  595. }
  596. project_ids.push(obj)
  597. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  598. }
  599. }
  600. //附加收费
  601. for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  602. let obj = {
  603. id: month_prescriptions[i].addition[a].item_id,
  604. price: month_prescriptions[i].addition[a].price
  605. }
  606. additions_ids.push(obj)
  607. addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  608. }
  609. }
  610. const obj = {}
  611. const obj1 = {}
  612. const obj2 = {}
  613. drug_ids = drug_ids.reduce((cur, next) => {
  614. obj[next.price] ? '' : obj[next.price] = true && cur.push(next)
  615. return cur
  616. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  617. project_ids = project_ids.reduce((cur, next) => {
  618. obj1[next.price] ? '' : obj1[next.price] = true && cur.push(next)
  619. return cur
  620. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  621. additions_ids = additions_ids.reduce((cur, next) => {
  622. obj2[next.price] ? '' : obj2[next.price] = true && cur.push(next)
  623. return cur
  624. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  625. let drugs = []
  626. let projects = []
  627. let additions = []
  628. for (let i = 0; i < drug_ids.length; i++) {
  629. let obj = {}
  630. let count = 0
  631. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  632. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
  633. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  634. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  635. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  636. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  637. obj['day'] = drug_month_prescriptions.advices[a].day
  638. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  639. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  640. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  641. obj['id'] = drug_month_prescriptions.advices[a].drug_id
  642. obj['single_dose_unit'] = drug_month_prescriptions.advices[a].single_dose_unit
  643. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  644. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price)
  645. obj['drug'] = drug_month_prescriptions.advices[a].drug
  646. count = count + drug_month_prescriptions.advices[a].prescribing_number
  647. }
  648. }
  649. obj['prescribing_number'] = count
  650. drugs.push(obj)
  651. }
  652. for (let i = 0; i < project_ids.length; i++) {
  653. let obj = {}
  654. let count = 0
  655. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  656. if (project_ids[i].price == project_month_prescriptions.project[a].price) {
  657. if (project_month_prescriptions.project[a].type == 2) {
  658. obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  659. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  660. obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  661. } else if (project_month_prescriptions.project[a].type == 3) {
  662. obj['statistical_classification'] = ''
  663. obj['medical_code'] = project_month_prescriptions.project[a].good_info.medical_insurance_number
  664. obj['project_name'] = project_month_prescriptions.project[a].good_info.good_name
  665. }
  666. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name;
  667. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification;
  668. obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  669. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  670. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  671. obj['number_days'] = project_month_prescriptions.project[a].day
  672. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code;
  673. obj['unit'] = project_month_prescriptions.project[a].unit
  674. obj['project_id'] = project_month_prescriptions.project[a].project_id
  675. count = count + project_month_prescriptions.project[a].count
  676. // price = price + project_month_prescriptions.project[a].price
  677. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  678. }
  679. }
  680. obj['total'] = count
  681. projects.push(obj)
  682. }
  683. for (let i = 0; i < additions_ids.length; i++) {
  684. let obj = {}
  685. let count = 0
  686. if (addition_month_prescriptions.addition) {
  687. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  688. if (additions_ids[i].price == addition_month_prescriptions.addition[a].price) {
  689. obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  690. obj['id'] = addition_month_prescriptions.addition[a].id
  691. obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  692. count = count + addition_month_prescriptions.addition[a].count
  693. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  694. }
  695. }
  696. obj['count'] = count
  697. additions.push(obj)
  698. }
  699. }
  700. let p1 = {
  701. name: '处方' + 1,
  702. advices: drugs,
  703. project: [],
  704. type: 1,
  705. addition: additions
  706. }
  707. let p2 = {
  708. name: '处方' + 2,
  709. type: 2,
  710. project: projects,
  711. advices: [],
  712. addition: []
  713. }
  714. this.month_prescriptions.push(p1)
  715. this.month_prescriptions.push(p2)
  716. this.curMonthPrescriptions = this.month_prescriptions[0]
  717. },
  718. // setMonthPrescription(month_prescriptions) {
  719. // let drug_month_prescriptions = {
  720. // advices: [],
  721. // }
  722. // let drug_ids = []
  723. // let project_month_prescriptions = {
  724. // project: [],
  725. //
  726. // }
  727. // let project_ids = []
  728. //
  729. // let addition_month_prescriptions = {
  730. // addtions: [],
  731. //
  732. // }
  733. // let additions_ids = []
  734. //
  735. //
  736. // for (let i = 0; i < month_prescriptions.length; i++) {
  737. // if (month_prescriptions[i].type == 1) { //药品
  738. // for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  739. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  740. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  741. // }
  742. //
  743. // } else if (month_prescriptions[i].type == 2) { //项目
  744. // for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  745. // project_ids.push(month_prescriptions[i].project[a].project_id)
  746. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  747. // }
  748. // }
  749. // //附加收费
  750. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  751. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  752. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  753. // }
  754. //
  755. // }
  756. //
  757. // console.log(drug_ids)
  758. // console.log(drug_month_prescriptions)
  759. // console.log(project_ids)
  760. // console.log(project_month_prescriptions)
  761. // console.log(additions_ids)
  762. // console.log(addition_month_prescriptions)
  763. //
  764. //
  765. // const obj = {}
  766. // const obj1 = {}
  767. // const obj2 = {}
  768. //
  769. // drug_ids = drug_ids.reduce((cur, next) => {
  770. // obj[next] ? '' : obj[next] = true && cur.push(next)
  771. // return cur
  772. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  773. // project_ids = project_ids.reduce((cur, next) => {
  774. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  775. // return cur
  776. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  777. // additions_ids = additions_ids.reduce((cur, next) => {
  778. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  779. // return cur
  780. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  781. //
  782. //
  783. // console.log(drug_ids)
  784. // console.log(project_ids)
  785. // console.log(additions_ids)
  786. //
  787. //
  788. // let drugs = []
  789. // let projects = []
  790. // let additions = []
  791. //
  792. //
  793. // for (let i = 0; i < drug_ids.length; i++) {
  794. // let obj = {}
  795. // let price = 0
  796. // let count = 0
  797. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  798. // if (drug_ids[i] == drug_month_prescriptions.advices[a].drug_id) {
  799. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  800. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  801. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  802. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  803. // obj['day'] = drug_month_prescriptions.advices[a].day
  804. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  805. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  806. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  807. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  808. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  809. //
  810. //
  811. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  812. // price = price + drug_month_prescriptions.advices[a].price
  813. //
  814. // }
  815. // }
  816. // obj['retail_price'] =this.formatDecimal(price,2)
  817. // obj['prescribing_number'] = count
  818. // drugs.push(obj)
  819. // }
  820. //
  821. //
  822. // for (let i = 0; i < project_ids.length; i++) {
  823. // let obj = {}
  824. // let price = 0
  825. // let count = 0
  826. // for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  827. // if (project_ids[i] == project_month_prescriptions.project[a].project_id) {
  828. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  829. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  830. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  831. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  832. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  833. // obj['number_days'] = project_month_prescriptions.project[a].day
  834. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  835. // obj['unit'] = project_month_prescriptions.project[a].unit
  836. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  837. // count = count + project_month_prescriptions.project[a].count
  838. // price = price + project_month_prescriptions.project[a].price
  839. // }
  840. // }
  841. // obj['price'] = this.formatDecimal(price,2)
  842. // obj['total'] = count
  843. // projects.push(obj)
  844. // }
  845. //
  846. //
  847. // for (let i = 0; i < additions_ids.length; i++) {
  848. // let obj = {}
  849. // let price = 0
  850. // let count = 0
  851. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  852. // if (project_ids[i] == addition_month_prescriptions.addition[a].item_id) {
  853. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  854. // obj['id'] = addition_month_prescriptions.addition[a].id
  855. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  856. // count = count + addition_month_prescriptions.addition[a].count
  857. // price = price + addition_month_prescriptions.addition[a].price
  858. // }
  859. // }
  860. // obj['price'] = this.formatDecimal(price,2)
  861. // obj['count'] = count
  862. // additions.push(obj)
  863. // }
  864. //
  865. // console.log(drugs)
  866. // console.log(projects)
  867. // console.log(additions)
  868. //
  869. //
  870. // if (drugs.length > 0) {
  871. // let p1 = {
  872. // name: '处方' + 1,
  873. // advices: drugs,
  874. // project: [],
  875. // type: 1,
  876. // addition: additions,
  877. // }
  878. // this.month_prescriptions.push(p1)
  879. //
  880. // }
  881. //
  882. // if (projects.length > 0) {
  883. // let p2 = {
  884. // name: '处方' + 2,
  885. // type: 2,
  886. // project: projects,
  887. // advices: [],
  888. // }
  889. // this.month_prescriptions.push(p2)
  890. // }
  891. //
  892. // console.log(this.month_prescriptions)
  893. //
  894. // },
  895. formatDecimal(num, decimal) {
  896. num = num.toString()
  897. let index = num.indexOf('.')
  898. if (index !== -1) {
  899. num = num.substring(0, decimal + index + 1)
  900. } else {
  901. num = num.substring(0)
  902. }
  903. return parseFloat(num).toFixed(decimal)
  904. },
  905. changeTime(val) {
  906. if (val == this.end_time) {
  907. this.isShowDayPrescription = true
  908. } else {
  909. this.isShowDayPrescription = false
  910. }
  911. let params = {
  912. patient_id: this.patientInfo.id,
  913. start_time: val,
  914. end_time: this.end_time,
  915. p_type: 2
  916. }
  917. getDayOrMonthHisPrescription(params).then(response => {
  918. if (response.data.state == 1) {
  919. this.month_prescriptions = []
  920. if (val == this.end_time) {
  921. var day_prescription = response.data.data.day_prescription
  922. // this.month_prescriptions = day_prescription
  923. if (day_prescription.length > 0) {
  924. for (let i = 0; i < day_prescription.length; i++) {
  925. var prescription = day_prescription[i]
  926. let tempAdvice = []
  927. let tempProject = []
  928. let tempAddition = []
  929. //药品
  930. for (let b = 0; b < prescription.advices.length; b++) {
  931. let obj = {
  932. advice_id: prescription.advices[b].id,
  933. drug_name: prescription.advices[b].advice_name,
  934. single_dose: prescription.advices[b].single_dose,
  935. delivery_way: prescription.advices[b].delivery_way,
  936. execution_frequency: prescription.advices[b].execution_frequency,
  937. retail_price: prescription.advices[b].price.toString(),
  938. remark: prescription.advices[b].remark,
  939. day: prescription.advices[b].day,
  940. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  941. single_dose_unit: prescription.advices[b].single_dose_unit,
  942. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  943. medical_insurance_number: prescription.advices[b].med_list_codg,
  944. id: prescription.advices[b].drug_id,
  945. drug: prescription.advices[b].drug
  946. }
  947. tempAdvice.push(obj)
  948. }
  949. //项目
  950. for (let b = 0; b < prescription.project.length; b++) {
  951. let obj = {
  952. id: prescription.project[b].id,
  953. project_id: prescription.project[b].project_id,
  954. // project_name: prescription.project[b].project.project_name,
  955. // statistical_classification: prescription.project[b].project.statistical_classification,
  956. single_dose: prescription.project[b].single_dose,
  957. delivery_way: prescription.project[b].delivery_way,
  958. execution_frequency: prescription.project[b].execution_frequency,
  959. number_days: prescription.project[b].day,
  960. total: prescription.project[b].count.toString(),
  961. price: prescription.project[b].price,
  962. remark: prescription.project[b].remark,
  963. // medical_code: prescription.project[b].project.medical_code,
  964. unit: prescription.project[b].unit
  965. }
  966. if (prescription.project[b].type == 2) {
  967. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  968. obj['medical_code'] = prescription.project[b].project.medical_code
  969. obj['project_name'] = prescription.project[b].project.project_name
  970. } else if (prescription.project[b].type == 3) {
  971. obj['statistical_classification'] = ''
  972. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  973. obj['project_name'] = prescription.project[b].good_info.good_name
  974. }
  975. tempProject.push(obj)
  976. }
  977. //附加收费
  978. for (let b = 0; b < prescription.addition.length; b++) {
  979. let obj = {
  980. id: prescription.addition[b].id,
  981. item_name: prescription.addition[b].item_name,
  982. price: prescription.addition[b].price,
  983. count: prescription.addition[b].count,
  984. item_id: prescription.addition[b].item_id
  985. }
  986. tempAddition.push(obj)
  987. }
  988. let index = i + 1
  989. let obj = {
  990. id: prescription.id,
  991. name: '处方' + index,
  992. advices: tempAdvice,
  993. project: tempProject,
  994. addition: tempAddition,
  995. order_status: prescription.order_status
  996. }
  997. this.month_prescriptions.push(obj)
  998. }
  999. this.curDayPrescriptions = this.month_prescriptions[0]
  1000. }
  1001. } else {
  1002. this.setMonthPrescription(response.data.data.day_prescription)
  1003. this.curMonthPrescriptions = this.month_prescriptions[0]
  1004. }
  1005. } else {
  1006. this.$message.error(response.data.msg)
  1007. }
  1008. })
  1009. },
  1010. changeEndTime(val) {
  1011. if (val == this.start_time) {
  1012. this.isShowDayPrescription = true
  1013. } else {
  1014. this.isShowDayPrescription = false
  1015. }
  1016. let params = {
  1017. patient_id: this.patientInfo.id,
  1018. start_time: this.start_time,
  1019. end_time: val,
  1020. p_type: 2
  1021. }
  1022. getDayOrMonthHisPrescription(params).then(response => {
  1023. if (response.data.state == 1) {
  1024. this.month_prescriptions = []
  1025. if (val == this.start_time) {
  1026. var day_prescription = response.data.data.day_prescription
  1027. // this.month_prescriptions = day_prescription
  1028. if (day_prescription.length > 0) {
  1029. for (let i = 0; i < day_prescription.length; i++) {
  1030. var prescription = day_prescription[i]
  1031. let tempAdvice = []
  1032. let tempProject = []
  1033. let tempAddition = []
  1034. //药品
  1035. for (let b = 0; b < prescription.advices.length; b++) {
  1036. let obj = {
  1037. advice_id: prescription.advices[b].id,
  1038. drug_name: prescription.advices[b].advice_name,
  1039. single_dose: prescription.advices[b].single_dose,
  1040. delivery_way: prescription.advices[b].delivery_way,
  1041. execution_frequency: prescription.advices[b].execution_frequency,
  1042. retail_price: prescription.advices[b].price.toString(),
  1043. remark: prescription.advices[b].remark,
  1044. day: prescription.advices[b].day,
  1045. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1046. single_dose_unit: prescription.advices[b].single_dose_unit,
  1047. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1048. medical_insurance_number: prescription.advices[b].med_list_codg,
  1049. id: prescription.advices[b].drug_id,
  1050. drug: prescription.advices[b].drug
  1051. }
  1052. tempAdvice.push(obj)
  1053. }
  1054. //项目
  1055. for (let b = 0; b < prescription.project.length; b++) {
  1056. let obj = {
  1057. id: prescription.project[b].id,
  1058. project_id: prescription.project[b].project_id,
  1059. // project_name: prescription.project[b].project.project_name,
  1060. // statistical_classification: prescription.project[b].project.statistical_classification,
  1061. single_dose: prescription.project[b].single_dose,
  1062. delivery_way: prescription.project[b].delivery_way,
  1063. execution_frequency: prescription.project[b].execution_frequency,
  1064. number_days: prescription.project[b].day,
  1065. total: prescription.project[b].count.toString(),
  1066. price: prescription.project[b].price,
  1067. remark: prescription.project[b].remark,
  1068. // medical_code: prescription.project[b].project.medical_code,
  1069. unit: prescription.project[b].unit
  1070. }
  1071. if (prescription.project[b].type == 2) {
  1072. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1073. obj['medical_code'] = prescription.project[b].project.medical_code
  1074. obj['project_name'] = prescription.project[b].project.project_name
  1075. } else if (prescription.project[b].type == 3) {
  1076. obj['statistical_classification'] = ''
  1077. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1078. obj['project_name'] = prescription.project[b].good_info.good_name
  1079. }
  1080. tempProject.push(obj)
  1081. }
  1082. //附加收费
  1083. for (let b = 0; b < prescription.addition.length; b++) {
  1084. let obj = {
  1085. id: prescription.addition[b].id,
  1086. item_name: prescription.addition[b].item_name,
  1087. price: prescription.addition[b].price,
  1088. count: prescription.addition[b].count,
  1089. item_id: prescription.addition[b].item_id
  1090. }
  1091. tempAddition.push(obj)
  1092. }
  1093. let index = i + 1
  1094. let obj = {
  1095. id: prescription.id,
  1096. name: '处方' + index,
  1097. advices: tempAdvice,
  1098. project: tempProject,
  1099. addition: tempAddition,
  1100. order_status: prescription.order_status
  1101. }
  1102. this.month_prescriptions.push(obj)
  1103. }
  1104. this.curDayPrescriptions = this.month_prescriptions[0]
  1105. }
  1106. } else {
  1107. this.setMonthPrescription(response.data.data.day_prescription)
  1108. this.curMonthPrescriptions = this.month_prescriptions[0]
  1109. }
  1110. } else {
  1111. this.$message.error(response.data.msg)
  1112. }
  1113. })
  1114. }, saveTemplate(val) {
  1115. let params = {
  1116. name: val.name,
  1117. mode: val.mode,
  1118. patient_id: this.patientInfo.id
  1119. }
  1120. let data = {
  1121. 'prescriptions': val.prescriptions
  1122. }
  1123. createdTemplate(params, data).then(response => {
  1124. if (response.data.state == 1) {
  1125. this.$refs.saveTemplate.hide()
  1126. this.$message.success('保存成功')
  1127. } else {
  1128. this.$message.error(response.data.msg)
  1129. }
  1130. })
  1131. },
  1132. call(val) {
  1133. this.prescriptions = []
  1134. this.prescriptions = val
  1135. for (let i = 0; i < this.prescriptions.length; i++) {
  1136. var nowDate = new Date()
  1137. var nowYear = nowDate.getFullYear()
  1138. var nowMonth = nowDate.getMonth() + 1
  1139. var nowDay = nowDate.getDate()
  1140. var hours = nowDate.getHours()
  1141. var min = nowDate.getMinutes()
  1142. var nowTime =
  1143. nowYear +
  1144. '-' +
  1145. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1146. '-' +
  1147. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1148. ':' + (min < 10 ? '0' + min : min)
  1149. this.prescriptions[i]['pre_time'] = nowTime
  1150. this.prescriptions[i].name = '处方' + (i + 1)
  1151. if (i == 0) {
  1152. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1153. this.customTabIndex = 1
  1154. this.curStatus = 1
  1155. this.rightTab = 1
  1156. this.showOne = true
  1157. this.showTwo = false
  1158. }
  1159. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1160. this.customTabIndex = 2
  1161. this.curStatus = 2
  1162. this.rightTab = 2
  1163. this.showTwo = true
  1164. this.showOne = false
  1165. }
  1166. }
  1167. }
  1168. this.curPrescriptions = this.prescriptions[0]
  1169. this.$refs.call_prescription.close()
  1170. this.$emit('setData', this.prescriptions)
  1171. },
  1172. callCancel() {
  1173. this.$refs.call_prescription.close()
  1174. },
  1175. cancel() {
  1176. this.$refs.next_or_last_prescription.close()
  1177. this.request_record_date = this.record_date
  1178. },
  1179. setValue(val) {
  1180. this.prescriptions = []
  1181. this.prescriptions = val
  1182. this.$refs.next_or_last_prescription.close()
  1183. var nowDate = new Date()
  1184. var nowYear = nowDate.getFullYear()
  1185. var nowMonth = nowDate.getMonth() + 1
  1186. var nowDay = nowDate.getDate()
  1187. var hours = nowDate.getHours()
  1188. var min = nowDate.getMinutes()
  1189. var nowTime =
  1190. nowYear +
  1191. '-' +
  1192. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1193. '-' +
  1194. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1195. ':' + (min < 10 ? '0' + min : min)
  1196. for (let i = 0; i < this.prescriptions.length; i++) {
  1197. this.prescriptions[i].name = '处方' + (i + 1)
  1198. this.prescriptions[i]['pre_time'] = nowTime
  1199. if (i == 0) {
  1200. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1201. this.customTabIndex = 1
  1202. this.curStatus = 1
  1203. this.rightTab = 1
  1204. this.showOne = true
  1205. this.showTwo = false
  1206. }
  1207. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1208. this.customTabIndex = 2
  1209. this.curStatus = 2
  1210. this.rightTab = 2
  1211. this.showTwo = true
  1212. this.showOne = false
  1213. }
  1214. }
  1215. }
  1216. this.curPrescriptions = this.prescriptions[0]
  1217. this.request_record_date = this.record_date
  1218. this.$emit('setData', this.prescriptions)
  1219. },
  1220. GetNextOrLastHisPrescription(params) {
  1221. getNextOrLastHisPrescription(params).then(response => {
  1222. if (response.data.state == 1) {
  1223. if (this.dayorMonth == 'day') {
  1224. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  1225. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  1226. } else {
  1227. this.$message.error('当前处于月结,无法使用上一方或下一方功能')
  1228. }
  1229. } else {
  1230. this.$message.error(response.data.msg)
  1231. }
  1232. })
  1233. },
  1234. openLast(val) {
  1235. // if (this.curPrescriptions.order_status == 2) {
  1236. // this.$message.error('处方已经结算,无法添加')
  1237. // return
  1238. // }
  1239. if (this.patientInfo.id == 0) {
  1240. this.$message.error('请选择患者')
  1241. return
  1242. }
  1243. if (val == 1) {
  1244. this.isVisibility = false
  1245. this.request_record_date = this.record_date
  1246. let params = {
  1247. patient_id: this.patientInfo.id,
  1248. record_time: this.request_record_date,
  1249. type: 1,
  1250. p_type: 2
  1251. }
  1252. this.GetNextOrLastHisPrescription(params)
  1253. } else if (val == 3) {
  1254. let params = {
  1255. patient_id: this.patientInfo.id,
  1256. record_time: this.request_record_date,
  1257. type: 1,
  1258. p_type: 2
  1259. }
  1260. this.GetNextOrLastHisPrescription(params)
  1261. }
  1262. },
  1263. openNext(val) {
  1264. // if (this.curPrescriptions.order_status == 2) {
  1265. // this.$message.error('处方已经结算,无法添加')
  1266. // return
  1267. // }
  1268. if (this.patientInfo.id == 0) {
  1269. this.$message.error('请选择患者')
  1270. return
  1271. }
  1272. if (val == 2) {
  1273. this.isVisibility = false
  1274. this.request_record_date = this.record_date
  1275. let params = {
  1276. patient_id: this.patientInfo.id,
  1277. record_time: this.request_record_date,
  1278. type: 2,
  1279. p_type: 2
  1280. }
  1281. this.GetNextOrLastHisPrescription(params)
  1282. } else if (val == 4) {
  1283. let params = {
  1284. patient_id: this.patientInfo.id,
  1285. record_time: this.request_record_date,
  1286. type: 2,
  1287. p_type: 2
  1288. }
  1289. this.GetNextOrLastHisPrescription(params)
  1290. }
  1291. },
  1292. selectTemplate(selection, row) {
  1293. this.tempDrugs = selection
  1294. }, changeTemplateData(selection) {
  1295. this.tempDrugs = selection
  1296. },
  1297. stockInCount: function(row) {
  1298. let total = 0
  1299. if (row.stock_in != null) {
  1300. for (let i = 0; i < row.stock_in.length; i++) {
  1301. total = total + row.stock_in[i].warehousing_count
  1302. }
  1303. }
  1304. return total
  1305. },
  1306. salesReturnCount: function(row) {
  1307. let total = 0
  1308. if (row.sales_return != null) {
  1309. for (let i = 0; i < row.sales_return.length; i++) {
  1310. total = total + row.sales_return[i].count
  1311. }
  1312. }
  1313. return total
  1314. },
  1315. stockOutCount: function(row) {
  1316. let total = 0
  1317. if (row.stock_out != null) {
  1318. for (let i = 0; i < row.stock_out.length; i++) {
  1319. total = total + row.stock_out[i].count
  1320. }
  1321. }
  1322. return total
  1323. },
  1324. cancelStockCount: function(row) {
  1325. let total = 0
  1326. if (row.cancel_stock != null) {
  1327. for (let i = 0; i < row.cancel_stock.length; i++) {
  1328. total = total + row.cancel_stock[i].count
  1329. }
  1330. }
  1331. return total
  1332. },
  1333. setCharge(additional_charges) {
  1334. for (let i = 0; i < additional_charges.length; i++) {
  1335. additional_charges[i].count = 1
  1336. this.curPrescriptions.addition.push(additional_charges[i])
  1337. }
  1338. this.$refs.additionalCharges.hide()
  1339. }, searchProjectAction() {
  1340. console.log("~~~~")
  1341. console.log(this.allProject)
  1342. if (this.search_project_keyword.length == 0) {
  1343. this.tabProject = this.allProject
  1344. } else {
  1345. let arr = []
  1346. for (let i = 0; i < this.allProject.length; i++) {
  1347. if (this.allProject[i].project_name.indexOf(this.search_project_keyword) != -1) {
  1348. arr = arr.concat(this.allProject[i])
  1349. }
  1350. }
  1351. this.tabProject = arr
  1352. }
  1353. },
  1354. searchAction() {
  1355. if (this.search_keyword.length == 0) {
  1356. this.drugs = this.allDrugs
  1357. } else {
  1358. let arr = []
  1359. for (let i = 0; i < this.drugs.length; i++) {
  1360. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1 || this.drugs[i].wubi.indexOf(this.search_keyword) != -1 || this.drugs[i].pinyin.indexOf(this.search_keyword) != -1) {
  1361. arr = arr.concat(this.drugs[i])
  1362. }
  1363. }
  1364. this.drugs = arr
  1365. }
  1366. },
  1367. getTotalOne() {
  1368. var total = 0
  1369. for (let i = 0; i < this.prescriptions.length; i++) {
  1370. if (this.prescriptions[i].name == this.editableTabsValue) {
  1371. if (this.prescriptions[i].advices != null) {
  1372. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1373. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1374. }
  1375. }
  1376. if (this.prescriptions[i].project != null) {
  1377. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1378. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1379. }
  1380. }
  1381. if (this.prescriptions[i].addition != null) {
  1382. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1383. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1384. }
  1385. }
  1386. total = Math.floor(total * 100) / 100
  1387. }
  1388. }
  1389. return total
  1390. }, getTotalTwo() {
  1391. var total = 0
  1392. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1393. if (this.month_prescriptions[i].name == this.editableTabsValueTwo) {
  1394. if (this.month_prescriptions[i].advices != null) {
  1395. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1396. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1397. }
  1398. }
  1399. if (this.month_prescriptions[i].project != null) {
  1400. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1401. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1402. }
  1403. }
  1404. if (this.month_prescriptions[i].addition != null) {
  1405. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1406. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1407. }
  1408. }
  1409. total = Math.floor(total * 100) / 100
  1410. }
  1411. }
  1412. return total
  1413. },
  1414. getCurTotal() {
  1415. var total = 0
  1416. if (this.curPrescriptions.type == 1) {
  1417. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1418. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  1419. }
  1420. return Math.floor(total * 100) / 100
  1421. } else {
  1422. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1423. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  1424. }
  1425. return Math.floor(total * 100) / 100
  1426. }
  1427. },
  1428. getTotal() {
  1429. var total = 0
  1430. for (let i = 0; i < this.prescriptions.length; i++) {
  1431. if (this.prescriptions[i].advices != null) {
  1432. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1433. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1434. }
  1435. }
  1436. if (this.prescriptions[i].project != null) {
  1437. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1438. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1439. }
  1440. }
  1441. if (this.prescriptions[i].addition != null) {
  1442. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1443. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1444. }
  1445. }
  1446. }
  1447. return Math.floor(total * 100) / 100
  1448. }, getMonthTotal() {
  1449. var total = 0
  1450. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1451. if (this.month_prescriptions[i].advices != null) {
  1452. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1453. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1454. }
  1455. }
  1456. if (this.month_prescriptions[i].project != null) {
  1457. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1458. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1459. }
  1460. }
  1461. if (this.month_prescriptions[i].addition != null) {
  1462. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1463. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1464. }
  1465. }
  1466. }
  1467. return Math.floor(total * 100) / 100
  1468. },
  1469. createFilter(queryString) {
  1470. return (restaurant) => {
  1471. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  1472. }
  1473. },
  1474. querySearch2(queryString, cb) {
  1475. var restaurants = this.other_sick
  1476. restaurants.map(item => {
  1477. item.value = item.name
  1478. })
  1479. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  1480. // 调用 callback 返回建议列表的数据
  1481. cb(results)
  1482. },
  1483. changeKind(val) {
  1484. this.drugs = []
  1485. if (val == 0) {
  1486. this.drugs = this.allDrugs
  1487. } else {
  1488. for (let i = 0; i < this.allDrugs.length; i++) {
  1489. if (this.allDrugs[i].drug_type == val) {
  1490. this.drugs.push(this.allDrugs[i])
  1491. }
  1492. }
  1493. }
  1494. },
  1495. getDictionaryDataConfig(module, filed_name) {
  1496. return getDictionaryDataConfig(module, filed_name)
  1497. },
  1498. getInitData() {
  1499. getInitData().then(response => {
  1500. if (response.data.state == 0) {
  1501. this.$message.error(response.data.msg)
  1502. return false
  1503. } else {
  1504. this.drugs = response.data.data.drugs
  1505. this.allDrugs = response.data.data.drugs
  1506. this.advices_template = response.data.data.advices_template
  1507. this.doctors = response.data.data.doctors
  1508. for (let i = 0; i < this.doctors.length; i++) {
  1509. if (this.doctors[i].user_type == 1) {
  1510. this.doctors.splice(i, 1)
  1511. }
  1512. }
  1513. this.department = response.data.data.department
  1514. this.sick = response.data.data.sick
  1515. this.diagnoses = response.data.data.diagnose
  1516. this.additions = response.data.data.additions
  1517. // var info = response.data.data.info
  1518. // if (info.user_type == 2 || info.user_type == 1) {
  1519. // this.doctorValue = info.admin_user_id
  1520. // if (info.department_id == 0) {
  1521. // if (this.department.length > 0) {
  1522. // this.departmentValue = this.department[0].id
  1523. // } else {
  1524. // this.departmentValue = ''
  1525. //
  1526. // }
  1527. // } else {
  1528. // this.departmentValue = info.department_id
  1529. // }
  1530. // }else{
  1531. // this.doctorValue = this.doctors[0].admin_user_id
  1532. // }
  1533. }
  1534. })
  1535. },
  1536. monthTabclickEvent(val) {
  1537. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1538. if (this.month_prescriptions[i].name == val.name) {
  1539. if (this.dayorMonth == 'month') {
  1540. if (this.isShowDayPrescription) {
  1541. this.curDayPrescriptions = this.month_prescriptions[i]
  1542. //用来区分处方属于项目还是药品
  1543. if (this.curDayPrescriptions.advices.length > 0 && this.curDayPrescriptions.project.length == 0) {
  1544. this.monthCustomTabIndex = 1
  1545. }
  1546. if (this.curDayPrescriptions.advices.length == 0 && this.curDayPrescriptions.project.length > 0) {
  1547. this.monthCustomTabIndex = 2
  1548. }
  1549. } else {
  1550. this.curMonthPrescriptions = this.month_prescriptions[i]
  1551. //用来区分处方属于项目还是药品
  1552. if (this.curMonthPrescriptions.advices.length > 0 && this.curMonthPrescriptions.project.length == 0) {
  1553. this.monthCustomTabIndex = 1
  1554. }
  1555. if (this.curMonthPrescriptions.advices.length == 0 && this.curMonthPrescriptions.project.length > 0) {
  1556. this.monthCustomTabIndex = 2
  1557. }
  1558. }
  1559. }
  1560. this.teamList = []
  1561. this.curDrugs = []
  1562. this.$refs.multipleTable.clearSelection()
  1563. this.$refs.tables.clearSelection()
  1564. }
  1565. }
  1566. },
  1567. tabclickEvent(val) {
  1568. for (let i = 0; i < this.prescriptions.length; i++) {
  1569. if (this.prescriptions[i].name == val.name) {
  1570. this.prescription_id = this.prescriptions[i].id
  1571. this.$emit('event1', this.prescription_id)
  1572. this.curPrescriptions = this.prescriptions[i]
  1573. this.teamList = []
  1574. this.curDrugs = []
  1575. this.$refs.multipleTable.clearSelection()
  1576. this.$refs.tables.clearSelection()
  1577. //用来区分处方属于项目还是药品
  1578. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1579. this.customTabIndex = 1
  1580. this.curStatus = 1
  1581. this.rightTab = 1
  1582. this.showOne = true
  1583. this.showTwo = false
  1584. }
  1585. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1586. this.customTabIndex = 2
  1587. this.curStatus = 2
  1588. this.rightTab = 2
  1589. this.showTwo = true
  1590. this.showOne = false
  1591. }
  1592. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1593. this.customTabIndex = this.rightTab
  1594. this.curStatus = 0
  1595. }
  1596. }
  1597. }
  1598. if (this.curPrescriptions.order_status == 0) {
  1599. this.order_status = ''
  1600. }
  1601. if (this.curPrescriptions.order_status == 1) {
  1602. this.order_status = '未收费'
  1603. }
  1604. if (this.curPrescriptions.order_status == 2) {
  1605. this.order_status = '已结算'
  1606. }
  1607. if (this.curPrescriptions.order_status == 3) {
  1608. this.order_status = '已退费'
  1609. }
  1610. },
  1611. clearData() {
  1612. this.curPrescriptions = []
  1613. this.curStatus = 0
  1614. this.curDrugs = []
  1615. this.preDrugs = []
  1616. this.teamList = []
  1617. },
  1618. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data) {
  1619. this.curMonthPrescriptions = {}
  1620. this.curPrescriptions = {}
  1621. console.log(doctors)
  1622. for (let i = 0; i < doctors.length; i++) {
  1623. if (doctors[i].user_type == 1) {
  1624. doctors.splice(i, 1)
  1625. }
  1626. }
  1627. this.prescription_id = data[0].id
  1628. this.editableTabsValue = '处方1'
  1629. this.dayorMonth = 'day'
  1630. this.$emit('event1', this.prescription_id)
  1631. this.curStatus = 0
  1632. if (month_data && month_data.length > 0) {
  1633. this.curMonthPrescriptions = month_data[0]
  1634. } else {
  1635. this.curMonthPrescriptions = {}
  1636. }
  1637. if (data && data.length > 0) {
  1638. this.curPrescriptions = data[0]
  1639. } else {
  1640. this.curPrescriptions = {}
  1641. }
  1642. this.diagnose = info.diagnosis
  1643. if (this.diagnose == 0) {
  1644. this.diagnose = ""
  1645. for (let i = 0; i < this.diagnoses.length; i++) {
  1646. this.diagnose = this.diagnoses[0].id
  1647. }
  1648. }
  1649. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1650. this.curStatus = 1
  1651. this.customTabIndex = 1
  1652. this.rightTab = 1
  1653. this.showOne = true
  1654. this.showTwo = false
  1655. }
  1656. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  1657. this.curStatus = 2
  1658. this.customTabIndex = 2
  1659. this.rightTab = 2
  1660. this.showOne = false
  1661. this.showTwo = true
  1662. }
  1663. this.state1 = info.sick_type
  1664. if (this.state1 == 0) {
  1665. this.state1 = ''
  1666. for (let i = 0; i < this.sick.length; i++) {
  1667. this.state1 = this.sick[0].id
  1668. }
  1669. }
  1670. this.state2 = info.sick_history
  1671. if (this.state2 == 0) {
  1672. this.state2 = ''
  1673. }
  1674. if (info.prescription_status == 0) {
  1675. this.order_status = ''
  1676. }
  1677. if (this.curPrescriptions.order_status == 1) {
  1678. this.order_status = '未收费'
  1679. }
  1680. if (this.curPrescriptions.order_status == 2) {
  1681. this.order_status = '已结算'
  1682. }
  1683. if (this.curPrescriptions.order_status == 3) {
  1684. this.order_status = '已退费'
  1685. }
  1686. if (info.id > 0) {
  1687. this.doctorValue = info.doctor_id
  1688. this.departmentValue = info.departments
  1689. } else {
  1690. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  1691. this.doctorValue = hisPatientInfo.doctor
  1692. this.departmentValue = hisPatientInfo.department
  1693. } else {
  1694. if (admin_info.user_type == 2) {
  1695. this.doctorValue = admin_info.admin_user_id
  1696. if (admin_info.department_id == 0) {
  1697. if (this.department.length > 0) {
  1698. if (department && department.length > 0) {
  1699. this.departmentValue = department[0].id
  1700. } else {
  1701. this.departmentValue = ''
  1702. }
  1703. } else {
  1704. this.departmentValue = ''
  1705. }
  1706. } else {
  1707. this.departmentValue = admin_info.department_id
  1708. }
  1709. } else {
  1710. this.doctorValue = doctors[0].admin_user_id
  1711. }
  1712. if (this.doctorValue == 0) {
  1713. this.doctorValue = ''
  1714. }
  1715. }
  1716. }
  1717. console.log(info.register_type)
  1718. if (info.register_type == 0) {
  1719. for (let i = 0; i < this.register.length; i++) {
  1720. this.register_type = this.register[0].value
  1721. }
  1722. } else {
  1723. this.register_type = info.register_type
  1724. }
  1725. if (this.diagnose == 0) {
  1726. this.diagnose = ""
  1727. }
  1728. },
  1729. moreState(tab, event) {
  1730. if (tab == 'more') {
  1731. return false
  1732. }
  1733. }, open_three() {
  1734. for (let i = 0; i < this.prescriptions.length; i++) {
  1735. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1736. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  1737. this.$message.error('药品处方总量不能为0')
  1738. return
  1739. }
  1740. }
  1741. }
  1742. for (let i = 0; i < this.prescriptions.length; i++) {
  1743. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1744. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  1745. this.$message.error('项目处方总量不能为0')
  1746. return
  1747. }
  1748. }
  1749. }
  1750. this.$refs.saveTemplate.show(this.prescriptions)
  1751. }, open_two() {
  1752. if (this.dayorMonth == 'day') {
  1753. if (this.patientInfo == null || this.patientInfo.id == 0) {
  1754. this.$message.error('请选择患者')
  1755. return
  1756. }
  1757. let params = {
  1758. end_time: this.record_date,
  1759. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1760. patient_id: this.patientInfo.id,
  1761. p_type: 2
  1762. }
  1763. getCallHisPrescription(params).then(response => {
  1764. if (response.data.state == 1) {
  1765. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  1766. } else {
  1767. this.$message.error(response.data.msg)
  1768. }
  1769. })
  1770. } else {
  1771. this.$message.error('当前属于月结状态,无法试用处方调用')
  1772. }
  1773. },
  1774. open(index, isLoading) {
  1775. if (this.dayorMonth == 'day') {
  1776. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  1777. this.$message.error('请先开处方')
  1778. return
  1779. }
  1780. }
  1781. if (this.dayorMonth == 'day') {
  1782. if (this.curPrescriptions.order_status == 2) {
  1783. this.$message.error('当前处方已经结算,无法保存')
  1784. return
  1785. }
  1786. if (this.doctorValue.length <= 0) {
  1787. this.$message.error('医生不能为空')
  1788. return
  1789. }
  1790. if (this.departmentValue.length <= 0) {
  1791. this.$message.error('科室不能为空')
  1792. return
  1793. }
  1794. if (this.state1 <= 0) {
  1795. this.$message.error('疾病类型不能为空')
  1796. return
  1797. }
  1798. for (let i = 0; i < this.prescriptions.length; i++) {
  1799. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1800. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  1801. this.$message.error('药品处方总量不能为0')
  1802. return
  1803. }
  1804. }
  1805. }
  1806. for (let i = 0; i < this.prescriptions.length; i++) {
  1807. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1808. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  1809. this.$message.error('项目处方总量不能为0')
  1810. return
  1811. }
  1812. }
  1813. }
  1814. if (index == 1) {
  1815. let params = {
  1816. p_type: 2,
  1817. patient_id: this.patientInfo.id,
  1818. diagnose: this.diagnose,
  1819. sick_type: this.state1,
  1820. sick_history: this.state2,
  1821. doctor: this.doctorValue,
  1822. department: this.departmentValue,
  1823. record_date: this.record_date,
  1824. his_patient_id: this.hisPatientInfo.id,
  1825. reg_type: this.register_type
  1826. }
  1827. for (let i = 0; i < this.prescriptions.length; i++) {
  1828. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  1829. this.prescriptions[i]['type'] = 1
  1830. }
  1831. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  1832. this.prescriptions[i]['type'] = 2
  1833. }
  1834. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1835. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  1836. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  1837. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  1838. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  1839. }
  1840. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1841. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  1842. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  1843. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  1844. this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
  1845. }
  1846. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1847. this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
  1848. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  1849. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  1850. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  1851. }
  1852. }
  1853. let data = {
  1854. 'prescriptions': this.prescriptions
  1855. }
  1856. isLoading = true
  1857. createHisPrescription(data, params).then(response => {
  1858. if (response.data.state == 1) {
  1859. this.$emit('change', this.patientInfo.id)
  1860. this.$message.success('保存成功')
  1861. } else {
  1862. this.$message.error(response.data.msg)
  1863. }
  1864. })
  1865. } else if (index == 2) {
  1866. this.$router.push('/outpatientDoctorStation/print')
  1867. } else if (index == 4) {
  1868. } else if (index == 5) {
  1869. this.$refs.saveTemplate.show()
  1870. }
  1871. } else if (this.dayorMonth == 'month') {
  1872. if (this.isShowDayPrescription) {
  1873. // if (this.curDayPrescriptions.order_status == 2) {
  1874. // this.$message.error('当前处方已经结算,无法保存')
  1875. // return
  1876. // }
  1877. if (this.doctorValue.length <= 0) {
  1878. this.$message.error('医生不能为空')
  1879. return
  1880. }
  1881. if (this.departmentValue.length <= 0) {
  1882. this.$message.error('科室不能为空')
  1883. return
  1884. }
  1885. if (index == 1) {
  1886. let params = {
  1887. patient_id: this.patientInfo.id,
  1888. diagnose: this.diagnose,
  1889. sick_type: this.state1,
  1890. sick_history: this.state2,
  1891. doctor: this.doctorValue,
  1892. department: this.departmentValue,
  1893. record_date: this.end_time,
  1894. his_patient_id: this.hisPatientInfo.id,
  1895. reg_type: this.register_type,
  1896. p_type: 2
  1897. }
  1898. var month_prescriptions = this.deepClone(this.month_prescriptions)
  1899. for (let i = 0; i < month_prescriptions.length; i++) {
  1900. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  1901. month_prescriptions[i]['type'] = 1
  1902. }
  1903. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  1904. month_prescriptions[i]['type'] = 2
  1905. }
  1906. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  1907. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  1908. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  1909. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  1910. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  1911. }
  1912. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  1913. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  1914. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  1915. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  1916. }
  1917. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  1918. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  1919. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  1920. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  1921. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  1922. }
  1923. }
  1924. let data = {
  1925. 'prescriptions': month_prescriptions
  1926. }
  1927. editHisPrescription(data, params).then(response => {
  1928. if (response.data.state == 1) {
  1929. this.month_prescriptions = month_prescriptions
  1930. this.$message.success('编辑成功')
  1931. }
  1932. })
  1933. }
  1934. }
  1935. }
  1936. },
  1937. addTab(targetName) {
  1938. // if (this.curPrescriptions.order_status == 2) {
  1939. // this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  1940. // return
  1941. // }
  1942. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1943. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  1944. return
  1945. }
  1946. this.tabIndex = this.prescriptions.length
  1947. ++this.tabIndex
  1948. let newTabName = '处方' + this.tabIndex
  1949. var nowDate = new Date()
  1950. var nowYear = nowDate.getFullYear()
  1951. var nowMonth = nowDate.getMonth() + 1
  1952. var nowDay = nowDate.getDate()
  1953. var hours = nowDate.getHours()
  1954. var min = nowDate.getMinutes()
  1955. var nowTime =
  1956. nowYear +
  1957. '-' +
  1958. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1959. '-' +
  1960. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1961. ':' + (min < 10 ? '0' + min : min)
  1962. this.prescriptions.push({
  1963. id: 0,
  1964. name: newTabName,
  1965. order_status: 0,
  1966. advices: [],
  1967. project: [],
  1968. addition: [],
  1969. pre_time: this.prescriptions[0].pre_time
  1970. // pre_time: nowTime
  1971. })
  1972. this.editableTabsValue = newTabName
  1973. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  1974. this.curStatus = 0
  1975. if (this.curPrescriptions.order_status == 0) {
  1976. this.order_status = '未收费'
  1977. }
  1978. if (this.curPrescriptions.order_status == 1) {
  1979. this.order_status = '未收费'
  1980. }
  1981. if (this.curPrescriptions.order_status == 2) {
  1982. this.order_status = '已结算'
  1983. }
  1984. if (this.curPrescriptions.order_status == 3) {
  1985. this.order_status = '已退费'
  1986. }
  1987. },
  1988. removeTab(targetName) {
  1989. if (this.curPrescriptions.order_status == 2) {
  1990. this.$message.error('该处方已经结算,无法删除')
  1991. return
  1992. }
  1993. if (targetName == '处方1') {
  1994. this.$message.error('该处方无法删除')
  1995. return
  1996. }
  1997. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  1998. confirmButtonText: '确 定',
  1999. cancelButtonText: '取 消',
  2000. type: 'warning'
  2001. }).then(() => {
  2002. let id = 0
  2003. for (let i = 0; i < this.prescriptions.length; i++) {
  2004. if (this.prescriptions[i].name == targetName) {
  2005. id = this.prescriptions[i].id
  2006. }
  2007. }
  2008. if (id == 0) {
  2009. let tabs = this.prescriptions
  2010. let activeName = this.editableTabsValue
  2011. if (activeName === targetName) {
  2012. tabs.forEach((tab, index) => {
  2013. if (tab.name === targetName) {
  2014. let nextTab = tabs[index + 1] || tabs[index - 1]
  2015. if (nextTab) {
  2016. activeName = nextTab.name
  2017. }
  2018. }
  2019. })
  2020. }
  2021. this.editableTabsValue = activeName
  2022. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2023. for (let i = 0; i < this.prescriptions.length; i++) {
  2024. if (activeName == this.prescriptions[i].name) {
  2025. this.curPrescriptions = this.prescriptions[i]
  2026. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2027. this.curStatus = 1
  2028. }
  2029. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2030. this.curStatus = 2
  2031. }
  2032. }
  2033. }
  2034. if (this.prescriptions.length == 0) {
  2035. this.curPrescriptions = []
  2036. this.curStatus = 0
  2037. }
  2038. } else {
  2039. let params = {
  2040. 'id': id
  2041. }
  2042. delHisPrescription(params).then(response => {
  2043. if (response.data.state == 1) {
  2044. this.$message.success('删除成功')
  2045. let tabs = this.prescriptions
  2046. let activeName = this.editableTabsValue
  2047. if (activeName === targetName) {
  2048. tabs.forEach((tab, index) => {
  2049. if (tab.name === targetName) {
  2050. let nextTab = tabs[index + 1] || tabs[index - 1]
  2051. if (nextTab) {
  2052. activeName = nextTab.name
  2053. }
  2054. }
  2055. })
  2056. }
  2057. this.editableTabsValue = activeName
  2058. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2059. for (let i = 0; i < this.prescriptions.length; i++) {
  2060. if (activeName == this.prescriptions[i].name) {
  2061. this.curPrescriptions = this.prescriptions[i]
  2062. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2063. this.curStatus = 1
  2064. }
  2065. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2066. this.curStatus = 2
  2067. }
  2068. }
  2069. }
  2070. if (this.prescriptions.length == 0) {
  2071. this.curPrescriptions = []
  2072. this.curStatus = 0
  2073. }
  2074. } else {
  2075. this.$message.success(response.data.msg)
  2076. }
  2077. })
  2078. }
  2079. }).catch(() => {
  2080. })
  2081. },
  2082. beforeLeave(activeName, oldActiveName) {
  2083. let index = activeName
  2084. if (index == 1) {
  2085. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2086. return false
  2087. }
  2088. } else {
  2089. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2090. return false
  2091. }
  2092. }
  2093. },
  2094. clickTab(tab) {
  2095. let index = parseInt(tab.name)
  2096. if (index == 1) {
  2097. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2098. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  2099. return
  2100. }
  2101. } else {
  2102. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2103. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  2104. return
  2105. }
  2106. }
  2107. if (index == 1) {
  2108. this.teamList = []
  2109. this.$refs.tables.clearSelection()
  2110. this.showOne = true
  2111. this.showTwo = false
  2112. this.$nextTick(() => {
  2113. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2114. })
  2115. this.customTabIndex = 1
  2116. }
  2117. if (index == 2) {
  2118. this.curDrugs = []
  2119. this.$refs.multipleTable.clearSelection()
  2120. this.showTwo = true
  2121. this.showOne = false
  2122. this.$nextTick(() => {
  2123. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2124. })
  2125. this.customTabIndex = 2
  2126. }
  2127. this.rightTab = index
  2128. //用来区分处方属于项目还是药品
  2129. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2130. this.customTabIndex = 1
  2131. this.curStatus = 1
  2132. }
  2133. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2134. this.customTabIndex = 2
  2135. this.curStatus = 2
  2136. }
  2137. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  2138. // this.customTabIndex = this.rightTab
  2139. this.customTabIndex = index
  2140. this.curStatus = 0
  2141. }
  2142. }, changeAllGoodInfoTableData: function(selection) {
  2143. this.curDrugs = selection
  2144. }, addCharges() {
  2145. this.$refs.additionalCharges.show()
  2146. },
  2147. selectDrugs(selection, row) {
  2148. this.curDrugs = selection
  2149. },
  2150. comfirm() {
  2151. // if (this.curPrescriptions.order_status == 2) {
  2152. // this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  2153. // this.teamList = []
  2154. // this.curDrugs = []
  2155. // this.tempDrugs = []
  2156. // this.$refs.tables.clearSelection()
  2157. // this.$refs.multipleTableTwo.clearSelection()
  2158. // this.$refs.multipleTable.clearSelection()
  2159. // return
  2160. // }
  2161. if (this.curStatus == 1 && this.rightTab == 2) {
  2162. this.$message.error('改处方是药品,无法添加项目')
  2163. this.teamList = []
  2164. this.$refs.tables.clearSelection()
  2165. return
  2166. }
  2167. if (this.curStatus == 2 && this.rightTab == 1) {
  2168. this.$message.error('改处方是项目,无法添加药品')
  2169. this.curDrugs = []
  2170. this.tempDrugs = []
  2171. this.$refs.multipleTable.clearSelection()
  2172. this.$refs.multipleTableTwo.clearSelection()
  2173. return
  2174. }
  2175. for (let i = 0; i < this.teamList.length; i++) {
  2176. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  2177. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  2178. this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  2179. return
  2180. }
  2181. }
  2182. }
  2183. for (let i = 0; i < this.curDrugs.length; i++) {
  2184. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2185. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  2186. this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  2187. return
  2188. }
  2189. }
  2190. }
  2191. let templateDrugs = []
  2192. for (let i = 0; i < this.tempDrugs.length; i++) {
  2193. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  2194. templateDrugs.push(this.tempDrugs[i].advices[a])
  2195. }
  2196. }
  2197. // for (let i = 0; i < templateDrugs.length; i++) {
  2198. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2199. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  2200. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  2201. // return
  2202. //
  2203. // }
  2204. // }
  2205. // }
  2206. for (let i = 0; i < this.prescriptions.length; i++) {
  2207. if (this.prescriptions[i].name == this.editableTabsValue) {
  2208. var temp = this.deepClone(this.curDrugs)
  2209. var temp2 = this.deepClone(this.teamList)
  2210. var temp3 = this.deepClone(templateDrugs)
  2211. if (temp3.length > 0) {
  2212. for (let b = 0; b < temp3.length; b++) {
  2213. let obj = {
  2214. advice_id: 0,
  2215. id: temp3[b].id,
  2216. drug_name: temp3[b].advice_name,
  2217. single_dose: temp3[b].single_dose.toString(),
  2218. delivery_way: temp3[b].delivery_way,
  2219. execution_frequency: temp3[b].execution_frequency,
  2220. retail_price: temp3[b].drug.retail_price.toString(),
  2221. remark: '',
  2222. day: "1",
  2223. prescribing_number: temp3[b].prescribing_number,
  2224. single_dose_unit: temp3[b].drug.min_unit,
  2225. prescribing_number_unit: temp3[b].drug.max_unit,
  2226. medical_insurance_number: temp3[b].drug.medical_insurance_number
  2227. }
  2228. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2229. obj.prescribing_number = 1
  2230. }
  2231. this.prescriptions[i].advices.push(obj)
  2232. }
  2233. this.curStatus = 1
  2234. }
  2235. if (temp.length > 0) {
  2236. for (let b = 0; b < temp.length; b++) {
  2237. let obj = {
  2238. advice_id: 0,
  2239. id: temp[b].id,
  2240. drug_name: temp[b].drug_name,
  2241. single_dose: temp[b].single_dose,
  2242. delivery_way: temp[b].delivery_way,
  2243. execution_frequency: temp[b].execution_frequency,
  2244. retail_price: temp[b].retail_price.toString(),
  2245. remark: '',
  2246. day: temp[b].drug_day ? temp[b].drug_day : 1,
  2247. prescribing_number: temp[b].prescribing_number,
  2248. single_dose_unit: temp[b].min_unit,
  2249. prescribing_number_unit: temp[b].max_unit,
  2250. medical_insurance_number: temp[b].medical_insurance_number,
  2251. drug: temp[b]
  2252. }
  2253. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2254. obj.prescribing_number = 1
  2255. }
  2256. console.log('obj',obj)
  2257. this.prescriptions[i].advices.push(obj)
  2258. }
  2259. this.curStatus = 1
  2260. }
  2261. // if(this.activeName == 2){
  2262. //
  2263. // for(let i = 0; i<temp2.length;i++){
  2264. // for(let j=0;j<this.hisList.length;j++){
  2265. // if(temp2[i].id == this.hisList[j].project_id){
  2266. // temp2[i].total = this.hisList[j].number
  2267. // }
  2268. // }
  2269. // }
  2270. // }
  2271. if (temp2.length > 0) {
  2272. for (let b = 0; b < temp2.length; b++) {
  2273. let obj = {
  2274. id: 0,
  2275. project_id: temp2[b].id,
  2276. project_name: temp2[b].project_name,
  2277. statistical_classification: temp2[b].statistical_classification,
  2278. single_dose: temp2[b].single_dose.toString(),
  2279. delivery_way: temp2[b].delivery_way,
  2280. execution_frequency: temp2[b].execution_frequency,
  2281. number_days: temp2[b].number_days.toString(),
  2282. total: temp2[b].total,
  2283. price: temp2[b].price,
  2284. remark: '',
  2285. medical_code: temp2[b].medical_code,
  2286. unit: temp2[b].unit,
  2287. type: temp2[b].type
  2288. }
  2289. if (obj.total == 0 || obj.total == undefined) {
  2290. obj.total = 1
  2291. }
  2292. if (obj.type == 3) {
  2293. obj.single_dose = 1
  2294. }
  2295. this.prescriptions[i].project.push(obj)
  2296. }
  2297. this.curStatus = 2
  2298. }
  2299. this.curPrescriptions = this.prescriptions[i]
  2300. this.$refs.multipleTable.clearSelection()
  2301. this.$refs.tables.clearSelection()
  2302. }
  2303. }
  2304. this.curDrugs = []
  2305. this.preDrugs = []
  2306. this.teamList = []
  2307. }, changeAllGoodInfoTableDataTwo(row) {
  2308. this.teamList = row
  2309. },
  2310. selectChange(row) {
  2311. this.teamList = row
  2312. },
  2313. getlist() {
  2314. this.tabProject = []
  2315. getHisProject().then(response => {
  2316. if (response.data.state == 1) {
  2317. var project = response.data.data.project
  2318. for (let i = 0; i < project.length; i++) {
  2319. let obj = {
  2320. id: project[i].id,
  2321. project_name: project[i].project_name,
  2322. statistical_classification: project[i].statistical_classification,
  2323. single_dose: project[i].single_dose,
  2324. delivery_way: project[i].delivery_way,
  2325. execution_frequency: project[i].execution_frequency,
  2326. number_days: project[i].number_days,
  2327. price: project[i].price,
  2328. medical_code: project[i].medical_code,
  2329. unit: project[i].unit,
  2330. type: 2
  2331. }
  2332. this.tabProject.push(obj)
  2333. }
  2334. var good_info = response.data.data.good_info
  2335. for (let i = 0; i < good_info.length; i++) {
  2336. let obj = {
  2337. id: good_info[i].id,
  2338. project_name: good_info[i].good_name,
  2339. statistical_classification: 0,
  2340. single_dose: 1,
  2341. delivery_way: '',
  2342. execution_frequency: '',
  2343. number_days: 1,
  2344. price: good_info[i].retail_price,
  2345. medical_code: good_info[i].medical_insurance_number,
  2346. unit: this.getGoodUnit(good_info[i].good_unit),
  2347. type: 3
  2348. }
  2349. this.tabProject.push(obj)
  2350. }
  2351. this.allProject = this.tabProject
  2352. }
  2353. })
  2354. }, deepClone(source) {
  2355. if (!source && typeof source !== 'object') {
  2356. throw new Error('error arguments', 'shallowClone')
  2357. }
  2358. const targetObj = source.constructor === Array ? [] : {}
  2359. Object.keys(source).forEach((keys) => {
  2360. if (source[keys] && typeof source[keys] === 'object') {
  2361. targetObj[keys] = this.deepClone(source[keys])
  2362. } else {
  2363. targetObj[keys] = source[keys]
  2364. }
  2365. })
  2366. return targetObj
  2367. }, getGoodUnit(id) {
  2368. var goodUnit = this.$store.getters.good_unit
  2369. for (let i = 0; i < goodUnit.length; i++) {
  2370. if (goodUnit[i].id == id) {
  2371. return goodUnit[i].name
  2372. }
  2373. }
  2374. },
  2375. getAllProjectTeam() {
  2376. getAllProjectTeam().then(response => {
  2377. if (response.data.state == 1) {
  2378. var team = response.data.data.team
  2379. this.tabPrjectTeam = team
  2380. this.projectList = team
  2381. }
  2382. })
  2383. },
  2384. selectTeam(row) {
  2385. var arr = []
  2386. for (let i = 0; i < row.length; i++) {
  2387. arr.push(row[i].item_id)
  2388. }
  2389. var ids = arr.join(',')
  2390. var strArr = ids.split(',')
  2391. var res = []//接收不重复的数据
  2392. for (var i = 0; i < strArr.length; i++) {
  2393. var flag = true
  2394. for (var j = 0; j < i; j++) {
  2395. if (strArr[i] === strArr[j]) {
  2396. flag = false
  2397. break
  2398. }
  2399. }
  2400. if (flag) {
  2401. res.push(strArr[i])
  2402. }
  2403. }
  2404. var idstr = res.join(',')
  2405. const params = {
  2406. project_id: idstr
  2407. }
  2408. getPojectListById(params).then(response => {
  2409. if (response.data.state == 1) {
  2410. this.teamList = []
  2411. var project = response.data.data.project
  2412. for (let i = 0; i < project.length; i++) {
  2413. if (project[i].type == 2) {
  2414. let obj = {
  2415. id: project[i].project_id,
  2416. project_name: project[i].project.project_name,
  2417. statistical_classification: project[i].project.statistical_classification,
  2418. single_dose: project[i].project.single_dose,
  2419. delivery_way: project[i].project.delivery_way,
  2420. execution_frequency: project[i].project.execution_frequency,
  2421. number_days: project[i].project.number_days,
  2422. total: project[i].number,
  2423. price: project[i].project.price,
  2424. remark: '',
  2425. medical_code: project[i].project.medical_code,
  2426. unit: project[i].project.unit,
  2427. type: project[i].type
  2428. }
  2429. if (obj.total == 0 || obj.total == undefined) {
  2430. obj.total = 1
  2431. }
  2432. this.teamList.push(obj)
  2433. } else if (project[i].type == 3) {
  2434. let obj = {
  2435. id: project[i].project_id,
  2436. project_name: project[i].good_info.good_name,
  2437. statistical_classification: '',
  2438. single_dose: '',
  2439. delivery_way: '',
  2440. execution_frequency: '',
  2441. number_days: '',
  2442. total: project[i].number,
  2443. price: project[i].good_info.retail_price,
  2444. remark: '',
  2445. medical_code: project[i].good_info.medical_insurance_number,
  2446. unit: project[i].good_info.unit,
  2447. type: project[i].type
  2448. }
  2449. if (obj.total == 0 || obj.total == undefined) {
  2450. obj.total = 1
  2451. }
  2452. this.teamList.push(obj)
  2453. }
  2454. }
  2455. }
  2456. })
  2457. }, changeDoctor(val) {
  2458. for (let i = 0; i < this.doctors.length; i++) {
  2459. if (this.doctors[i].admin_user_id == this.doctorValue) {
  2460. this.departmentValue = this.doctors[i].department_id
  2461. }
  2462. }
  2463. if (this.departmentValue == 0) {
  2464. this.departmentValue = ''
  2465. }
  2466. },
  2467. changeDayOrMonth(tab) {
  2468. if (this.dayorMonth == 'day') {
  2469. } else if (this.dayorMonth == 'month') {
  2470. }
  2471. },
  2472. getAllProjectList() {
  2473. getAllProjectList().then(response => {
  2474. if (response.data.state == 1) {
  2475. var hisprojectlist = response.data.data.hisprojectlist
  2476. this.hisList = hisprojectlist
  2477. }
  2478. })
  2479. },
  2480. clearSelection() {
  2481. this.$refs.tabProjectTeam.clearSelection()
  2482. }
  2483. }, mounted() {
  2484. this.request_record_date = this.record_date
  2485. this.getInitData()
  2486. //获取所有项目
  2487. this.getlist()
  2488. //获取所以项目组套
  2489. this.getAllProjectTeam()
  2490. this.getAllProjectList()
  2491. this.$nextTick(() => {
  2492. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  2493. })
  2494. },
  2495. watch: {
  2496. fullHeight(val) {
  2497. if (!this.timer) {
  2498. this.fullHeight = val
  2499. let tableHeight = val - 263
  2500. this.tableHeight = tableHeight
  2501. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  2502. this.timer = true
  2503. let that = this
  2504. setTimeout(function() {
  2505. that.timer = false
  2506. }, 400)
  2507. }
  2508. }
  2509. }
  2510. }
  2511. </script>
  2512. <style lang="scss" scoped>
  2513. .new-main-contain {
  2514. height: 100%;
  2515. display: flex;
  2516. flex-direction: column;
  2517. }
  2518. .app-container {
  2519. height: 100%;
  2520. }
  2521. .mainCell {
  2522. height: 36px;
  2523. display: flex;
  2524. align-items: center;
  2525. }
  2526. .mainLeft {
  2527. width: 200px;
  2528. height: 100%;
  2529. display: flex;
  2530. flex-direction: column;
  2531. margin-top: 2px;
  2532. .el-radio {
  2533. margin-right: 5px;
  2534. }
  2535. }
  2536. .mainRight {
  2537. margin-left: 20px;
  2538. flex: 1;
  2539. height: 100%;
  2540. display: flex;
  2541. flex-direction: column;
  2542. .cellSpan {
  2543. min-width: 80px;
  2544. display: inline-block;
  2545. margin-right: 10px;
  2546. }
  2547. }
  2548. .mainCenter {
  2549. display: flex;
  2550. flex: 1;
  2551. height: 100%;
  2552. }
  2553. .centerLeft {
  2554. flex: 1;
  2555. display: flex;
  2556. flex-direction: column;
  2557. position: relative;
  2558. .el-form-item {
  2559. width: 33%;
  2560. margin-bottom: 14px;
  2561. }
  2562. .el-form-item__label {
  2563. text-align: left;
  2564. }
  2565. }
  2566. .backColor {
  2567. background: #f6f8f9;
  2568. height: 5px;
  2569. margin-bottom: 5px;
  2570. }
  2571. .RP {
  2572. color: #409EFF;
  2573. font-size: 14px;
  2574. margin-bottom: 5px;
  2575. }
  2576. .tabsBox {
  2577. position: relative;
  2578. flex: 1;
  2579. overflow-y: auto;
  2580. margin-bottom: 60px;
  2581. /*/ / margin-top: 4 px;*/
  2582. .el-tabs__item {
  2583. padding: 0 10px;
  2584. }
  2585. }
  2586. .preTabs {
  2587. height: 100%;
  2588. display: flex;
  2589. flex-direction: column;
  2590. .el-tabs__content {
  2591. flex: 1;
  2592. overflow-y: auto;
  2593. }
  2594. }
  2595. .costBox {
  2596. width: 100%;
  2597. height: 60px;
  2598. background: #fff;
  2599. position: absolute;
  2600. bottom: 0;
  2601. display: flex;
  2602. align-items: center;
  2603. justify-content: space-between;
  2604. }
  2605. .statusRed {
  2606. color: red;
  2607. }
  2608. .addTab {
  2609. position: absolute;
  2610. right: 8px;
  2611. top: 3px;
  2612. z-index: 20;
  2613. }
  2614. .centerRight {
  2615. width: 300px;
  2616. margin-left: 10px;
  2617. display: flex;
  2618. flex-direction: column;
  2619. position: relative;
  2620. }
  2621. .rightTab {
  2622. height: 40px;
  2623. width: 100%;
  2624. border: 1px solid #d2d2d2;
  2625. box-sizing: border-box;
  2626. p {
  2627. width: 50%;
  2628. height: 40px;
  2629. line-height: 40px;
  2630. text-align: center;
  2631. background: #eee;
  2632. float: left;
  2633. }
  2634. > p:last-child {
  2635. border-left: 1px solid #d2d2d2;
  2636. float: right;
  2637. }
  2638. .activeP {
  2639. background: #409EFF;
  2640. color: #fff;
  2641. }
  2642. }
  2643. .rightTabs {
  2644. display: flex;
  2645. flex-direction: column;
  2646. }
  2647. .comfirmBox {
  2648. width: 100%;
  2649. height: 60px;
  2650. background: #fff;
  2651. position: absolute;
  2652. bottom: 0;
  2653. display: flex;
  2654. align-items: center;
  2655. justify-content: space-between;
  2656. z-index: 99;
  2657. }
  2658. .borderCard {
  2659. height: 100%;
  2660. display: flex;
  2661. flex-direction: column;
  2662. margin-bottom: 60px;
  2663. .el-tabs--border-card > .el-tabs__content {
  2664. padding: 0;
  2665. }
  2666. }
  2667. </style>
  2668. <style lang="scss">
  2669. .borderCard {
  2670. .el-tabs__nav {
  2671. width: 100%;
  2672. }
  2673. .el-tabs__item {
  2674. width: 50%;
  2675. text-align: center;
  2676. }
  2677. .el-tabs__content {
  2678. padding: 5px;
  2679. flex: 1;
  2680. }
  2681. }
  2682. .centerLeft {
  2683. .el-form-item__label {
  2684. text-align: left;
  2685. }
  2686. }
  2687. .tabsBox {
  2688. .el-tabs__item {
  2689. padding: 0 10px;
  2690. }
  2691. .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) {
  2692. padding: 0 10px;
  2693. }
  2694. .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 {
  2695. padding: 0 10px;
  2696. }
  2697. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  2698. padding: 0 10px;
  2699. }
  2700. }
  2701. .centerRight {
  2702. .el-tabs__nav-scroll {
  2703. display: flex;
  2704. }
  2705. .el-tabs__nav {
  2706. margin: 0 auto;
  2707. }
  2708. .el-table th .cell, .el-table td .cell {
  2709. padding: 0 2px;
  2710. }
  2711. }
  2712. .preTabs {
  2713. .el-tabs__content {
  2714. flex: 1;
  2715. overflow-y: auto;
  2716. padding: 5px 0 5px 5px;
  2717. }
  2718. }
  2719. .rightTabs {
  2720. height: 100%;
  2721. .el-tabs__nav {
  2722. width: auto;
  2723. }
  2724. .el-tabs__header {
  2725. margin-bottom: 5px;
  2726. }
  2727. .el-tabs__item {
  2728. width: auto;
  2729. text-align: inherit;
  2730. }
  2731. .el-tabs__content {
  2732. flex: 1;
  2733. overflow-y: auto;
  2734. }
  2735. .el-tab-pane {
  2736. display: flex;
  2737. flex-direction: column;
  2738. height: 100%;
  2739. }
  2740. }
  2741. #tab-more {
  2742. .el-icon-close {
  2743. display: none;
  2744. }
  2745. }
  2746. ::-webkit-scrollbar {
  2747. height: 15px;
  2748. }
  2749. </style>