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

deskPrescription.vue 147KB

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