deskPrescription.vue 133KB

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