doctorDesk.vue 205KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586
  1. <template>
  2. <div class="main-contain new-main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container" style="display:flex;flex: 1;padding: 10px 20px 0px 20px;">
  7. <div class="mainLeft">
  8. <el-date-picker
  9. v-model="record_date"
  10. prefix-icon="el-icon-date"
  11. @change="changeTimeTwo"
  12. :editable="false"
  13. style="width: 100%;"
  14. type="date"
  15. placeholder="选择开始时间"
  16. align="right"
  17. format="yyyy-MM-dd"
  18. value-format="yyyy-MM-dd">
  19. </el-date-picker>
  20. <div class="mainCell" style="justify-content: space-between;">
  21. <p style="font-size:14px;">未就诊:<span>{{cal_one}}</span>人</p>
  22. <p style="font-size:14px;">已就诊:<span>{{cal_two}}</span>人</p>
  23. </div>
  24. <div class="mainCell">
  25. <el-radio-group v-model="schedule_type" @change="changeScheduleType">
  26. <el-radio :label="1">上午</el-radio>
  27. <el-radio :label="2">下午</el-radio>
  28. <el-radio :label="3">晚上</el-radio>
  29. <el-radio :label="0">全部</el-radio>
  30. </el-radio-group>
  31. </div>
  32. <div class="mainCell">
  33. <el-radio-group v-model="radio" @change="change">
  34. <el-radio :label="1">未就诊</el-radio>
  35. <el-radio :label="2">已就诊</el-radio>
  36. <el-radio :label="0">全部</el-radio>
  37. </el-radio-group>
  38. </div>
  39. <div class="mainCell" style="margin-bottom:10px;">
  40. <el-input size="small" placeholder="请输入姓名或就诊号"
  41. v-model="search_input" class="filter-item"/>
  42. <el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"
  43. @click="searchAction">
  44. 搜索
  45. </el-button>
  46. </div>
  47. <div>
  48. <el-table :data="patientTableData" :height="tableHeight" @row-click='choosePatient'
  49. @current-change='currentChange' border style="width: 100%;"
  50. :row-style="{ color: '#303133' }"
  51. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  52. highlight-current-row
  53. ref="tab"
  54. >
  55. <el-table-column prop="name" label="姓名" width='89'>
  56. <template slot-scope="scope">{{ scope.$index + 1 }}. {{scope.row.name}}</template>
  57. </el-table-column>
  58. <el-table-column prop="name" label="就诊号" width="110">
  59. <template slot-scope="scope">{{ scope.row.his_patient ?scope.row.his_patient.number:''}}</template>
  60. </el-table-column>
  61. </el-table>
  62. </div>
  63. </div>
  64. <div class="mainRight">
  65. <div class="mainHeader">
  66. <el-tabs v-model="titleType" @tab-click="handleClick"
  67. style="position: fixed;width: calc(100% - 490px);background:#fff;">
  68. <el-tab-pane label="电子处方" name="电子处方"></el-tab-pane>
  69. <el-tab-pane label="透析记录" name="透析记录"></el-tab-pane>
  70. <el-tab-pane label="电子病历" name="电子病历"></el-tab-pane>
  71. </el-tabs>
  72. <div class="mainCell fixedCell" style="float:right" v-if="titleType == '电子处方'">
  73. <el-button size="small" ref="button_one" @click="open(1)" type="primary"
  74. v-loading="saveLoading">保存
  75. </el-button>
  76. <el-button size="small" ref="button_three" @click="open_two()" type="primary">处方调用</el-button>
  77. <!--<el-button size="small" @click="open_three()" type="primary">存模板</el-button>-->
  78. <!-- <el-popover
  79. placement="bottom"
  80. width="300"
  81. trigger="click">
  82. <el-button size="small" ref="button_two" @click="open(2)">处方单</el-button>
  83. <el-button size="small" ref="button_six" @click="open(6)">治疗单</el-button>
  84. <el-button size="small" ref="button_six" @click="open(20)">检验单</el-button>
  85. <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印
  86. </el-button>
  87. </el-popover> -->
  88. <el-button size="small" @click="openPrint" type="primary">打印</el-button>
  89. <!-- <el-button size="small" ref="button_four" @click="open(5)" type="primary" :disabled='prescriptions && prescriptions[0].advices && prescriptions[0].project ? prescriptions[0].advices.length == 0 && prescriptions[0].project.length == 0 : false'>存模板</el-button> -->
  90. </div>
  91. <div class="mainCell fixedCell" style="float:right" v-if="titleType == '电子病历'">
  92. <el-button size="small" @click="opentwo(1)" type="primary">保存</el-button>
  93. <el-button size="small" @click="opentwo(2)" type="primary">打印</el-button>
  94. <el-button size="small" @click="opentwo(3)" type="primary">病历调用</el-button>
  95. <el-button size="small" @click="opentwo(4)" type="primary">存模板</el-button>
  96. </div>
  97. </div>
  98. <!--<desk-prescription ref="prescriptions" :prescriptions="prescriptions" :patientInfo="patientInfo" :hisPatientInfo="hisPatientInfo"-->
  99. <!--v-if="titleType == '处方'" style="flex:1;"></desk-prescription>-->
  100. <desk-prescription v-on:setData="setData"
  101. :diagnoses="diagnoses"
  102. :loading="isloading"
  103. :sick="sick"
  104. :record_date="record_date"
  105. :drugs="drugs"
  106. :allDrugs="allDrugs"
  107. :advices_template="advices_template"
  108. :additions="additions"
  109. :doctors="doctors"
  110. :department="department"
  111. v-on:change="changeOther"
  112. v-on:month="changeMonth"
  113. v-on:day="changeDay"
  114. :month_prescriptions="month_prescriptions"
  115. ref="prescriptions" :prescriptions="prescriptions" :patientInfo="patientInfo"
  116. :hisPatientInfo="hisPatientInfo" @event1="changetwo($event)"
  117. :org_id="org_id" @editKeepLoad="editKeepLoad"
  118. v-on:getSunziValue="getSunziValue"
  119. v-if="titleType == '电子处方'" style="flex:1;"></desk-prescription>
  120. <desk-record :record_date="record_date" :case_history="case_history" :patientInfo="patientInfo"
  121. :hisPatientInfo="hisPatientInfo" v-if="titleType == '电子病历'" :detalid="detalid"
  122. ref="child"></desk-record>
  123. <medicalRecord ref='medicalRecord' @func="getMsgFormSon"></medicalRecord>
  124. <saveRecordTemplate ref='saveRecordTemplate'></saveRecordTemplate>
  125. <!--<dialysis-index v-if="titleType == '透析记录'" :record_date="record_date" :patientid='patientid'></dialysis-index>-->
  126. <dialysis-index v-if="titleType == '透析记录'" :record_date="record_date" :patientid='patientid'
  127. :dialysisShow="dialysisShow"></dialysis-index>
  128. </div>
  129. </div>
  130. <el-dialog
  131. title="打印"
  132. :visible.sync="centerDialogVisible"
  133. width="600px"
  134. center>
  135. <el-button @click="allCheck">全选</el-button>
  136. <div style="text-align:center;margin-top:10px;font-weight:bold;font-size:20px;">处方笺打印</div>
  137. <el-table
  138. ref="multipleTable1"
  139. :data="tableData1"
  140. tooltip-effect="dark"
  141. style="width: 600px"
  142. @selection-change="handleSelectionChange1">
  143. <el-table-column
  144. align='center'
  145. type="selection"
  146. width="50">
  147. </el-table-column>
  148. <el-table-column
  149. align='center'
  150. label="处方编号"
  151. width="120">
  152. <template slot-scope="scope">
  153. <span>处方 {{scope.$index + 1}}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="处方号">
  157. <template slot-scope="scope">
  158. <span>
  159. <el-input v-model="scope.row.prescription_number" :disabled="true"></el-input>
  160. </span>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. <div style="text-align:center;margin-top:10px;font-weight:bold;font-size:20px;">治疗单打印</div>
  165. <el-table
  166. ref="multipleTable2"
  167. :data="tableData2"
  168. tooltip-effect="dark"
  169. style="width: 600px"
  170. @selection-change="handleSelectionChange2">
  171. <el-table-column
  172. align='center'
  173. type="selection"
  174. width="50">
  175. </el-table-column>
  176. <el-table-column
  177. align='center'
  178. label="治疗单编号"
  179. width="120">
  180. <template slot-scope="scope">
  181. <span>治疗 {{scope.$index + 1}}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="治疗单号">
  185. <template slot-scope="scope">
  186. <span>
  187. <el-input v-model="scope.row.prescription_number" :disabled="true"></el-input>
  188. </span>
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. <div style="text-align:center;margin-top:10px;font-weight:bold;font-size:20px;">检验单打印</div>
  193. <el-table
  194. ref="multipleTable3"
  195. :data="tableData3"
  196. tooltip-effect="dark"
  197. style="width: 600px"
  198. @selection-change="handleSelectionChange3">
  199. <el-table-column
  200. align='center'
  201. type="selection"
  202. width="50">
  203. </el-table-column>
  204. <el-table-column
  205. align='center'
  206. label="处方编号"
  207. width="120">
  208. <template slot-scope="scope">
  209. <span>检验单1</span>
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="检验单号">
  213. <template slot-scope="scope">
  214. <span>
  215. <el-input v-model="scope.row.prescription_number" :disabled="true"></el-input>
  216. </span>
  217. </template>
  218. </el-table-column>
  219. </el-table>
  220. <el-dialog
  221. class="centerDialog"
  222. width="600px"
  223. title="打印"
  224. :visible.sync="innerVisible"
  225. append-to-body>
  226. <template>
  227. <el-button
  228. style="float:right;"
  229. :loading="loading"
  230. size="small"
  231. icon="el-icon-printer"
  232. @click="printThisPage"
  233. type="primary"
  234. >打印
  235. </el-button
  236. >
  237. </template>
  238. <div id='printMain'>
  239. <print ref="print" v-if="selecting_schs1.length > 0" :paramsObj='paramsObj'></print>
  240. <treatPrint ref="treatPrint" v-if="selecting_schs2.length > 0" :paramsObj='paramsObj2'></treatPrint>
  241. <checkPrint ref="checkPrint" v-if="selecting_schs3.length > 0" :paramsObj='paramsObj3'></checkPrint>
  242. </div>
  243. </el-dialog>
  244. <span slot="footer" class="dialog-footer">
  245. <el-button @click="centerDialogVisible = false">取 消</el-button>
  246. <el-button type="primary" @click="savePrint">确 定</el-button>
  247. </span>
  248. </el-dialog>
  249. <!-- <el-dialog
  250. class="centerDialog"
  251. width="600px"
  252. title="打印"
  253. :visible.sync="checkVisible">
  254. <checkPrint v-if="index == 20" :paramsObj='paramsObj'></checkPrint>
  255. </el-dialog> -->
  256. <el-dialog
  257. class="centerDialog"
  258. width="600px"
  259. title="打印"
  260. :visible.sync="recordVisible">
  261. <recordPrint :patientid="patientid" ref="recordPrint" :showBtn='true'></recordPrint>
  262. </el-dialog>
  263. </div>
  264. </template>
  265. <script>
  266. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  267. import deskPrescription from './components/deskPrescription'
  268. import deskRecord from './components/deskRecord'
  269. import {
  270. createCaseHistory,
  271. getHospitalPatientList,
  272. getInitData,
  273. getMonthHisPateintInfo,
  274. getPatientInfo
  275. } from '@/api/his/his'
  276. import { getDictionaryDataConfig } from '@/utils/data'
  277. import medicalRecord from './components/medicalRecord'
  278. import saveRecordTemplate from './components/saveRecordTemplate'
  279. import { uParseTime } from '@/utils/tools'
  280. import { getPrescriptionList } from '@/api/project/project'
  281. import print from './print'
  282. import treatPrint from './treatPrint'
  283. import recordPrint from './recordPrint'
  284. import checkPrint from './checkPrint'
  285. import dialysisIndex from './components/dialysisIndex'
  286. const moment = require('moment')
  287. export default {
  288. components: {
  289. BreadCrumb,
  290. deskPrescription,
  291. deskRecord,
  292. medicalRecord,
  293. saveRecordTemplate,
  294. print,
  295. treatPrint,
  296. recordPrint,
  297. checkPrint,
  298. dialysisIndex
  299. },
  300. data() {
  301. return {
  302. settle_total:0,
  303. current_data:null,
  304. drugs: [],
  305. allDrugs: [],
  306. advices_template: [],
  307. sick: [],
  308. diagnoses: [],
  309. additions: [],
  310. doctors: [],
  311. department: [],
  312. tableHeight: '',
  313. saveloading: false,
  314. fullHeight: document.documentElement.clientHeight,
  315. month_prescriptions: [],
  316. isloading: false,
  317. loading:false,
  318. prescriptions: [
  319. {
  320. name: '处方1',
  321. advices: [],
  322. project: [],
  323. addition: []
  324. }
  325. ],
  326. search_input: '',
  327. cal_one: 0,
  328. cal_two: 0,
  329. radio: 1,
  330. schedule_type: 0,
  331. record_date: '',
  332. crumbs: [
  333. { path: false, name: '住院医生站' },
  334. { path: false, name: '医生工作台' }
  335. ],
  336. titleType: '电子处方',
  337. patientTableData: [{}],
  338. patientTableDataTwo: [{}],
  339. patientInfo: {},
  340. hisPatientInfo: {},
  341. case_history: {},
  342. patient_id: 0,
  343. other_sick: [],
  344. info: {},
  345. last_info: {},
  346. templatedetail: {},
  347. detalid: 0,
  348. prescription_id: 0,
  349. patientid: 0,
  350. prescriptionList: [],
  351. centerDialogVisible: false,
  352. tableData1: [],
  353. tableData2: [],
  354. tableData3: [],
  355. tableData4: [],
  356. selecting_schs1: [],
  357. selecting_schs2: [],
  358. selecting_schs3: [],
  359. index: 0,
  360. admin_info: {},
  361. saveLoading: false,
  362. innerVisible: false,
  363. paramsObj: {},
  364. paramsObj2: {},
  365. paramsObj3: {},
  366. recordVisible: false,
  367. recordObj: {},
  368. dialysisShow: true,
  369. all_data: [],
  370. all_data_two: [],
  371. un_cure_data: [],
  372. un_cure_data_two: [],
  373. cure_data: [],
  374. cure_data_two: [],
  375. all_his_patients: [],
  376. checkVisible: false,
  377. current_tab: 'day'
  378. }
  379. },
  380. methods: {
  381. getSunziValue(val){
  382. console.log("孙子发来的信息",val)
  383. this.getInitData()
  384. },
  385. editKeepLoad(data){
  386. this.saveLoading = data
  387. },
  388. changeTimeTwo() {
  389. this.titleType = "电子处方"
  390. this.getList()
  391. },
  392. openPrint() {
  393. // this.centerDialogVisible = true
  394. this.getPrescriptionList(this.patientInfo.id,this.record_date)
  395. },
  396. allCheck() {
  397. this.$refs.multipleTable1.toggleAllSelection()
  398. this.$refs.multipleTable2.toggleAllSelection()
  399. this.$refs.multipleTable3.toggleAllSelection()
  400. },
  401. printThisPage() {
  402. if(this.org_id == 10138){
  403. const style =
  404. '@media print {#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;margin-top:10px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:350px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 88%;}}#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;margin-top:10px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:350px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 87%;}}}'
  405. printJS({
  406. printable: 'printMain',
  407. type: 'html',
  408. style: style,
  409. scanStyles: false
  410. })
  411. }else{
  412. const style =
  413. '@media print {#prescription-print{font-size:14px;border:1px solid white}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;border-bottom: 2px solid #000;margin-top:10px;line-height: 1px; padding:0 10px;}.infoTitle p{width: 200px;font-size:14px;}.infoMain{display: flex;flex-wrap: wrap;border-bottom: 2px solid #000;padding:0 10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:450px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 88%;}}#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;margin-top:10px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:450px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}.NoCell{display: flex;justify-content: space-between;margin-bottom: 10px;}.underLine{display: inline-block;border-bottom: 1px solid #000;text-align: center;line-height: 24px;}.basicCell{display: flex;} .basicCell span{line-height: 24px;margin-bottom: 10px;}}'
  414. printJS({
  415. printable: 'printMain',
  416. type: 'html',
  417. style: style,
  418. scanStyles: false
  419. })
  420. }
  421. this.innerVisible = false
  422. // this.$nextTick(() => {
  423. // this.$refs.print.printThisPage()
  424. // this.$refs.treatPrint.printThisPage()
  425. // this.$refs.checkPrint.printThisPage()
  426. // })
  427. },
  428. changeOther(patient_id) {
  429. if (this.radio == 2){
  430. if (this.patientTableData.length > 0) {
  431. for(let i = 0; i < this.patientTableData.length; i++){
  432. if(this.patientTableData[i].id == patient_id){
  433. this.$refs.tab.setCurrentRow(this.patientTableData[i])
  434. this.oldCurrentRow = this.patientTableData[i]
  435. this.getPatientInfo(this.patientTableData[i])
  436. }
  437. }
  438. }
  439. }else{
  440. this.radio = 2
  441. let params = {
  442. 'record_date': this.record_date,
  443. 'type': this.radio,
  444. 'sch_type': this.schedule_type
  445. }
  446. this.patientTableData = []
  447. this.un_cure_data = []
  448. this.cure_data = []
  449. this.all_data = []
  450. getHospitalPatientList(params).then(response => {
  451. if (response.data.state == 0) {
  452. this.$message.error(response.data.msg)
  453. return false
  454. } else {
  455. this.patientTableData = response.data.data.list
  456. this.all_data = this.patientTableData
  457. this.patientTableDataTwo = response.data.data.list
  458. this.cal_one = response.data.data.total_one
  459. this.cal_two = response.data.data.total_two
  460. this.admin_info = response.data.data.info
  461. if (this.patientTableData.length > 0) {
  462. for(let i = 0; i < this.patientTableData.length; i++){
  463. if(this.patientTableData[i].id == patient_id){
  464. this.$refs.tab.setCurrentRow(this.patientTableData[i])
  465. this.oldCurrentRow = this.patientTableData[i]
  466. this.getPatientInfo(this.patientTableData[i])
  467. }
  468. }
  469. }
  470. }
  471. })
  472. }
  473. // getSchedulePatientList(params).then(response => {
  474. // if (response.data.state == 0) {
  475. // this.$message.error(response.data.msg);
  476. // return false
  477. // } else {
  478. // this.patientTableData = response.data.data.list;
  479. // this.patientTableDataTwo = response.data.data.list;
  480. // this.cal_one = response.data.data.total_one;
  481. // this.cal_two = response.data.data.total_two;
  482. // this.admin_info = response.data.data.info;
  483. //
  484. //
  485. // if (this.patientTableData.length > 0) {
  486. // for(let i = 0; i < this.patientTableData.length; i++){
  487. // if (this.patientTableData[i].id == patient_id){
  488. // this.$refs.tab.setCurrentRow(this.patientTableData[i]);
  489. // this.oldCurrentRow = this.patientTableData[i];
  490. // this.getPatientInfo(this.patientTableData[i])
  491. // }
  492. // }
  493. //
  494. // }
  495. //
  496. // this.prescriptionList = response.data.data.list.prescription
  497. //
  498. // }
  499. // })
  500. },
  501. setData(val) {
  502. this.prescriptions = val
  503. },
  504. getDictionaryDataConfig(module, filed_name) {
  505. return getDictionaryDataConfig(module, filed_name)
  506. },
  507. searchAction() {
  508. if (this.search_input.length == 0) {
  509. this.patientTableData = this.all_data
  510. } else {
  511. switch (this.radio) {
  512. case 0:
  513. let arr4 = []
  514. for (let i = 0; i < this.all_data.length; i++) {
  515. if (this.all_data[i].name.indexOf(this.search_input) != -1 || this.all_data[i].his_patient.number.indexOf(this.search_input) != -1) {
  516. arr4 = arr4.concat(this.all_data[i])
  517. }
  518. }
  519. this.patientTableData = arr4
  520. break
  521. case 2:
  522. let arr2 = []
  523. for (let i = 0; i < this.all_data.length; i++) {
  524. if (this.all_data[i].name.indexOf(this.search_input) != -1 || this.all_data[i].his_patient.number.indexOf(this.search_input) != -1) {
  525. arr2 = arr2.concat(this.all_data[i])
  526. }
  527. }
  528. this.patientTableData = arr2
  529. break
  530. case 1:
  531. let arr3 = []
  532. for (let i = 0; i < this.all_data.length; i++) {
  533. if (this.all_data[i].name.indexOf(this.search_input) != -1 || this.all_data[i].his_patient.number.indexOf(this.search_input) != -1) {
  534. arr3 = arr3.concat(this.all_data[i])
  535. }
  536. }
  537. this.patientTableData = arr3
  538. break
  539. }
  540. }
  541. },
  542. change() {
  543. let params = {
  544. 'record_date': this.record_date,
  545. 'type': this.radio,
  546. 'sch_type': this.schedule_type
  547. }
  548. this.un_cure_data = []
  549. this.cure_data = []
  550. this.all_data = []
  551. getHospitalPatientList(params).then(response => {
  552. if (response.data.state == 0) {
  553. this.$message.error(response.data.msg)
  554. return false
  555. } else {
  556. this.patientTableData = response.data.data.list
  557. this.all_data = this.patientTableData
  558. this.patientTableDataTwo = response.data.data.list
  559. this.cal_one = response.data.data.total_one
  560. this.cal_two = response.data.data.total_two
  561. this.admin_info = response.data.data.info
  562. if (this.patientTableData.length > 0) {
  563. this.current_data = this.patientTableData[0]
  564. this.$refs.tab.setCurrentRow(this.patientTableData[0])
  565. this.oldCurrentRow = this.patientTableData[0]
  566. this.getPatientInfo(this.patientTableData[0])
  567. }
  568. }
  569. })
  570. }, changeScheduleType() {
  571. let params = {
  572. 'record_date': this.record_date,
  573. 'type': this.radio,
  574. 'sch_type': this.schedule_type
  575. }
  576. this.un_cure_data = []
  577. this.cure_data = []
  578. this.all_data = []
  579. getHospitalPatientList(params).then(response => {
  580. if (response.data.state == 0) {
  581. this.$message.error(response.data.msg)
  582. return false
  583. } else {
  584. this.patientTableData = response.data.data.list
  585. this.all_data = this.patientTableData
  586. this.patientTableDataTwo = response.data.data.list
  587. this.cal_one = response.data.data.total_one
  588. this.cal_two = response.data.data.total_two
  589. this.admin_info = response.data.data.info
  590. if (this.patientTableData.length > 0) {
  591. this.$refs.tab.setCurrentRow(this.patientTableData[0])
  592. this.oldCurrentRow = this.patientTableData[0]
  593. this.getPatientInfo(this.patientTableData[0])
  594. }
  595. }
  596. })
  597. },
  598. setMonthPrescription(month_prescriptions) {
  599. this.month_prescriptions = []
  600. let drug_month_prescriptions = {
  601. advices: []
  602. }
  603. let drug_ids = []
  604. let project_month_prescriptions = {
  605. project: []
  606. }
  607. let project_ids = []
  608. let addition_month_prescriptions = {
  609. addition: []
  610. }
  611. let additions_ids = []
  612. let count = 0
  613. for (let i = 0; i < month_prescriptions.length; i++) {
  614. if (month_prescriptions[i].type == 1) { //药品
  615. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  616. let obj = {
  617. id: month_prescriptions[i].advices[a].drug_id,
  618. price: month_prescriptions[i].advices[a].price
  619. }
  620. drug_ids.push(obj)
  621. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  622. }
  623. } else if (month_prescriptions[i].type == 2) { //项目
  624. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  625. let obj = {
  626. id: month_prescriptions[i].project[a].project_id,
  627. price: month_prescriptions[i].project[a].price
  628. }
  629. if(month_prescriptions[i].project[a].project_id == 1735){
  630. count = count + 1
  631. }
  632. project_ids.push(obj)
  633. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  634. }
  635. }
  636. //附加收费
  637. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  638. // let obj = {
  639. // id: month_prescriptions[i].addition[a].item_id,
  640. // price: month_prescriptions[i].addition[a].price
  641. //
  642. // }
  643. // additions_ids.push(obj)
  644. // addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  645. // }
  646. }
  647. console.log("打印日志了:")
  648. console.log(count)
  649. const obj = {}
  650. const obj1 = {}
  651. const obj2 = {}
  652. drug_ids = this.unique(drug_ids)
  653. project_ids = this.unique(project_ids)
  654. additions_ids = this.unique(additions_ids)
  655. let drugs = []
  656. let projects = []
  657. let additions = []
  658. for (let i = 0; i < drug_ids.length; i++) {
  659. let obj = {}
  660. let count = 0
  661. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  662. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price && drug_ids[i].id == drug_month_prescriptions.advices[a].drug_id) {
  663. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  664. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  665. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  666. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  667. obj['day'] = drug_month_prescriptions.advices[a].day
  668. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  669. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  670. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  671. obj['id'] = drug_month_prescriptions.advices[a].drug_id
  672. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  673. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price)
  674. obj['drug'] = drug_month_prescriptions.advices[a].drug
  675. obj['single_dose_unit'] = drug_month_prescriptions.advices[a].single_dose_unit
  676. count = count + drug_month_prescriptions.advices[a].prescribing_number
  677. }
  678. }
  679. obj['prescribing_number'] = count
  680. drugs.push(obj)
  681. }
  682. for (let i = 0; i < project_ids.length; i++) {
  683. let obj = {}
  684. let count = 0
  685. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  686. if (project_ids[i].price == project_month_prescriptions.project[a].price && project_ids[i].id == project_month_prescriptions.project[a].project_id) {
  687. if (project_month_prescriptions.project[a].type == 2) {
  688. obj['statistical_classification'] = ''
  689. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  690. obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  691. obj['project'] = project_month_prescriptions.project[a].project
  692. } else if (project_month_prescriptions.project[a].type == 3) {
  693. obj['statistical_classification'] = ''
  694. obj['medical_code'] = project_month_prescriptions.project[a].good_info.medical_insurance_number
  695. obj['project_name'] = project_month_prescriptions.project[a].good_info.good_name
  696. obj['good_info'] = project_month_prescriptions.project[a].good_info
  697. }
  698. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  699. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  700. obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  701. obj['type'] = project_month_prescriptions.project[a].type
  702. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  703. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  704. obj['number_days'] = project_month_prescriptions.project[a].day
  705. // obj['medical_c/**/ode'] = project_month_prescriptions.project[a].project.medical_code
  706. obj['unit'] = project_month_prescriptions.project[a].unit
  707. obj['project_id'] = project_month_prescriptions.project[a].project_id
  708. count = count + parseFloat(project_month_prescriptions.project[a].count)
  709. // price = price + project_month_prescriptions.project[a].price
  710. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  711. }
  712. }
  713. obj['total'] = count
  714. projects.push(obj)
  715. }
  716. for (let i = 0; i < additions_ids.length; i++) {
  717. let obj = {}
  718. let count = 0
  719. if (addition_month_prescriptions.addition) {
  720. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  721. if (project_ids[i].price == addition_month_prescriptions.addition[a].price) {
  722. obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  723. obj['id'] = addition_month_prescriptions.addition[a].id
  724. obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  725. count = count + addition_month_prescriptions.addition[a].count
  726. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  727. }
  728. }
  729. obj['count'] = count
  730. additions.push(obj)
  731. }
  732. }
  733. let p1 = {
  734. name: '处方' + 1,
  735. advices: drugs,
  736. project: [],
  737. type: 1,
  738. addition: additions
  739. }
  740. let p2 = {
  741. name: '处方' + 2,
  742. type: 2,
  743. project: projects,
  744. advices: [],
  745. addition: []
  746. }
  747. this.month_prescriptions.push(p1)
  748. this.month_prescriptions.push(p2)
  749. this.$refs.prescriptions.setMonthData(this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info,this.settle_total)
  750. },
  751. // setMonthPrescription(month_prescriptions){
  752. // let drug_month_prescriptions = {
  753. // advices:[],
  754. // }
  755. // let drug_ids=[]
  756. // let project_month_prescriptions ={
  757. // project:[],
  758. //
  759. // }
  760. // let project_ids=[]
  761. //
  762. // let addition_month_prescriptions ={
  763. // addtions:[],
  764. //
  765. // }
  766. // let additions_ids=[]
  767. //
  768. //
  769. // for (let i = 0; i < month_prescriptions.length; i++){
  770. // if(month_prescriptions[i].type == 1){ //药品
  771. // for (let a = 0; a < month_prescriptions[i].advices.length; a++){
  772. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  773. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  774. // }
  775. //
  776. // }else if(month_prescriptions[i].type == 2){ //项目
  777. // for (let a = 0; a < month_prescriptions[i].project.length; a++){
  778. // project_ids.push(month_prescriptions[i].project[a].project_id)
  779. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  780. // }
  781. // }
  782. // //附加收费
  783. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  784. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  785. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  786. // }
  787. //
  788. // }
  789. //
  790. //
  791. //
  792. //
  793. // const obj = {}
  794. // const obj1 = {}
  795. // const obj2 = {}
  796. //
  797. // drug_ids = drug_ids.reduce((cur, next) => {
  798. // obj[next] ? '' : obj[next] = true && cur.push(next)
  799. // return cur
  800. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  801. // project_ids = project_ids.reduce((cur, next) => {
  802. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  803. // return cur
  804. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  805. // additions_ids = additions_ids.reduce((cur, next) => {
  806. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  807. // return cur
  808. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  809. //
  810. //
  811. //
  812. //
  813. //
  814. // let drugs =[]
  815. // let projects =[]
  816. // let additions =[]
  817. //
  818. //
  819. // for (let i = 0; i < drug_ids.length; i++){
  820. // let obj = {}
  821. // let price = 0
  822. // let count = 0
  823. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++){
  824. // if(drug_ids[i] == drug_month_prescriptions.advices[a].drug_id){
  825. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  826. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  827. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  828. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  829. // obj['day'] = drug_month_prescriptions.advices[a].day
  830. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  831. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  832. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  833. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  834. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  835. //
  836. //
  837. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  838. // price = price + drug_month_prescriptions.advices[a].price
  839. //
  840. // }
  841. // }
  842. // obj['retail_price'] = price
  843. // obj['prescribing_number'] = count
  844. // drugs.push(obj)
  845. // }
  846. //
  847. //
  848. //
  849. //
  850. // for (let i = 0; i < project_ids.length; i++){
  851. // let obj = {}
  852. // let price = 0
  853. // let count = 0
  854. // for (let a = 0; a < project_month_prescriptions.project.length; a++){
  855. // if(project_ids[i] == project_month_prescriptions.project[a].project_id){
  856. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  857. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  858. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  859. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  860. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  861. // obj['number_days'] = project_month_prescriptions.project[a].day
  862. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  863. // obj['unit'] = project_month_prescriptions.project[a].unit
  864. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  865. // count = count + project_month_prescriptions.project[a].count
  866. // price = price + project_month_prescriptions.project[a].price
  867. // }
  868. // }
  869. // obj['price'] = price
  870. // obj['total'] = count
  871. // projects.push(obj)
  872. // }
  873. //
  874. //
  875. // for (let i = 0; i < additions_ids.length; i++){
  876. // let obj = {}
  877. // let price = 0
  878. // let count = 0
  879. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++){
  880. // if(project_ids[i] == addition_month_prescriptions.addition[a].item_id){
  881. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  882. // obj['id'] = addition_month_prescriptions.addition[a].id
  883. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  884. // count = count + addition_month_prescriptions.addition[a].count
  885. // price = price + addition_month_prescriptions.addition[a].price
  886. // }
  887. // }
  888. // obj['price'] = price
  889. // obj['count'] = count
  890. // additions.push(obj)
  891. // }
  892. //
  893. //
  894. // let p1 = {
  895. // name: '处方' + 1,
  896. // advices: drugs,
  897. // project: [],
  898. // type:1,
  899. // addition: additions,
  900. // }
  901. // let p2 = {
  902. // name: '处方' + 2,
  903. // type:2,
  904. // project: projects,
  905. // advices: [],
  906. // }
  907. // this.month_prescriptions.push(p1)
  908. // this.month_prescriptions.push(p2)
  909. //
  910. // },
  911. getInitData() {
  912. getInitData().then(response => {
  913. if (response.data.state == 0) {
  914. this.$message.error(response.data.msg)
  915. return false
  916. } else {
  917. var drugs = response.data.data.drugs
  918. // for(let i=0;i<drugs.length;i++){
  919. // drugs[i].count = 0
  920. // if(drugs[i].stock_in.length > 0){
  921. // for(let j=0;j<drugs[i].stock_in.length;j++){
  922. // drugs[i].count += (drugs[i].stock_in[j].stock_max_number * drugs[i].min_number + drugs[i].stock_in[j].stock_min_number)
  923. // }
  924. // }
  925. // }
  926. this.drugs = drugs
  927. this.allDrugs = response.data.data.drugs
  928. this.advices_template = response.data.data.advices_template
  929. this.department = response.data.data.department
  930. this.sick = response.data.data.sick
  931. this.diagnoses = response.data.data.diagnose
  932. this.additions = response.data.data.additions
  933. }
  934. })
  935. },
  936. getInitDataOne(val){
  937. this.prescriptions = val
  938. },
  939. getList() {
  940. let params = {
  941. 'record_date': this.record_date,
  942. 'type': this.radio,
  943. 'sch_type': this.schedule_type
  944. }
  945. this.un_cure_data = []
  946. this.cure_data = []
  947. this.all_data = []
  948. getHospitalPatientList(params).then(response => {
  949. if (response.data.state == 0) {
  950. this.$message.error(response.data.msg)
  951. return false
  952. } else {
  953. this.patientTableData = response.data.data.list
  954. this.all_data = this.patientTableData
  955. this.patientTableDataTwo = response.data.data.list
  956. this.cal_one = response.data.data.total_one
  957. this.cal_two = response.data.data.total_two
  958. this.admin_info = response.data.data.info
  959. if (this.patientTableData.length > 0) {
  960. this.current_data = this.patientTableData[0]
  961. this.$refs.tab.setCurrentRow(this.patientTableData[0])
  962. this.oldCurrentRow = this.patientTableData[0]
  963. this.getPatientInfo(this.patientTableData[0])
  964. }
  965. }
  966. })
  967. },
  968. getPatientInfo(val) {
  969. var nowDate = new Date()
  970. var nowYear = nowDate.getFullYear()
  971. var nowMonth = nowDate.getMonth() + 1
  972. var nowDay = nowDate.getDate()
  973. var hours = nowDate.getHours()
  974. var min = nowDate.getMinutes()
  975. var nowTime =
  976. nowYear +
  977. '-' +
  978. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  979. '-' +
  980. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  981. ':' + (min < 10 ? '0' + min : min)
  982. let params = {
  983. 'record_date': this.record_date,
  984. 'patient_id': val.id,
  985. 'his_patient_id': val.his_patient_id,
  986. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  987. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  988. 'p_type': 1
  989. }
  990. this.isloading = true
  991. getPatientInfo(params).then(response => {
  992. if (response.data.state == 0) {
  993. this.$message.error(response.data.msg)
  994. this.isloading = false
  995. return false
  996. } else {
  997. if (response.data.data.sch_prescriptions == null) {
  998. response.data.data.sch_prescriptions = []
  999. }
  1000. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1001. if (response.data.data.sch_prescriptions[i].advices == null) {
  1002. response.data.data.sch_prescriptions[i].advices = []
  1003. }
  1004. if (response.data.data.sch_prescriptions[i].project == null) {
  1005. response.data.data.sch_prescriptions[i].project = []
  1006. }
  1007. }
  1008. this.patientid = val.id
  1009. this.isloading = false
  1010. this.prescriptions = []
  1011. this.month_prescriptions = []
  1012. this.patientInfo = response.data.data.xt_info
  1013. this.hisPatientInfo = response.data.data.his_info
  1014. this.case_history = response.data.data.case_history
  1015. console.log("电子比你2333223232323232323232323",this.case_history)
  1016. this.info = response.data.data.info
  1017. this.last_info = response.data.data.last_info
  1018. this.schedule = response.data.data.schedule
  1019. this.doctors = response.data.data.doctors
  1020. this.department = response.data.data.department
  1021. for (let i = 0; i < this.doctors.length; i++) {
  1022. if (this.doctors[i].user_type == 1) {
  1023. this.doctors.splice(i, 1)
  1024. }
  1025. }
  1026. // var month_prescriptions = response.data.data.month_prescriptions
  1027. // this.setMonthPrescription(month_prescriptions)
  1028. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  1029. if (this.case_history.temperature <= 0) {
  1030. this.case_history.temperature = ''
  1031. }
  1032. if (this.case_history.blood_sugar <= 0) {
  1033. this.case_history.blood_sugar = ''
  1034. }
  1035. if (this.case_history.pulse <= 0) {
  1036. this.case_history.pulse = ''
  1037. }
  1038. if (this.case_history.sbp <= 0) {
  1039. this.case_history.sbp = ''
  1040. }
  1041. if (this.case_history.dbp <= 0) {
  1042. this.case_history.dbp = ''
  1043. }
  1044. if (this.case_history.height <= 0) {
  1045. this.case_history.height = ''
  1046. }
  1047. if (this.case_history.blood_fat <= 0) {
  1048. this.case_history.blood_fat = ''
  1049. }
  1050. if (this.case_history.sick_type <= 0) {
  1051. this.case_history.sick_type = ''
  1052. }
  1053. if (this.case_history.sick <= 0) {
  1054. this.case_history.sick = ''
  1055. }
  1056. if (this.case_history.diagnose <= 0) {
  1057. this.case_history.diagnose = ''
  1058. }
  1059. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  1060. if (this.case_history.is_infect == 1) {
  1061. this.case_history.is_infect = true
  1062. } else {
  1063. this.case_history.is_infect = false
  1064. }
  1065. this.case_history.primary_disease = this.case_history.primary_disease
  1066. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  1067. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  1068. this.case_history.physical_examination = this.case_history.physical_examination
  1069. this.case_history.special_inspection = this.case_history.special_inspection
  1070. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  1071. //处方相关
  1072. this.prescriptionList = response.data.data.prescription
  1073. if (response.data.data.prescription.length > 0) {
  1074. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1075. var prescription = response.data.data.prescription[i]
  1076. let tempAdvice = []
  1077. let tempProject = []
  1078. let tempAddition = []
  1079. var is_medicine = false
  1080. //药品
  1081. for (let b = 0; b < prescription.advices.length; b++) {
  1082. let obj = {
  1083. advice_id: prescription.advices[b].id,
  1084. drug_name: prescription.advices[b].advice_name,
  1085. single_dose: prescription.advices[b].single_dose,
  1086. delivery_way: prescription.advices[b].delivery_way,
  1087. execution_frequency: prescription.advices[b].execution_frequency,
  1088. retail_price: prescription.advices[b].price.toString(),
  1089. remark: prescription.advices[b].remark,
  1090. day: prescription.advices[b].day,
  1091. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1092. single_dose_unit: prescription.advices[b].single_dose_unit,
  1093. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1094. medical_insurance_number: prescription.advices[b].med_list_codg,
  1095. id: prescription.advices[b].drug_id,
  1096. drug: prescription.advices[b].drug,
  1097. groupno: prescription.advices[b].groupno,
  1098. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  1099. is_medicine: prescription.advices[b].is_medicine,
  1100. }
  1101. tempAdvice.push(obj)
  1102. if (prescription.advices[b].is_medicine == 1){
  1103. is_medicine = true
  1104. }
  1105. }
  1106. //项目
  1107. for (let b = 0; b < prescription.project.length; b++) {
  1108. let obj = {
  1109. id: prescription.project[b].id,
  1110. project_id: prescription.project[b].project_id,
  1111. project_name: prescription.project[b].project.project_name,
  1112. single_dose: prescription.project[b].single_dose,
  1113. delivery_way: prescription.project[b].delivery_way,
  1114. execution_frequency: prescription.project[b].execution_frequency,
  1115. number_days: prescription.project[b].day,
  1116. total: prescription.project[b].count.toString(),
  1117. price: prescription.project[b].price,
  1118. remark: prescription.project[b].remark,
  1119. medical_code: prescription.project[b].project.medical_code,
  1120. unit: prescription.project[b].unit,
  1121. type: prescription.project[b].type,
  1122. }
  1123. if (prescription.project[b].type == 2) {
  1124. console.log("prescription.project[b].team.project_team:")
  1125. console.log(prescription.project[b].team.project_team)
  1126. obj['statistical_classification'] = prescription.project[b].team.project_team
  1127. obj['medical_code'] = prescription.project[b].project.medical_code
  1128. obj['project_name'] = prescription.project[b].project.project_name
  1129. obj['project'] = prescription.project[b].project
  1130. } else if (prescription.project[b].type == 3) {
  1131. if(prescription.project[b].team_id > 0){
  1132. obj['statistical_classification'] = prescription.project[b].team.project_team
  1133. }
  1134. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1135. obj['project_name'] = prescription.project[b].good_info.good_name
  1136. obj['good_info'] = prescription.project[b].good_info
  1137. }
  1138. tempProject.push(obj)
  1139. }
  1140. //附加收费
  1141. // for (let b = 0; b < prescription.addition.length; b++) {
  1142. // let obj = {
  1143. // id: prescription.addition[b].id,
  1144. // item_name: prescription.addition[b].item_name,
  1145. // price: prescription.addition[b].price,
  1146. // count: prescription.addition[b].count,
  1147. // item_id: prescription.addition[b].item_id
  1148. // }
  1149. // tempAddition.push(obj)
  1150. // }
  1151. var preTime = ''
  1152. if (prescription.pre_time == 0) {
  1153. if (this.schedule.schedule_type == 1) {
  1154. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  1155. } else if (this.schedule.schedule_type == 2) {
  1156. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  1157. } else if (this.schedule.schedule_type == 3) {
  1158. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  1159. }
  1160. // preTime = nowTime
  1161. } else {
  1162. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  1163. }
  1164. let index = i + 1
  1165. let obj = {
  1166. id: prescription.id,
  1167. name: '处方' + index,
  1168. advices: tempAdvice,
  1169. project: tempProject,
  1170. addition: tempAddition,
  1171. order_status: prescription.order_status,
  1172. pre_time: preTime,
  1173. med_type: parseInt(prescription.med_type),
  1174. is_medicine_status: is_medicine,
  1175. }
  1176. this.prescriptions.push(obj)
  1177. }
  1178. } else {
  1179. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  1180. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1181. var prescription = response.data.data.sch_prescriptions[i]
  1182. let tempAdvice = []
  1183. let tempProject = []
  1184. let tempAddition = []
  1185. //药品
  1186. for (let b = 0; b < prescription.advices.length; b++) {
  1187. let obj = {
  1188. advice_id: 0,
  1189. drug_name: prescription.advices[b].advice_name,
  1190. single_dose: prescription.advices[b].single_dose,
  1191. delivery_way: prescription.advices[b].delivery_way,
  1192. execution_frequency: prescription.advices[b].execution_frequency,
  1193. // retail_price: prescription.advices[b].price.toString(),
  1194. remark: prescription.advices[b].remark,
  1195. day: prescription.advices[b].day,
  1196. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1197. single_dose_unit: prescription.advices[b].single_dose_unit,
  1198. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1199. medical_insurance_number: prescription.advices[b].med_list_codg,
  1200. id: prescription.advices[b].drug_id,
  1201. drug: prescription.advices[b].drug,
  1202. groupno: prescription.advices[b].groupno,
  1203. hosp_appr_flag: '1'
  1204. }
  1205. console.log('看看数据6:')
  1206. console.log(obj.prescribing_number_unit)
  1207. console.log(prescription.advices[b].drug.min_unit)
  1208. console.log(prescription.advices[b].drug.max_unit)
  1209. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  1210. obj['retail_price'] = prescription.advices[b].drug.min_price
  1211. console.log('1')
  1212. console.log(obj.retail_price)
  1213. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  1214. obj['retail_price'] = prescription.advices[b].drug.retail_price
  1215. console.log('2')
  1216. console.log(obj.retail_price)
  1217. } else {
  1218. console.log('3')
  1219. obj['retail_price'] = prescription.advices[b].drug.min_price
  1220. console.log(obj.retail_price)
  1221. }
  1222. tempAdvice.push(obj)
  1223. }
  1224. //项目
  1225. for (let b = 0; b < prescription.project.length; b++) {
  1226. let obj = {
  1227. id: 0,
  1228. project_id: prescription.project[b].project_id,
  1229. project_name: prescription.project[b].project.project_name,
  1230. single_dose: prescription.project[b].single_dose,
  1231. delivery_way: prescription.project[b].delivery_way,
  1232. execution_frequency: prescription.project[b].execution_frequency,
  1233. number_days: prescription.project[b].day,
  1234. total: prescription.project[b].count.toString(),
  1235. remark: prescription.project[b].remark,
  1236. medical_code: prescription.project[b].project.medical_code,
  1237. unit: prescription.project[b].unit,
  1238. type: prescription.project[b].type
  1239. }
  1240. if (prescription.project[b].type == 2) {
  1241. obj['statistical_classification'] = ""
  1242. obj['medical_code'] = prescription.project[b].project.medical_code
  1243. obj['project_name'] = prescription.project[b].project.project_name
  1244. obj['price'] = prescription.project[b].project.price
  1245. obj['project'] = prescription.project[b].project
  1246. } else if (prescription.project[b].type == 3) {
  1247. obj['statistical_classification'] = ''
  1248. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1249. obj['project_name'] = prescription.project[b].good_info.good_name
  1250. obj['price'] = prescription.project[b].good_info.packing_price
  1251. obj['good_info'] = prescription.project[b].good_info
  1252. }
  1253. tempProject.push(obj)
  1254. }
  1255. if (this.schedule.schedule_type == 1) {
  1256. var preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  1257. } else if (this.schedule.schedule_type == 2) {
  1258. var preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  1259. } else if (this.schedule.schedule_type == 3) {
  1260. var preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  1261. }
  1262. let index = i + 1
  1263. let obj = {
  1264. id: 0,
  1265. name: '处方' + index,
  1266. advices: tempAdvice,
  1267. project: tempProject,
  1268. addition: tempAddition,
  1269. order_status: 1,
  1270. pre_time: preTime,
  1271. med_type: ''
  1272. }
  1273. if (prescription.med_type == 0 || prescription.med_type == '') {
  1274. obj.med_type = ''
  1275. } else {
  1276. obj.med_type = parseInt(prescription.med_type)
  1277. }
  1278. if (obj.med_type == 0 || obj.med_type == '') {
  1279. obj.med_type = 14
  1280. }
  1281. this.prescriptions.push(obj)
  1282. }
  1283. } else {
  1284. let obj = {
  1285. id: 0,
  1286. name: '处方' + 1,
  1287. advices: [],
  1288. project: [],
  1289. addition: [],
  1290. order_status: 0,
  1291. pre_time: nowTime,
  1292. med_type: ''
  1293. }
  1294. obj.med_type = 14
  1295. this.prescriptions.push(obj)
  1296. }
  1297. }
  1298. console.log("~~~~~~~~---------")
  1299. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  1300. }
  1301. })
  1302. },unique(array) {
  1303. // res用来存储结果
  1304. var res = []
  1305. for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
  1306. for (var j = 0, resLen = res.length; j < resLen; j++) {
  1307. if (array[i].id === res[j].id && array[i].price === res[j].price) {
  1308. break
  1309. }
  1310. }
  1311. // 如果array[i]是唯一的,那么执行完循环,j等于resLen
  1312. if (j === resLen) {
  1313. res.push(array[i])
  1314. }
  1315. }
  1316. return res
  1317. },
  1318. choosePatient(val) {
  1319. this.current_data = val
  1320. if (this.titleType == '电子病历') {
  1321. if (this.$refs.child.watchSign > 2) {
  1322. this.$confirm('是否保存当前病例', '保存', {
  1323. confirmButtonText: '确 定',
  1324. cancelButtonText: '取 消',
  1325. type: 'warning'
  1326. }).then(() => {
  1327. this.$refs.child.createCaseHistory(this.newPatientId)
  1328. this.patientid = val.id
  1329. let params = {
  1330. 'record_date': this.record_date,
  1331. 'patient_id': val.id,
  1332. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1333. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  1334. 'p_type': 1
  1335. }
  1336. var nowDate = new Date()
  1337. var nowYear = nowDate.getFullYear()
  1338. var nowMonth = nowDate.getMonth() + 1
  1339. var nowDay = nowDate.getDate()
  1340. var hours = nowDate.getHours()
  1341. var min = nowDate.getMinutes()
  1342. var nowTime =
  1343. nowYear +
  1344. '-' +
  1345. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1346. '-' +
  1347. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1348. ':' + (min < 10 ? '0' + min : min)
  1349. getPatientInfo(params).then(response => {
  1350. if (response.data.state == 0) {
  1351. this.$message.error(response.data.msg)
  1352. return false
  1353. } else {
  1354. if (response.data.data.sch_prescriptions == null) {
  1355. response.data.data.sch_prescriptions = []
  1356. }
  1357. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1358. if (response.data.data.sch_prescriptions[i].advices == null) {
  1359. response.data.data.sch_prescriptions[i].advices = []
  1360. }
  1361. if (response.data.data.sch_prescriptions[i].project == null) {
  1362. response.data.data.sch_prescriptions[i].project = []
  1363. }
  1364. }
  1365. this.prescriptions = []
  1366. this.month_prescriptions = []
  1367. // var month_prescriptions = response.data.data.month_prescriptions
  1368. // this.setMonthPrescription(month_prescriptions)
  1369. this.patientInfo = response.data.data.xt_info
  1370. this.hisPatientInfo = response.data.data.his_info
  1371. this.case_history = response.data.data.case_history
  1372. this.info = response.data.data.info
  1373. this.last_info = response.data.data.last_info
  1374. this.schedule = response.data.data.schedule
  1375. this.doctors = response.data.data.doctors
  1376. this.department = response.data.data.department
  1377. for (let i = 0; i < this.doctors.length; i++) {
  1378. if (this.doctors[i].user_type == 1) {
  1379. this.doctors.splice(i, 1)
  1380. }
  1381. }
  1382. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  1383. if (this.case_history.breathing <= 0) {
  1384. this.case_history.breathing = ''
  1385. }
  1386. if (this.case_history.sick <= 0) {
  1387. this.case_history.sick = ''
  1388. }
  1389. if (this.case_history.diagnose <= 0) {
  1390. this.case_history.diagnose = ''
  1391. }
  1392. if (this.case_history.temperature <= 0) {
  1393. this.case_history.temperature = ''
  1394. }
  1395. if (this.case_history.blood_sugar <= 0) {
  1396. this.case_history.blood_sugar = ''
  1397. }
  1398. if (this.case_history.pulse <= 0) {
  1399. this.case_history.pulse = ''
  1400. }
  1401. if (this.case_history.sbp <= 0) {
  1402. this.case_history.sbp = ''
  1403. }
  1404. if (this.case_history.dbp <= 0) {
  1405. this.case_history.dbp = ''
  1406. }
  1407. if (this.case_history.height <= 0) {
  1408. this.case_history.height = ''
  1409. }
  1410. if (this.case_history.blood_fat <= 0) {
  1411. this.case_history.blood_fat = ''
  1412. }
  1413. if (this.case_history.sick_type <= 0) {
  1414. this.case_history.sick_type = ''
  1415. }
  1416. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  1417. if (this.case_history.is_infect == 1) {
  1418. this.case_history.is_infect = true
  1419. } else {
  1420. this.case_history.is_infect = false
  1421. }
  1422. this.case_history.primary_disease = this.case_history.primary_disease
  1423. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  1424. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  1425. this.case_history.physical_examination = this.case_history.physical_examination
  1426. this.case_history.special_inspection = this.case_history.special_inspection
  1427. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  1428. this.prescriptionList = response.data.data.prescription
  1429. if (response.data.data.prescription.length > 0) {
  1430. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1431. var prescription = response.data.data.prescription[i]
  1432. let tempAdvice = []
  1433. let tempProject = []
  1434. let tempAddition = []
  1435. var is_medicine = false
  1436. //药品
  1437. for (let b = 0; b < prescription.advices.length; b++) {
  1438. let obj = {
  1439. advice_id: prescription.advices[b].id,
  1440. drug_name: prescription.advices[b].advice_name,
  1441. single_dose: prescription.advices[b].single_dose,
  1442. delivery_way: prescription.advices[b].delivery_way,
  1443. execution_frequency: prescription.advices[b].execution_frequency,
  1444. retail_price: prescription.advices[b].price.toString(),
  1445. remark: prescription.advices[b].remark,
  1446. day: prescription.advices[b].day,
  1447. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1448. single_dose_unit: prescription.advices[b].single_dose_unit,
  1449. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1450. medical_insurance_number: prescription.advices[b].med_list_codg,
  1451. id: prescription.advices[b].drug_id,
  1452. drug: prescription.advices[b].drug,
  1453. groupno: prescription.advices[b].groupno,
  1454. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  1455. is_medicine: prescription.advices[b].is_medicine,
  1456. }
  1457. tempAdvice.push(obj)
  1458. if (prescription.advices[b].is_medicine == 1){
  1459. is_medicine = true
  1460. }
  1461. }
  1462. //项目
  1463. for (let b = 0; b < prescription.project.length; b++) {
  1464. let obj = {
  1465. id: prescription.project[b].id,
  1466. project_id: prescription.project[b].project_id,
  1467. project_name: prescription.project[b].project.project_name,
  1468. single_dose: prescription.project[b].single_dose,
  1469. delivery_way: prescription.project[b].delivery_way,
  1470. execution_frequency: prescription.project[b].execution_frequency,
  1471. number_days: prescription.project[b].day,
  1472. total: prescription.project[b].count.toString(),
  1473. price: prescription.project[b].price,
  1474. remark: prescription.project[b].remark,
  1475. medical_code: prescription.project[b].project.medical_code,
  1476. unit: prescription.project[b].unit,
  1477. type: prescription.project[b].type,
  1478. }
  1479. if (prescription.project[b].type == 2) {
  1480. obj['statistical_classification'] = prescription.project[b].team.project_team
  1481. obj['medical_code'] = prescription.project[b].project.medical_code
  1482. obj['project_name'] = prescription.project[b].project.project_name
  1483. obj['project'] = prescription.project[b].project
  1484. } else if (prescription.project[b].type == 3) {
  1485. if(prescription.project[b].team_id > 0){
  1486. obj['statistical_classification'] = prescription.project[b].team.project_team
  1487. }
  1488. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1489. obj['project_name'] = prescription.project[b].good_info.good_name
  1490. obj['good_info'] = prescription.project[b].good_info
  1491. }
  1492. tempProject.push(obj)
  1493. }
  1494. //附加收费
  1495. // for (let b = 0; b < prescription.addition.length; b++) {
  1496. // let obj = {
  1497. // id: prescription.addition[b].id,
  1498. // item_name: prescription.addition[b].item_name,
  1499. // price: prescription.addition[b].price,
  1500. // count: prescription.addition[b].count,
  1501. // item_id: prescription.addition[b].item_id
  1502. // }
  1503. // tempAddition.push(obj)
  1504. // }
  1505. var preTime = ''
  1506. if (prescription.pre_time == 0) {
  1507. // preTime = nowTime
  1508. if (this.schedule.schedule_type == 1) {
  1509. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  1510. } else if (this.schedule.schedule_type == 2) {
  1511. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  1512. } else if (this.schedule.schedule_type == 3) {
  1513. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  1514. }
  1515. } else {
  1516. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  1517. }
  1518. let index = i + 1
  1519. let obj = {
  1520. id: prescription.id,
  1521. name: '处方' + index,
  1522. advices: tempAdvice,
  1523. project: tempProject,
  1524. addition: tempAddition,
  1525. order_status: prescription.order_status,
  1526. pre_time: preTime,
  1527. med_type: parseInt(prescription.med_type),
  1528. is_medicine_status: is_medicine,
  1529. }
  1530. this.prescriptions.push(obj)
  1531. }
  1532. } else {
  1533. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  1534. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1535. var prescription = response.data.data.sch_prescriptions[i]
  1536. let tempAdvice = []
  1537. let tempProject = []
  1538. let tempAddition = []
  1539. //药品
  1540. for (let b = 0; b < prescription.advices.length; b++) {
  1541. let obj = {
  1542. advice_id: 0,
  1543. drug_name: prescription.advices[b].advice_name,
  1544. single_dose: prescription.advices[b].single_dose,
  1545. delivery_way: prescription.advices[b].delivery_way,
  1546. execution_frequency: prescription.advices[b].execution_frequency,
  1547. // retail_price: prescription.advices[b].price.toString(),
  1548. remark: prescription.advices[b].remark,
  1549. day: prescription.advices[b].day,
  1550. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1551. single_dose_unit: prescription.advices[b].single_dose_unit,
  1552. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1553. medical_insurance_number: prescription.advices[b].med_list_codg,
  1554. id: prescription.advices[b].drug_id,
  1555. drug: prescription.advices[b].drug,
  1556. groupno: prescription.advices[b].groupno,
  1557. hosp_appr_flag: '1'
  1558. }
  1559. console.log('看看数据1:')
  1560. console.log(obj.prescribing_number_unit)
  1561. console.log(prescription.advices[b].drug.min_unit)
  1562. console.log(prescription.advices[b].drug.max_unit)
  1563. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  1564. obj['retail_price'] = prescription.advices[b].drug.min_price
  1565. console.log('1')
  1566. console.log(obj.retail_price)
  1567. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  1568. obj['retail_price'] = prescription.advices[b].drug.retail_price
  1569. console.log('2')
  1570. console.log(obj.retail_price)
  1571. } else {
  1572. console.log('3')
  1573. obj['retail_price'] = prescription.advices[b].drug.min_price
  1574. console.log(obj.retail_price)
  1575. }
  1576. tempAdvice.push(obj)
  1577. }
  1578. //项目
  1579. for (let b = 0; b < prescription.project.length; b++) {
  1580. let obj = {
  1581. id: 0,
  1582. project_id: prescription.project[b].project_id,
  1583. project_name: prescription.project[b].project.project_name,
  1584. single_dose: prescription.project[b].single_dose,
  1585. delivery_way: prescription.project[b].delivery_way,
  1586. execution_frequency: prescription.project[b].execution_frequency,
  1587. number_days: prescription.project[b].day,
  1588. total: prescription.project[b].count.toString(),
  1589. remark: prescription.project[b].remark,
  1590. medical_code: prescription.project[b].project.medical_code,
  1591. unit: prescription.project[b].unit,
  1592. type: prescription.project[b].type
  1593. }
  1594. if (prescription.project[b].type == 2) {
  1595. obj['statistical_classification'] = ""
  1596. obj['medical_code'] = prescription.project[b].project.medical_code
  1597. obj['project_name'] = prescription.project[b].project.project_name
  1598. obj['price'] = prescription.project[b].project.price
  1599. obj['project'] = prescription.project[b].project
  1600. } else if (prescription.project[b].type == 3) {
  1601. obj['statistical_classification'] = ''
  1602. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1603. obj['project_name'] = prescription.project[b].good_info.good_name
  1604. obj['price'] = prescription.project[b].good_info.packing_price
  1605. obj['good_info'] = prescription.project[b].good_info
  1606. }
  1607. tempProject.push(obj)
  1608. }
  1609. // var preTime = nowTime
  1610. var preTime = ''
  1611. if (this.schedule.schedule_type == 1) {
  1612. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  1613. } else if (this.schedule.schedule_type == 2) {
  1614. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  1615. } else if (this.schedule.schedule_type == 3) {
  1616. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  1617. }
  1618. let index = i + 1
  1619. let obj = {
  1620. id: 0,
  1621. name: '处方' + index,
  1622. advices: tempAdvice,
  1623. project: tempProject,
  1624. addition: tempAddition,
  1625. order_status: 1,
  1626. pre_time: preTime,
  1627. med_type: ''
  1628. }
  1629. if (prescription.med_type == 0 || prescription.med_type == '') {
  1630. obj.med_type = ''
  1631. } else {
  1632. obj.med_type = parseInt(prescription.med_type)
  1633. }
  1634. if (obj.med_type == 0 || obj.med_type == '') {
  1635. obj.med_type = 14
  1636. }
  1637. this.prescriptions.push(obj)
  1638. }
  1639. } else {
  1640. let obj = {
  1641. id: 0,
  1642. name: '处方' + 1,
  1643. advices: [],
  1644. project: [],
  1645. addition: [],
  1646. order_status: 0,
  1647. pre_time: nowTime,
  1648. med_type: '',
  1649. is_medicine_status:false,
  1650. }
  1651. obj.med_type = 14
  1652. this.prescriptions.push(obj)
  1653. // if(response.data.data.count <= 1 ){
  1654. // if(response.data.data.last_prescriptions.length == 0){
  1655. // let obj = {
  1656. // id: 0,
  1657. // name: '处方' + 1,
  1658. // advices: [],
  1659. // project: [],
  1660. // addition: [],
  1661. // order_status: 0,
  1662. // pre_time: nowTime,
  1663. //
  1664. // };
  1665. // this.prescriptions.push(obj)
  1666. //
  1667. //
  1668. // }else {
  1669. // for (let i = 0; i < response.data.data.last_prescriptions.length; i++) {
  1670. // var prescription = response.data.data.last_prescriptions[i];
  1671. // let tempAdvice = [];
  1672. // let tempProject = [];
  1673. // let tempAddition = [];
  1674. //
  1675. // //药品
  1676. // for (let b = 0; b < prescription.advices.length; b++) {
  1677. // let obj = {
  1678. // advice_id:0,
  1679. // drug_name: prescription.advices[b].advice_name,
  1680. // single_dose: prescription.advices[b].single_dose,
  1681. // delivery_way: prescription.advices[b].delivery_way,
  1682. // execution_frequency: prescription.advices[b].execution_frequency,
  1683. // retail_price: prescription.advices[b].price.toString(),
  1684. // remark: prescription.advices[b].remark,
  1685. // day: prescription.advices[b].day,
  1686. // prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1687. // single_dose_unit: prescription.advices[b].single_dose_unit,
  1688. // prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1689. // medical_insurance_number: prescription.advices[b].med_list_codg,
  1690. // id: prescription.advices[b].drug_id,
  1691. // drug:prescription.advices[b].drug
  1692. //
  1693. // };
  1694. // tempAdvice.push(obj)
  1695. // }
  1696. //
  1697. // //项目
  1698. // for (let b = 0; b < prescription.project.length; b++) {
  1699. // let obj = {
  1700. // id:0,
  1701. // project_id: prescription.project[b].project_id,
  1702. // project_name: prescription.project[b].project.project_name,
  1703. // statistical_classification: prescription.project[b].project.statistical_classification,
  1704. // single_dose: prescription.project[b].single_dose,
  1705. // delivery_way: prescription.project[b].delivery_way,
  1706. // execution_frequency: prescription.project[b].execution_frequency,
  1707. // number_days: prescription.project[b].day,
  1708. // total: prescription.project[b].count.toString(),
  1709. // price: prescription.project[b].price,
  1710. // remark: prescription.project[b].remark,
  1711. // medical_code: prescription.project[b].project.medical_code,
  1712. // unit: prescription.project[b].project.unit,
  1713. // type: prescription.project[b].type
  1714. // };
  1715. //
  1716. // if (prescription.project[b].type == 2) {
  1717. // obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1718. // obj['medical_code'] = prescription.project[b].project.medical_code
  1719. // obj['project_name'] = prescription.project[b].project.project_name
  1720. //
  1721. // } else if (prescription.project[b].type == 3) {
  1722. // obj['statistical_classification'] = ""
  1723. // obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1724. // obj['project_name'] = prescription.project[b].good_info.good_name
  1725. // }
  1726. // tempProject.push(obj)
  1727. // }
  1728. //
  1729. // //附加收费
  1730. // for (let b = 0; b < prescription.addition.length; b++) {
  1731. // let obj = {
  1732. // item_name: prescription.addition[b].item_name,
  1733. // price: prescription.addition[b].price,
  1734. // count: prescription.addition[b].count,
  1735. // item_id: prescription.addition[b].item_id,
  1736. // };
  1737. // tempAddition.push(obj)
  1738. // }
  1739. //
  1740. // var preTime = nowTime
  1741. //
  1742. // let index = i + 1;
  1743. // let obj = {
  1744. // id: 0,
  1745. // name: '处方' + index,
  1746. // advices: tempAdvice,
  1747. // project: tempProject,
  1748. // addition: tempAddition,
  1749. // order_status: 1,
  1750. // pre_time: preTime
  1751. // };
  1752. // this.prescriptions.push(obj)
  1753. // }
  1754. // }
  1755. // }
  1756. // else{
  1757. // let obj = {
  1758. // id: 0,
  1759. // name: '处方' + 1,
  1760. // advices: [],
  1761. // project: [],
  1762. // addition: [],
  1763. // order_status: 0,
  1764. // pre_time: nowTime,
  1765. //
  1766. // };
  1767. // this.prescriptions.push(obj)
  1768. // }
  1769. }
  1770. }
  1771. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  1772. this.$refs.child.watchSign = 0
  1773. }
  1774. })
  1775. this.$refs.child.watchSign = 0
  1776. }).catch(() => {
  1777. this.patientid = val.id
  1778. let params = {
  1779. 'record_date': this.record_date,
  1780. 'patient_id': val.id,
  1781. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1782. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  1783. 'p_type': 1
  1784. }
  1785. getPatientInfo(params).then(response => {
  1786. if (response.data.state == 0) {
  1787. this.$message.error(response.data.msg)
  1788. return false
  1789. } else {
  1790. if (response.data.data.sch_prescriptions == null) {
  1791. response.data.data.sch_prescriptions = []
  1792. }
  1793. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1794. if (response.data.data.sch_prescriptions[i].advices == null) {
  1795. response.data.data.sch_prescriptions[i].advices = []
  1796. }
  1797. if (response.data.data.sch_prescriptions[i].project == null) {
  1798. response.data.data.sch_prescriptions[i].project = []
  1799. }
  1800. }
  1801. this.prescriptions = []
  1802. this.month_prescriptions = []
  1803. // var month_prescriptions = response.data.data.month_prescriptions
  1804. // this.setMonthPrescription(month_prescriptions)
  1805. this.patientInfo = response.data.data.xt_info
  1806. this.hisPatientInfo = response.data.data.his_info
  1807. this.case_history = response.data.data.case_history
  1808. this.info = response.data.data.info
  1809. this.last_info = response.data.data.last_info
  1810. this.doctors = response.data.data.doctors
  1811. this.department = response.data.data.department
  1812. for (let i = 0; i < this.doctors.length; i++) {
  1813. if (this.doctors[i].user_type == 1) {
  1814. this.doctors.splice(i, 1)
  1815. }
  1816. }
  1817. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  1818. if (this.case_history.breathing <= 0) {
  1819. this.case_history.breathing = ''
  1820. }
  1821. if (this.case_history.sick <= 0) {
  1822. this.case_history.sick = ''
  1823. }
  1824. if (this.case_history.diagnose <= 0) {
  1825. this.case_history.diagnose = ''
  1826. }
  1827. if (this.case_history.temperature <= 0) {
  1828. this.case_history.temperature = ''
  1829. }
  1830. if (this.case_history.blood_sugar <= 0) {
  1831. this.case_history.blood_sugar = ''
  1832. }
  1833. if (this.case_history.pulse <= 0) {
  1834. this.case_history.pulse = ''
  1835. }
  1836. if (this.case_history.sbp <= 0) {
  1837. this.case_history.sbp = ''
  1838. }
  1839. if (this.case_history.dbp <= 0) {
  1840. this.case_history.dbp = ''
  1841. }
  1842. if (this.case_history.height <= 0) {
  1843. this.case_history.height = ''
  1844. }
  1845. if (this.case_history.blood_fat <= 0) {
  1846. this.case_history.blood_fat = ''
  1847. }
  1848. if (this.case_history.sick_type <= 0) {
  1849. this.case_history.sick_type = ''
  1850. }
  1851. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  1852. if (this.case_history.is_infect == 1) {
  1853. this.case_history.is_infect = true
  1854. } else {
  1855. this.case_history.is_infect = false
  1856. }
  1857. this.case_history.primary_disease = this.case_history.primary_disease
  1858. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  1859. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  1860. this.case_history.physical_examination = this.case_history.physical_examination
  1861. this.case_history.special_inspection = this.case_history.special_inspection
  1862. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  1863. this.prescriptionList = response.data.data.prescription
  1864. if (response.data.data.prescription.length > 0) {
  1865. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1866. var prescription = response.data.data.prescription[i]
  1867. let tempAdvice = []
  1868. let tempProject = []
  1869. let tempAddition = []
  1870. var is_medicine = false
  1871. //药品
  1872. for (let b = 0; b < prescription.advices.length; b++) {
  1873. let obj = {
  1874. advice_id: prescription.advices[b].id,
  1875. drug_name: prescription.advices[b].advice_name,
  1876. single_dose: prescription.advices[b].single_dose,
  1877. delivery_way: prescription.advices[b].delivery_way,
  1878. execution_frequency: prescription.advices[b].execution_frequency,
  1879. retail_price: prescription.advices[b].price.toString(),
  1880. remark: prescription.advices[b].remark,
  1881. day: prescription.advices[b].day,
  1882. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1883. single_dose_unit: prescription.advices[b].single_dose_unit,
  1884. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1885. medical_insurance_number: prescription.advices[b].med_list_codg,
  1886. id: prescription.advices[b].drug_id,
  1887. drug: prescription.advices[b].drug,
  1888. groupno: prescription.advices[b].groupno,
  1889. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  1890. is_medicine: prescription.advices[b].is_medicine,
  1891. }
  1892. tempAdvice.push(obj)
  1893. if (prescription.advices[b].is_medicine == 1){
  1894. is_medicine = true
  1895. }
  1896. }
  1897. //项目
  1898. for (let b = 0; b < prescription.project.length; b++) {
  1899. let obj = {
  1900. id: prescription.project[b].id,
  1901. project_id: prescription.project[b].project_id,
  1902. project_name: prescription.project[b].project.project_name,
  1903. single_dose: prescription.project[b].single_dose,
  1904. delivery_way: prescription.project[b].delivery_way,
  1905. execution_frequency: prescription.project[b].execution_frequency,
  1906. number_days: prescription.project[b].day,
  1907. total: prescription.project[b].count.toString(),
  1908. price: prescription.project[b].price,
  1909. remark: prescription.project[b].remark,
  1910. medical_code: prescription.project[b].project.medical_code,
  1911. unit: prescription.project[b].unit,
  1912. type: prescription.project[b].type,
  1913. }
  1914. if (prescription.project[b].type == 2) {
  1915. obj['statistical_classification'] = prescription.project[b].team.project_team
  1916. obj['medical_code'] = prescription.project[b].project.medical_code
  1917. obj['project_name'] = prescription.project[b].project.project_name
  1918. obj['project'] = prescription.project[b].project
  1919. } else if (prescription.project[b].type == 3) {
  1920. if(prescription.project[b].team_id > 0){
  1921. obj['statistical_classification'] = prescription.project[b].team.project_team
  1922. }
  1923. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1924. obj['project_name'] = prescription.project[b].good_info.good_name
  1925. obj['good_info'] = prescription.project[b].good_info
  1926. }
  1927. tempProject.push(obj)
  1928. }
  1929. //附加收费
  1930. // for (let b = 0; b < prescription.addition.length; b++) {
  1931. // let obj = {
  1932. // id: prescription.addition[b].id,
  1933. // item_name: prescription.addition[b].item_name,
  1934. // price: prescription.addition[b].price,
  1935. // count: prescription.addition[b].count,
  1936. // item_id: prescription.addition[b].item_id
  1937. // }
  1938. // tempAddition.push(obj)
  1939. // }
  1940. var preTime = ''
  1941. if (prescription.pre_time == 0) {
  1942. preTime = nowTime
  1943. } else {
  1944. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  1945. }
  1946. let index = i + 1
  1947. let obj = {
  1948. id: prescription.id,
  1949. name: '处方' + index,
  1950. advices: tempAdvice,
  1951. project: tempProject,
  1952. addition: tempAddition,
  1953. order_status: prescription.order_status,
  1954. pre_time: preTime,
  1955. med_type: parseInt(prescription.med_type),
  1956. is_medicine_status: is_medicine,
  1957. }
  1958. this.prescriptions.push(obj)
  1959. }
  1960. } else {
  1961. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  1962. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  1963. var prescription = response.data.data.sch_prescriptions[i]
  1964. let tempAdvice = []
  1965. let tempProject = []
  1966. let tempAddition = []
  1967. //药品
  1968. for (let b = 0; b < prescription.advices.length; b++) {
  1969. let obj = {
  1970. advice_id: 0,
  1971. drug_name: prescription.advices[b].advice_name,
  1972. single_dose: prescription.advices[b].single_dose,
  1973. delivery_way: prescription.advices[b].delivery_way,
  1974. execution_frequency: prescription.advices[b].execution_frequency,
  1975. // retail_price: prescription.advices[b].price.toString(),
  1976. remark: prescription.advices[b].remark,
  1977. day: prescription.advices[b].day,
  1978. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1979. single_dose_unit: prescription.advices[b].single_dose_unit,
  1980. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1981. medical_insurance_number: prescription.advices[b].med_list_codg,
  1982. id: prescription.advices[b].drug_id,
  1983. drug: prescription.advices[b].drug,
  1984. groupno: prescription.advices[b].groupno,
  1985. hosp_appr_flag: '1'
  1986. }
  1987. console.log('看看数据2:')
  1988. console.log(obj.prescribing_number_unit)
  1989. console.log(prescription.advices[b].drug.min_unit)
  1990. console.log(prescription.advices[b].drug.max_unit)
  1991. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  1992. obj['retail_price'] = prescription.advices[b].drug.min_price
  1993. console.log('1')
  1994. console.log(obj.retail_price)
  1995. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  1996. obj['retail_price'] = prescription.advices[b].drug.retail_price
  1997. console.log('2')
  1998. console.log(obj.retail_price)
  1999. } else {
  2000. console.log('3')
  2001. obj['retail_price'] = prescription.advices[b].drug.min_price
  2002. console.log(obj.retail_price)
  2003. }
  2004. tempAdvice.push(obj)
  2005. }
  2006. //项目
  2007. for (let b = 0; b < prescription.project.length; b++) {
  2008. let obj = {
  2009. id: 0,
  2010. project_id: prescription.project[b].project_id,
  2011. project_name: prescription.project[b].project.project_name,
  2012. single_dose: prescription.project[b].single_dose,
  2013. delivery_way: prescription.project[b].delivery_way,
  2014. execution_frequency: prescription.project[b].execution_frequency,
  2015. number_days: prescription.project[b].day,
  2016. total: prescription.project[b].count.toString(),
  2017. remark: prescription.project[b].remark,
  2018. medical_code: prescription.project[b].project.medical_code,
  2019. unit: prescription.project[b].unit,
  2020. type: prescription.project[b].type,
  2021. }
  2022. if (prescription.project[b].type == 2) {
  2023. obj['statistical_classification'] =""
  2024. obj['medical_code'] = prescription.project[b].project.medical_code
  2025. obj['project_name'] = prescription.project[b].project.project_name
  2026. obj['price'] = prescription.project[b].project.price
  2027. obj['project'] = prescription.project[b].project
  2028. } else if (prescription.project[b].type == 3) {
  2029. obj['statistical_classification'] = ''
  2030. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2031. obj['project_name'] = prescription.project[b].good_info.good_name
  2032. obj['price'] = prescription.project[b].good_info.packing_price
  2033. obj['good_info'] = prescription.project[b].good_info
  2034. }
  2035. tempProject.push(obj)
  2036. }
  2037. var preTime = nowTime
  2038. let index = i + 1
  2039. let obj = {
  2040. id: 0,
  2041. name: '处方' + index,
  2042. advices: tempAdvice,
  2043. project: tempProject,
  2044. addition: tempAddition,
  2045. order_status: 1,
  2046. pre_time: preTime,
  2047. med_type: '',
  2048. is_medicine_status:false,
  2049. }
  2050. if (prescription.med_type == 0 || prescription.med_type == '') {
  2051. obj.med_type = ''
  2052. } else {
  2053. obj.med_type = parseInt(prescription.med_type)
  2054. }
  2055. if (obj.med_type == 0 || obj.med_type == '') {
  2056. obj.med_type = 14
  2057. }
  2058. this.prescriptions.push(obj)
  2059. }
  2060. } else {
  2061. let obj = {
  2062. id: 0,
  2063. name: '处方' + 1,
  2064. advices: [],
  2065. project: [],
  2066. addition: [],
  2067. order_status: 0,
  2068. pre_time: nowTime,
  2069. med_type: '',
  2070. is_medicine_status:false
  2071. }
  2072. obj.med_type = 14
  2073. this.prescriptions.push(obj)
  2074. // if(response.data.data.count <= 1 ){
  2075. // if(response.data.data.last_prescriptions.length == 0){
  2076. // let obj = {
  2077. // id: 0,
  2078. // name: '处方' + 1,
  2079. // advices: [],
  2080. // project: [],
  2081. // addition: [],
  2082. // order_status: 0,
  2083. // pre_time: nowTime,
  2084. //
  2085. // };
  2086. // this.prescriptions.push(obj)
  2087. //
  2088. //
  2089. // }else {
  2090. // for (let i = 0; i < response.data.data.last_prescriptions.length; i++) {
  2091. // var prescription = response.data.data.last_prescriptions[i];
  2092. // let tempAdvice = [];
  2093. // let tempProject = [];
  2094. // let tempAddition = [];
  2095. //
  2096. // //药品
  2097. // for (let b = 0; b < prescription.advices.length; b++) {
  2098. // let obj = {
  2099. // advice_id:0,
  2100. // drug_name: prescription.advices[b].advice_name,
  2101. // single_dose: prescription.advices[b].single_dose,
  2102. // delivery_way: prescription.advices[b].delivery_way,
  2103. // execution_frequency: prescription.advices[b].execution_frequency,
  2104. // retail_price: prescription.advices[b].price.toString(),
  2105. // remark: prescription.advices[b].remark,
  2106. // day: prescription.advices[b].day,
  2107. // prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2108. // single_dose_unit: prescription.advices[b].single_dose_unit,
  2109. // prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2110. // medical_insurance_number: prescription.advices[b].med_list_codg,
  2111. // id: prescription.advices[b].drug_id,
  2112. // drug:prescription.advices[b].drug
  2113. //
  2114. // };
  2115. // tempAdvice.push(obj)
  2116. // }
  2117. //
  2118. // //项目
  2119. // for (let b = 0; b < prescription.project.length; b++) {
  2120. // let obj = {
  2121. // id:0,
  2122. // project_id: prescription.project[b].project_id,
  2123. // project_name: prescription.project[b].project.project_name,
  2124. // statistical_classification: prescription.project[b].project.statistical_classification,
  2125. // single_dose: prescription.project[b].single_dose,
  2126. // delivery_way: prescription.project[b].delivery_way,
  2127. // execution_frequency: prescription.project[b].execution_frequency,
  2128. // number_days: prescription.project[b].day,
  2129. // total: prescription.project[b].count.toString(),
  2130. // price: prescription.project[b].price,
  2131. // remark: prescription.project[b].remark,
  2132. // medical_code: prescription.project[b].project.medical_code,
  2133. // unit: prescription.project[b].project.unit,
  2134. // type: prescription.project[b].type
  2135. // };
  2136. //
  2137. // if (prescription.project[b].type == 2) {
  2138. // obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  2139. // obj['medical_code'] = prescription.project[b].project.medical_code
  2140. // obj['project_name'] = prescription.project[b].project.project_name
  2141. //
  2142. // } else if (prescription.project[b].type == 3) {
  2143. // obj['statistical_classification'] = ""
  2144. // obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2145. // obj['project_name'] = prescription.project[b].good_info.good_name
  2146. // }
  2147. // tempProject.push(obj)
  2148. // }
  2149. //
  2150. // //附加收费
  2151. // for (let b = 0; b < prescription.addition.length; b++) {
  2152. // let obj = {
  2153. // item_name: prescription.addition[b].item_name,
  2154. // price: prescription.addition[b].price,
  2155. // count: prescription.addition[b].count,
  2156. // item_id: prescription.addition[b].item_id,
  2157. // };
  2158. // tempAddition.push(obj)
  2159. // }
  2160. //
  2161. // var preTime = nowTime
  2162. //
  2163. // let index = i + 1;
  2164. // let obj = {
  2165. // id: 0,
  2166. // name: '处方' + index,
  2167. // advices: tempAdvice,
  2168. // project: tempProject,
  2169. // addition: tempAddition,
  2170. // order_status: 1,
  2171. // pre_time: preTime
  2172. // };
  2173. // this.prescriptions.push(obj)
  2174. // }
  2175. // }
  2176. // }else{
  2177. // let obj = {
  2178. // id: 0,
  2179. // name: '处方' + 1,
  2180. // advices: [],
  2181. // project: [],
  2182. // addition: [],
  2183. // order_status: 0,
  2184. // pre_time: nowTime,
  2185. //
  2186. // };
  2187. // this.prescriptions.push(obj)
  2188. // }
  2189. }
  2190. }
  2191. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  2192. this.$refs.child.watchSign = 0
  2193. }
  2194. })
  2195. })
  2196. this.$refs.child.watchSign = 0
  2197. } else {
  2198. this.patientid = val.id
  2199. let params = {
  2200. 'record_date': this.record_date,
  2201. 'patient_id': val.id,
  2202. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  2203. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  2204. 'p_type': 1
  2205. }
  2206. getPatientInfo(params).then(response => {
  2207. if (response.data.state == 0) {
  2208. this.$message.error(response.data.msg)
  2209. return false
  2210. } else {
  2211. if (response.data.data.sch_prescriptions == null) {
  2212. response.data.data.sch_prescriptions = []
  2213. }
  2214. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  2215. if (response.data.data.sch_prescriptions[i].advices == null) {
  2216. response.data.data.sch_prescriptions[i].advices = []
  2217. }
  2218. if (response.data.data.sch_prescriptions[i].project == null) {
  2219. response.data.data.sch_prescriptions[i].project = []
  2220. }
  2221. }
  2222. this.prescriptions = []
  2223. this.month_prescriptions = []
  2224. // var month_prescriptions = response.data.data.month_prescriptions
  2225. // this.setMonthPrescription(month_prescriptions)
  2226. this.patientInfo = response.data.data.xt_info
  2227. this.hisPatientInfo = response.data.data.his_info
  2228. this.case_history = response.data.data.case_history
  2229. this.info = response.data.data.info
  2230. this.last_info = response.data.data.last_info
  2231. this.doctors = response.data.data.doctors
  2232. this.department = response.data.data.department
  2233. for (let i = 0; i < this.doctors.length; i++) {
  2234. if (this.doctors[i].user_type == 1) {
  2235. this.doctors.splice(i, 1)
  2236. }
  2237. }
  2238. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  2239. if (this.case_history.breathing <= 0) {
  2240. this.case_history.breathing = ''
  2241. }
  2242. if (this.case_history.sick <= 0) {
  2243. this.case_history.sick = ''
  2244. }
  2245. if (this.case_history.diagnose <= 0) {
  2246. this.case_history.diagnose = ''
  2247. }
  2248. if (this.case_history.temperature <= 0) {
  2249. this.case_history.temperature = ''
  2250. }
  2251. if (this.case_history.blood_sugar <= 0) {
  2252. this.case_history.blood_sugar = ''
  2253. }
  2254. if (this.case_history.pulse <= 0) {
  2255. this.case_history.pulse = ''
  2256. }
  2257. if (this.case_history.sbp <= 0) {
  2258. this.case_history.sbp = ''
  2259. }
  2260. if (this.case_history.dbp <= 0) {
  2261. this.case_history.dbp = ''
  2262. }
  2263. if (this.case_history.height <= 0) {
  2264. this.case_history.height = ''
  2265. }
  2266. if (this.case_history.blood_fat <= 0) {
  2267. this.case_history.blood_fat = ''
  2268. }
  2269. if (this.case_history.sick_type <= 0) {
  2270. this.case_history.sick_type = ''
  2271. }
  2272. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  2273. if (this.case_history.is_infect == 1) {
  2274. this.case_history.is_infect = true
  2275. } else {
  2276. this.case_history.is_infect = false
  2277. }
  2278. this.case_history.primary_disease = this.case_history.primary_disease
  2279. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  2280. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  2281. this.case_history.physical_examination = this.case_history.physical_examination
  2282. this.case_history.special_inspection = this.case_history.special_inspection
  2283. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  2284. this.prescriptionList = response.data.data.prescription
  2285. if (response.data.data.prescription.length > 0) {
  2286. for (let i = 0; i < response.data.data.prescription.length; i++) {
  2287. var prescription = response.data.data.prescription[i]
  2288. let tempAdvice = []
  2289. let tempProject = []
  2290. let tempAddition = []
  2291. var is_medicine = false
  2292. //药品
  2293. for (let b = 0; b < prescription.advices.length; b++) {
  2294. let obj = {
  2295. advice_id: prescription.advices[b].id,
  2296. drug_name: prescription.advices[b].advice_name,
  2297. single_dose: prescription.advices[b].single_dose,
  2298. delivery_way: prescription.advices[b].delivery_way,
  2299. execution_frequency: prescription.advices[b].execution_frequency,
  2300. retail_price: prescription.advices[b].price.toString(),
  2301. remark: prescription.advices[b].remark,
  2302. day: prescription.advices[b].day,
  2303. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2304. single_dose_unit: prescription.advices[b].single_dose_unit,
  2305. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2306. medical_insurance_number: prescription.advices[b].med_list_codg,
  2307. id: prescription.advices[b].drug_id,
  2308. drug: prescription.advices[b].drug,
  2309. groupno: prescription.advices[b].groupno,
  2310. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  2311. is_medicine: prescription.advices[b].is_medicine,
  2312. }
  2313. tempAdvice.push(obj)
  2314. if (prescription.advices[b].is_medicine == 1){
  2315. is_medicine = true
  2316. }
  2317. }
  2318. //项目
  2319. for (let b = 0; b < prescription.project.length; b++) {
  2320. let obj = {
  2321. id: prescription.project[b].id,
  2322. project_id: prescription.project[b].project_id,
  2323. project_name: prescription.project[b].project.project_name,
  2324. single_dose: prescription.project[b].single_dose,
  2325. delivery_way: prescription.project[b].delivery_way,
  2326. execution_frequency: prescription.project[b].execution_frequency,
  2327. number_days: prescription.project[b].day,
  2328. total: prescription.project[b].count.toString(),
  2329. price: prescription.project[b].price,
  2330. remark: prescription.project[b].remark,
  2331. medical_code: prescription.project[b].project.medical_code,
  2332. unit: prescription.project[b].unit,
  2333. type: prescription.project[b].type,
  2334. }
  2335. if (prescription.project[b].type == 2) {
  2336. obj['statistical_classification'] = prescription.project[b].team.project_team
  2337. obj['medical_code'] = prescription.project[b].project.medical_code
  2338. obj['project_name'] = prescription.project[b].project.project_name
  2339. obj['project'] = prescription.project[b].project
  2340. } else if (prescription.project[b].type == 3) {
  2341. if(prescription.project[b].team_id > 0){
  2342. obj['statistical_classification'] = prescription.project[b].team.project_team
  2343. }
  2344. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2345. obj['project_name'] = prescription.project[b].good_info.good_name
  2346. obj['good_info'] = prescription.project[b].good_info
  2347. }
  2348. tempProject.push(obj)
  2349. }
  2350. //附加收费
  2351. // for (let b = 0; b < prescription.addition.length; b++) {
  2352. // let obj = {
  2353. // id: prescription.addition[b].id,
  2354. // item_name: prescription.addition[b].item_name,
  2355. // price: prescription.addition[b].price,
  2356. // count: prescription.addition[b].count,
  2357. // item_id: prescription.addition[b].item_id
  2358. // }
  2359. // tempAddition.push(obj)
  2360. // }
  2361. var preTime = ''
  2362. if (prescription.pre_time == 0) {
  2363. preTime = nowTime
  2364. } else {
  2365. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  2366. }
  2367. let index = i + 1
  2368. let obj = {
  2369. id: prescription.id,
  2370. name: '处方' + index,
  2371. advices: tempAdvice,
  2372. project: tempProject,
  2373. addition: tempAddition,
  2374. order_status: prescription.order_status,
  2375. pre_time: preTime,
  2376. med_type: parseInt(prescription.med_type),
  2377. is_medicine_status: is_medicine,
  2378. }
  2379. this.prescriptions.push(obj)
  2380. }
  2381. } else {
  2382. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  2383. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  2384. var prescription = response.data.data.sch_prescriptions[i]
  2385. let tempAdvice = []
  2386. let tempProject = []
  2387. let tempAddition = []
  2388. //药品
  2389. for (let b = 0; b < prescription.advices.length; b++) {
  2390. let index = b + 1
  2391. let obj = {
  2392. advice_id: 0,
  2393. drug_name: prescription.advices[b].advice_name,
  2394. single_dose: prescription.advices[b].single_dose,
  2395. delivery_way: prescription.advices[b].delivery_way,
  2396. execution_frequency: prescription.advices[b].execution_frequency,
  2397. // retail_price: prescription.advices[b].price.toString(),
  2398. remark: prescription.advices[b].remark,
  2399. day: prescription.advices[b].day,
  2400. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2401. single_dose_unit: prescription.advices[b].single_dose_unit,
  2402. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2403. medical_insurance_number: prescription.advices[b].med_list_codg,
  2404. id: prescription.advices[b].drug_id,
  2405. drug: prescription.advices[b].drug,
  2406. groupno: prescription.advices[b].groupno,
  2407. hosp_appr_flag: '1'
  2408. }
  2409. console.log('看看数据3:')
  2410. console.log(obj.prescribing_number_unit)
  2411. console.log(prescription.advices[b].drug.min_unit)
  2412. console.log(prescription.advices[b].drug.max_unit)
  2413. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  2414. obj['retail_price'] = prescription.advices[b].drug.min_price
  2415. console.log('1')
  2416. console.log(obj.retail_price)
  2417. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  2418. obj['retail_price'] = prescription.advices[b].drug.retail_price
  2419. console.log('2')
  2420. console.log(obj.retail_price)
  2421. } else {
  2422. console.log('3')
  2423. obj['retail_price'] = prescription.advices[b].drug.min_price
  2424. console.log(obj.retail_price)
  2425. }
  2426. tempAdvice.push(obj)
  2427. }
  2428. //项目
  2429. for (let b = 0; b < prescription.project.length; b++) {
  2430. let obj = {
  2431. id: 0,
  2432. project_id: prescription.project[b].project_id,
  2433. project_name: prescription.project[b].project.project_name,
  2434. single_dose: prescription.project[b].single_dose,
  2435. delivery_way: prescription.project[b].delivery_way,
  2436. execution_frequency: prescription.project[b].execution_frequency,
  2437. number_days: prescription.project[b].day,
  2438. total: prescription.project[b].count.toString(),
  2439. remark: prescription.project[b].remark,
  2440. medical_code: prescription.project[b].project.medical_code,
  2441. unit: prescription.project[b].unit,
  2442. type: prescription.project[b].type,
  2443. }
  2444. if (prescription.project[b].type == 2) {
  2445. obj['statistical_classification'] = ''
  2446. obj['medical_code'] = prescription.project[b].project.medical_code
  2447. obj['project_name'] = prescription.project[b].project.project_name
  2448. obj['price'] = prescription.project[b].project.price
  2449. obj['project'] = prescription.project[b].project
  2450. } else if (prescription.project[b].type == 3) {
  2451. obj['statistical_classification'] = ''
  2452. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2453. obj['project_name'] = prescription.project[b].good_info.good_name
  2454. obj['price'] = prescription.project[b].good_info.packing_price
  2455. obj['good_info'] = prescription.project[b].good_info
  2456. }
  2457. tempProject.push(obj)
  2458. }
  2459. var preTime = nowTime
  2460. let index = i + 1
  2461. let obj = {
  2462. id: 0,
  2463. name: '处方' + index,
  2464. advices: tempAdvice,
  2465. project: tempProject,
  2466. addition: tempAddition,
  2467. order_status: 1,
  2468. pre_time: preTime,
  2469. med_type: '',
  2470. is_medicine_status:false,
  2471. }
  2472. if (prescription.med_type == 0 || prescription.med_type == '') {
  2473. obj.med_type = ''
  2474. } else {
  2475. obj.med_type = parseInt(prescription.med_type)
  2476. }
  2477. if (obj.med_type == 0 || obj.med_type == '') {
  2478. obj.med_type = 14
  2479. }
  2480. this.prescriptions.push(obj)
  2481. }
  2482. } else {
  2483. let obj = {
  2484. id: 0,
  2485. name: '处方' + 1,
  2486. advices: [],
  2487. project: [],
  2488. addition: [],
  2489. order_status: 0,
  2490. pre_time: nowTime,
  2491. med_type: '',
  2492. is_medicine_status:false,
  2493. }
  2494. obj.med_type = 14
  2495. this.prescriptions.push(obj)
  2496. // if(response.data.data.count <= 1 ){
  2497. // if(response.data.data.last_prescriptions.length == 0){
  2498. // let obj = {
  2499. // id: 0,
  2500. // name: '处方' + 1,
  2501. // advices: [],
  2502. // project: [],
  2503. // addition: [],
  2504. // order_status: 0,
  2505. // pre_time: nowTime,
  2506. //
  2507. // };
  2508. // this.prescriptions.push(obj)
  2509. //
  2510. //
  2511. // }else {
  2512. // for (let i = 0; i < response.data.data.last_prescriptions.length; i++) {
  2513. // var prescription = response.data.data.last_prescriptions[i];
  2514. // let tempAdvice = [];
  2515. // let tempProject = [];
  2516. // let tempAddition = [];
  2517. //
  2518. // //药品
  2519. // for (let b = 0; b < prescription.advices.length; b++) {
  2520. // let obj = {
  2521. // advice_id:0,
  2522. // drug_name: prescription.advices[b].advice_name,
  2523. // single_dose: prescription.advices[b].single_dose,
  2524. // delivery_way: prescription.advices[b].delivery_way,
  2525. // execution_frequency: prescription.advices[b].execution_frequency,
  2526. // retail_price: prescription.advices[b].price.toString(),
  2527. // remark: prescription.advices[b].remark,
  2528. // day: prescription.advices[b].day,
  2529. // prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2530. // single_dose_unit: prescription.advices[b].single_dose_unit,
  2531. // prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2532. // medical_insurance_number: prescription.advices[b].med_list_codg,
  2533. // id: prescription.advices[b].drug_id,
  2534. // drug:prescription.advices[b].drug
  2535. //
  2536. // };
  2537. // tempAdvice.push(obj)
  2538. // }
  2539. //
  2540. // //项目
  2541. // for (let b = 0; b < prescription.project.length; b++) {
  2542. // let obj = {
  2543. // id:0,
  2544. // project_id: prescription.project[b].project_id,
  2545. // project_name: prescription.project[b].project.project_name,
  2546. // statistical_classification: prescription.project[b].project.statistical_classification,
  2547. // single_dose: prescription.project[b].single_dose,
  2548. // delivery_way: prescription.project[b].delivery_way,
  2549. // execution_frequency: prescription.project[b].execution_frequency,
  2550. // number_days: prescription.project[b].day,
  2551. // total: prescription.project[b].count.toString(),
  2552. // price: prescription.project[b].price,
  2553. // remark: prescription.project[b].remark,
  2554. // medical_code: prescription.project[b].project.medical_code,
  2555. // unit: prescription.project[b].project.unit,
  2556. // type: prescription.project[b].type
  2557. // };
  2558. //
  2559. // if (prescription.project[b].type == 2) {
  2560. // obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  2561. // obj['medical_code'] = prescription.project[b].project.medical_code
  2562. // obj['project_name'] = prescription.project[b].project.project_name
  2563. //
  2564. // } else if (prescription.project[b].type == 3) {
  2565. // obj['statistical_classification'] = ""
  2566. // obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2567. // obj['project_name'] = prescription.project[b].good_info.good_name
  2568. // }
  2569. // tempProject.push(obj)
  2570. // }
  2571. //
  2572. // //附加收费
  2573. // for (let b = 0; b < prescription.addition.length; b++) {
  2574. // let obj = {
  2575. // item_name: prescription.addition[b].item_name,
  2576. // price: prescription.addition[b].price,
  2577. // count: prescription.addition[b].count,
  2578. // item_id: prescription.addition[b].item_id,
  2579. // };
  2580. // tempAddition.push(obj)
  2581. // }
  2582. //
  2583. // var preTime = nowTime
  2584. //
  2585. // let index = i + 1;
  2586. // let obj = {
  2587. // id: 0,
  2588. // name: '处方' + index,
  2589. // advices: tempAdvice,
  2590. // project: tempProject,
  2591. // addition: tempAddition,
  2592. // order_status: 1,
  2593. // pre_time: preTime
  2594. // };
  2595. // this.prescriptions.push(obj)
  2596. // }
  2597. // }
  2598. // }else{
  2599. // let obj = {
  2600. // id: 0,
  2601. // name: '处方' + 1,
  2602. // advices: [],
  2603. // project: [],
  2604. // addition: [],
  2605. // order_status: 0,
  2606. // pre_time: nowTime,
  2607. //
  2608. // };
  2609. // this.prescriptions.push(obj)
  2610. // }
  2611. }
  2612. }
  2613. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  2614. this.$refs.child.watchSign = 0
  2615. }
  2616. })
  2617. this.$refs.child.watchSign = 0
  2618. }
  2619. } else {
  2620. var nowDate = new Date()
  2621. var nowYear = nowDate.getFullYear()
  2622. var nowMonth = nowDate.getMonth() + 1
  2623. var nowDay = nowDate.getDate()
  2624. var hours = nowDate.getHours()
  2625. var min = nowDate.getMinutes()
  2626. var nowTime =
  2627. nowYear +
  2628. '-' +
  2629. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  2630. '-' +
  2631. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  2632. ':' + (min < 10 ? '0' + min : min)
  2633. var last_month = nowDate.getMonth() < 10 ? '0' + nowDate.getMonth().toString() : nowDate.getMonth() //获取当前月份(0-11,0代表1月)
  2634. var endTime =
  2635. nowYear +
  2636. '-' +
  2637. last_month +
  2638. '-' +
  2639. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  2640. ':' + (min < 10 ? '0' + min : min)
  2641. let isShowDailog = false
  2642. for (let i = 0; i < this.prescriptions.length; i++) {
  2643. if ((this.prescriptions[i].id == 0 && this.prescriptions[i].advices.length > 0) || (this.prescriptions[i].id == 0 && this.prescriptions[i].project.length > 0)) {
  2644. isShowDailog = true
  2645. }
  2646. }
  2647. if (isShowDailog) {
  2648. this.all_data.map((item, index) => {
  2649. if (item.id == this.oldCurrentRow.id) {
  2650. this.$refs.tab.setCurrentRow(this.all_data[index])
  2651. return
  2652. }
  2653. })
  2654. // this.$confirm('是否保存当前处方', '保存', {
  2655. // confirmButtonText: '确 定',
  2656. // cancelButtonText: '取 消',
  2657. // type: 'warning'
  2658. // }).then(() => {
  2659. // this.open(1)
  2660. // }).catch(() => {
  2661. for (let i = 0; i < this.all_data.length; i++) {
  2662. if (this.all_data[i].id == val.id) {
  2663. this.$refs.tab.setCurrentRow(this.all_data[i])
  2664. }
  2665. }
  2666. this.patientid = val.id
  2667. let params = {
  2668. 'record_date': this.record_date,
  2669. 'patient_id': val.id,
  2670. 'his_patient_id': val.his_patient_id,
  2671. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  2672. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  2673. 'p_type': 1
  2674. }
  2675. if (this.current_tab == 'day') {
  2676. getPatientInfo(params).then(response => {
  2677. if (response.data.state == 0) {
  2678. this.$message.error(response.data.msg)
  2679. return false
  2680. } else {
  2681. if (response.data.data.sch_prescriptions == null) {
  2682. response.data.data.sch_prescriptions = []
  2683. }
  2684. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  2685. if (response.data.data.sch_prescriptions[i].advices == null) {
  2686. response.data.data.sch_prescriptions[i].advices = []
  2687. }
  2688. if (response.data.data.sch_prescriptions[i].project == null) {
  2689. response.data.data.sch_prescriptions[i].project = []
  2690. }
  2691. }
  2692. for (let i = 0; i < this.all_data.length; i++) {
  2693. if (this.all_data[i].id == val.id) {
  2694. this.oldCurrentRow = this.all_data[i]
  2695. }
  2696. }
  2697. this.prescriptions = []
  2698. this.patientInfo = response.data.data.xt_info
  2699. this.hisPatientInfo = response.data.data.his_info
  2700. this.case_history = response.data.data.case_history
  2701. this.doctors = response.data.data.doctors
  2702. this.department = response.data.data.department
  2703. this.schedule = response.data.data.schedule
  2704. for (let i = 0; i < this.doctors.length; i++) {
  2705. if (this.doctors[i].user_type == 1) {
  2706. this.doctors.splice(i, 1)
  2707. }
  2708. }
  2709. this.case_history = response.data.data.case_history
  2710. this.info = response.data.data.info
  2711. this.last_info = response.data.data.last_info
  2712. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  2713. if (this.case_history.breathing <= 0) {
  2714. this.case_history.breathing = ''
  2715. }
  2716. if (this.case_history.sick <= 0) {
  2717. this.case_history.sick = ''
  2718. }
  2719. if (this.case_history.diagnose <= 0) {
  2720. this.case_history.diagnose = ''
  2721. }
  2722. if (this.case_history.temperature <= 0) {
  2723. this.case_history.temperature = ''
  2724. }
  2725. if (this.case_history.blood_sugar <= 0) {
  2726. this.case_history.blood_sugar = ''
  2727. }
  2728. if (this.case_history.pulse <= 0) {
  2729. this.case_history.pulse = ''
  2730. }
  2731. if (this.case_history.sbp <= 0) {
  2732. this.case_history.sbp = ''
  2733. }
  2734. if (this.case_history.dbp <= 0) {
  2735. this.case_history.dbp = ''
  2736. }
  2737. if (this.case_history.height <= 0) {
  2738. this.case_history.height = ''
  2739. }
  2740. if (this.case_history.blood_fat <= 0) {
  2741. this.case_history.blood_fat = ''
  2742. }
  2743. if (this.case_history.sick_type <= 0) {
  2744. this.case_history.sick_type = ''
  2745. }
  2746. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  2747. if (this.case_history.is_infect == 1) {
  2748. this.case_history.is_infect = true
  2749. } else {
  2750. this.case_history.is_infect = false
  2751. }
  2752. this.case_history.primary_disease = this.case_history.primary_disease
  2753. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  2754. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  2755. this.case_history.physical_examination = this.case_history.physical_examination
  2756. this.case_history.special_inspection = this.case_history.special_inspection
  2757. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  2758. this.prescriptionList = response.data.data.prescription
  2759. if (response.data.data.prescription.length > 0) {
  2760. for (let i = 0; i < response.data.data.prescription.length; i++) {
  2761. var prescription = response.data.data.prescription[i]
  2762. let tempAdvice = []
  2763. let tempProject = []
  2764. let tempAddition = []
  2765. var is_medicine = false
  2766. //药品
  2767. for (let b = 0; b < prescription.advices.length; b++) {
  2768. let obj = {
  2769. advice_id: prescription.advices[b].id,
  2770. drug_name: prescription.advices[b].advice_name,
  2771. single_dose: prescription.advices[b].single_dose,
  2772. delivery_way: prescription.advices[b].delivery_way,
  2773. execution_frequency: prescription.advices[b].execution_frequency,
  2774. retail_price: prescription.advices[b].price.toString(),
  2775. remark: prescription.advices[b].remark,
  2776. day: prescription.advices[b].day,
  2777. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2778. single_dose_unit: prescription.advices[b].single_dose_unit,
  2779. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2780. medical_insurance_number: prescription.advices[b].med_list_codg,
  2781. id: prescription.advices[b].drug_id,
  2782. drug: prescription.advices[b].drug,
  2783. groupno: prescription.advices[b].groupno,
  2784. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  2785. is_medicine: prescription.advices[b].is_medicine,
  2786. }
  2787. tempAdvice.push(obj)
  2788. if (prescription.advices[b].is_medicine == 1){
  2789. is_medicine = true
  2790. }
  2791. }
  2792. //项目
  2793. for (let b = 0; b < prescription.project.length; b++) {
  2794. let obj = {
  2795. id: prescription.project[b].id,
  2796. project_id: prescription.project[b].project_id,
  2797. project_name: prescription.project[b].project.project_name,
  2798. single_dose: prescription.project[b].single_dose,
  2799. delivery_way: prescription.project[b].delivery_way,
  2800. execution_frequency: prescription.project[b].execution_frequency,
  2801. number_days: prescription.project[b].day,
  2802. total: prescription.project[b].count.toString(),
  2803. price: prescription.project[b].price,
  2804. remark: prescription.project[b].remark,
  2805. medical_code: prescription.project[b].project.medical_code,
  2806. unit: prescription.project[b].unit,
  2807. type: prescription.project[b].type
  2808. }
  2809. if (prescription.project[b].type == 2) {
  2810. obj['statistical_classification'] = prescription.project[b].team.project_team
  2811. obj['medical_code'] = prescription.project[b].project.medical_code
  2812. obj['project_name'] = prescription.project[b].project.project_name
  2813. obj['project'] = prescription.project[b].project
  2814. } else if (prescription.project[b].type == 3) {
  2815. if(prescription.project[b].team_id > 0){
  2816. obj['statistical_classification'] = prescription.project[b].team.project_team
  2817. }
  2818. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2819. obj['project_name'] = prescription.project[b].good_info.good_name
  2820. obj['good_info'] = prescription.project[b].good_info
  2821. }
  2822. tempProject.push(obj)
  2823. }
  2824. //附加收费
  2825. // for (let b = 0; b < prescription.addition.length; b++) {
  2826. // let obj = {
  2827. // id: prescription.addition[b].id,
  2828. // item_name: prescription.addition[b].item_name,
  2829. // price: prescription.addition[b].price,
  2830. // count: prescription.addition[b].count,
  2831. // item_id: prescription.addition[b].item_id
  2832. // }
  2833. // tempAddition.push(obj)
  2834. // }
  2835. var preTime = ''
  2836. if (prescription.pre_time == 0) {
  2837. // preTime = nowTime
  2838. if (this.schedule.schedule_type == 1) {
  2839. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  2840. } else if (this.schedule.schedule_type == 2) {
  2841. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  2842. } else if (this.schedule.schedule_type == 3) {
  2843. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  2844. }
  2845. } else {
  2846. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  2847. }
  2848. let index = i + 1
  2849. let obj = {
  2850. id: prescription.id,
  2851. name: '处方' + index,
  2852. advices: tempAdvice,
  2853. project: tempProject,
  2854. addition: tempAddition,
  2855. order_status: prescription.order_status,
  2856. pre_time: preTime,
  2857. med_type: parseInt(prescription.med_type),
  2858. is_medicine_status: is_medicine,
  2859. }
  2860. this.prescriptions.push(obj)
  2861. }
  2862. } else {
  2863. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  2864. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  2865. var prescription = response.data.data.sch_prescriptions[i]
  2866. let tempAdvice = []
  2867. let tempProject = []
  2868. let tempAddition = []
  2869. //药品
  2870. for (let b = 0; b < prescription.advices.length; b++) {
  2871. let index = b + 1
  2872. let obj = {
  2873. advice_id: 0,
  2874. drug_name: prescription.advices[b].advice_name,
  2875. single_dose: prescription.advices[b].single_dose,
  2876. delivery_way: prescription.advices[b].delivery_way,
  2877. execution_frequency: prescription.advices[b].execution_frequency,
  2878. // retail_price: prescription.advices[b].price.toString(),
  2879. remark: prescription.advices[b].remark,
  2880. day: prescription.advices[b].day,
  2881. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  2882. single_dose_unit: prescription.advices[b].single_dose_unit,
  2883. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  2884. medical_insurance_number: prescription.advices[b].med_list_codg,
  2885. id: prescription.advices[b].drug_id,
  2886. drug: prescription.advices[b].drug,
  2887. groupno: prescription.advices[b].groupno,
  2888. hosp_appr_flag: '1'
  2889. }
  2890. console.log('看看数据4:')
  2891. console.log(obj.prescribing_number_unit)
  2892. console.log(prescription.advices[b].drug.min_unit)
  2893. console.log(prescription.advices[b].drug.max_unit)
  2894. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  2895. obj['retail_price'] = prescription.advices[b].drug.min_price
  2896. console.log('1')
  2897. console.log(obj.retail_price)
  2898. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  2899. obj['retail_price'] = prescription.advices[b].drug.retail_price
  2900. console.log('2')
  2901. console.log(obj.retail_price)
  2902. } else {
  2903. console.log('3')
  2904. obj['retail_price'] = prescription.advices[b].drug.min_price
  2905. console.log(obj.retail_price)
  2906. }
  2907. tempAdvice.push(obj)
  2908. }
  2909. //项目
  2910. for (let b = 0; b < prescription.project.length; b++) {
  2911. let obj = {
  2912. id: 0,
  2913. project_id: prescription.project[b].project_id,
  2914. project_name: prescription.project[b].project.project_name,
  2915. single_dose: prescription.project[b].single_dose,
  2916. delivery_way: prescription.project[b].delivery_way,
  2917. execution_frequency: prescription.project[b].execution_frequency,
  2918. number_days: prescription.project[b].day,
  2919. total: prescription.project[b].count.toString(),
  2920. remark: prescription.project[b].remark,
  2921. medical_code: prescription.project[b].project.medical_code,
  2922. unit: prescription.project[b].unit,
  2923. type: prescription.project[b].type
  2924. }
  2925. if (prescription.project[b].type == 2) {
  2926. obj['statistical_classification'] = ""
  2927. obj['medical_code'] = prescription.project[b].project.medical_code
  2928. obj['project_name'] = prescription.project[b].project.project_name
  2929. obj['price'] = prescription.project[b].project.price
  2930. obj['project'] = prescription.project[b].project
  2931. } else if (prescription.project[b].type == 3) {
  2932. obj['statistical_classification'] = ''
  2933. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  2934. obj['project_name'] = prescription.project[b].good_info.good_name
  2935. obj['price'] = prescription.project[b].good_info.packing_price
  2936. obj['good_info'] = prescription.project[b].good_info
  2937. }
  2938. tempProject.push(obj)
  2939. }
  2940. // var preTime = nowTime
  2941. var preTime = ''
  2942. if (this.schedule.schedule_type == 1) {
  2943. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  2944. } else if (this.schedule.schedule_type == 2) {
  2945. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  2946. } else if (this.schedule.schedule_type == 3) {
  2947. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  2948. }
  2949. let index = i + 1
  2950. let obj = {
  2951. id: 0,
  2952. name: '处方' + index,
  2953. advices: tempAdvice,
  2954. project: tempProject,
  2955. addition: tempAddition,
  2956. order_status: 1,
  2957. pre_time: preTime,
  2958. med_type: '',
  2959. is_medicine_status: false,
  2960. }
  2961. if (prescription.med_type == 0 || prescription.med_type == '') {
  2962. obj.med_type = ''
  2963. } else {
  2964. obj.med_type = parseInt(prescription.med_type)
  2965. }
  2966. if (obj.med_type == 0 || obj.med_type == '') {
  2967. obj.med_type = 14
  2968. }
  2969. this.prescriptions.push(obj)
  2970. }
  2971. } else {
  2972. let obj = {
  2973. id: 0,
  2974. name: '处方' + 1,
  2975. advices: [],
  2976. project: [],
  2977. addition: [],
  2978. order_status: 0,
  2979. pre_time: nowTime,
  2980. med_type: '',
  2981. is_medicine_status: false,
  2982. }
  2983. obj.med_type = 14
  2984. this.prescriptions.push(obj)
  2985. }
  2986. }
  2987. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  2988. }
  2989. })
  2990. } else {
  2991. getMonthHisPateintInfo(params).then(response => {
  2992. if (response.data.state == 0) {
  2993. this.$message.error(response.data.msg)
  2994. return false
  2995. } else {
  2996. for (let i = 0; i < this.all_data.length; i++) {
  2997. if (this.all_data[i].id == val.id) {
  2998. this.oldCurrentRow = this.all_data[i]
  2999. }
  3000. }
  3001. this.patientInfo = response.data.data.xt_info
  3002. this.hisPatientInfo = response.data.data.his_info
  3003. this.case_history = response.data.data.case_history
  3004. var month_prescriptions = response.data.data.month_prescriptions
  3005. this.settle_total = response.data.data.settle_total
  3006. console.log(this.settle_total)
  3007. this.setMonthPrescription(month_prescriptions)
  3008. this.doctors = response.data.data.doctors
  3009. this.department = response.data.data.department
  3010. this.schedule = response.data.data.schedule
  3011. for (let i = 0; i < this.doctors.length; i++) {
  3012. if (this.doctors[i].user_type == 1) {
  3013. this.doctors.splice(i, 1)
  3014. }
  3015. }
  3016. this.case_history = response.data.data.case_history
  3017. this.info = response.data.data.info
  3018. this.last_info = response.data.data.last_info
  3019. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  3020. if (this.case_history.breathing <= 0) {
  3021. this.case_history.breathing = ''
  3022. }
  3023. if (this.case_history.sick <= 0) {
  3024. this.case_history.sick = ''
  3025. }
  3026. if (this.case_history.diagnose <= 0) {
  3027. this.case_history.diagnose = ''
  3028. }
  3029. if (this.case_history.temperature <= 0) {
  3030. this.case_history.temperature = ''
  3031. }
  3032. if (this.case_history.blood_sugar <= 0) {
  3033. this.case_history.blood_sugar = ''
  3034. }
  3035. if (this.case_history.pulse <= 0) {
  3036. this.case_history.pulse = ''
  3037. }
  3038. if (this.case_history.sbp <= 0) {
  3039. this.case_history.sbp = ''
  3040. }
  3041. if (this.case_history.dbp <= 0) {
  3042. this.case_history.dbp = ''
  3043. }
  3044. if (this.case_history.height <= 0) {
  3045. this.case_history.height = ''
  3046. }
  3047. if (this.case_history.blood_fat <= 0) {
  3048. this.case_history.blood_fat = ''
  3049. }
  3050. if (this.case_history.sick_type <= 0) {
  3051. this.case_history.sick_type = ''
  3052. }
  3053. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  3054. this.case_history.primary_disease = this.case_history.primary_disease
  3055. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  3056. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  3057. this.case_history.physical_examination = this.case_history.physical_examination
  3058. this.case_history.special_inspection = this.case_history.special_inspection
  3059. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  3060. if (this.case_history.is_infect == 1) {
  3061. this.case_history.is_infect = true
  3062. } else {
  3063. this.case_history.is_infect = false
  3064. }
  3065. this.$refs.prescriptions.setMonthData(this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info,this.settle_total)
  3066. }
  3067. })
  3068. }
  3069. } else {
  3070. this.patientid = val.id
  3071. let params = {
  3072. 'record_date': this.record_date,
  3073. 'patient_id': val.id,
  3074. 'his_patient_id': val.his_patient_id,
  3075. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  3076. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  3077. 'p_type': 1
  3078. }
  3079. if (this.current_tab == 'day') {
  3080. getPatientInfo(params).then(response => {
  3081. if (response.data.state == 0) {
  3082. this.$message.error(response.data.msg)
  3083. return false
  3084. } else {
  3085. if (response.data.data.sch_prescriptions == null) {
  3086. response.data.data.sch_prescriptions = []
  3087. }
  3088. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  3089. if (response.data.data.sch_prescriptions[i].advices == null) {
  3090. response.data.data.sch_prescriptions[i].advices = []
  3091. }
  3092. if (response.data.data.sch_prescriptions[i].project == null) {
  3093. response.data.data.sch_prescriptions[i].project = []
  3094. }
  3095. }
  3096. this.prescriptions = []
  3097. this.month_prescriptions = []
  3098. this.patientInfo = response.data.data.xt_info
  3099. this.hisPatientInfo = response.data.data.his_info
  3100. this.case_history = response.data.data.case_history
  3101. this.info = response.data.data.info
  3102. this.last_info = response.data.data.last_info
  3103. this.schedule = response.data.data.schedule
  3104. this.doctors = response.data.data.doctors
  3105. this.department = response.data.data.department
  3106. for (let i = 0; i < this.doctors.length; i++) {
  3107. if (this.doctors[i].user_type == 1) {
  3108. this.doctors.splice(i, 1)
  3109. }
  3110. }
  3111. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  3112. if (this.case_history.breathing <= 0) {
  3113. this.case_history.breathing = ''
  3114. }
  3115. if (this.case_history.sick <= 0) {
  3116. this.case_history.sick = ''
  3117. }
  3118. if (this.case_history.diagnose <= 0) {
  3119. this.case_history.diagnose = ''
  3120. }
  3121. if (this.case_history.temperature <= 0) {
  3122. this.case_history.temperature = ''
  3123. }
  3124. if (this.case_history.blood_sugar <= 0) {
  3125. this.case_history.blood_sugar = ''
  3126. }
  3127. if (this.case_history.pulse <= 0) {
  3128. this.case_history.pulse = ''
  3129. }
  3130. if (this.case_history.sbp <= 0) {
  3131. this.case_history.sbp = ''
  3132. }
  3133. if (this.case_history.dbp <= 0) {
  3134. this.case_history.dbp = ''
  3135. }
  3136. if (this.case_history.height <= 0) {
  3137. this.case_history.height = ''
  3138. }
  3139. if (this.case_history.blood_fat <= 0) {
  3140. this.case_history.blood_fat = ''
  3141. }
  3142. if (this.case_history.sick_type <= 0) {
  3143. this.case_history.sick_type = ''
  3144. }
  3145. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  3146. if (this.case_history.is_infect == 1) {
  3147. this.case_history.is_infect = true
  3148. } else {
  3149. this.case_history.is_infect = false
  3150. }
  3151. this.prescriptionList = response.data.data.prescription
  3152. this.case_history.primary_disease = this.case_history.primary_disease
  3153. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  3154. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  3155. this.case_history.physical_examination = this.case_history.physical_examination
  3156. this.case_history.special_inspection = this.case_history.special_inspection
  3157. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  3158. if (response.data.data.prescription.length > 0) {
  3159. for (let i = 0; i < response.data.data.prescription.length; i++) {
  3160. var prescription = response.data.data.prescription[i]
  3161. let tempAdvice = []
  3162. let tempProject = []
  3163. let tempAddition = []
  3164. var is_medicine = false
  3165. //药品
  3166. for (let b = 0; b < prescription.advices.length; b++) {
  3167. let obj = {
  3168. advice_id: prescription.advices[b].id,
  3169. drug_name: prescription.advices[b].advice_name,
  3170. single_dose: prescription.advices[b].single_dose,
  3171. delivery_way: prescription.advices[b].delivery_way,
  3172. execution_frequency: prescription.advices[b].execution_frequency,
  3173. retail_price: prescription.advices[b].price.toString(),
  3174. remark: prescription.advices[b].remark,
  3175. day: prescription.advices[b].day,
  3176. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  3177. single_dose_unit: prescription.advices[b].single_dose_unit,
  3178. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  3179. medical_insurance_number: prescription.advices[b].med_list_codg,
  3180. id: prescription.advices[b].drug_id,
  3181. drug: prescription.advices[b].drug,
  3182. groupno: prescription.advices[b].groupno,
  3183. hosp_appr_flag: prescription.advices[b].hosp_appr_flag.toString(),
  3184. is_medicine: prescription.advices[b].is_medicine,
  3185. }
  3186. tempAdvice.push(obj)
  3187. if (prescription.advices[b].is_medicine == 1){
  3188. is_medicine = true
  3189. }
  3190. }
  3191. //项目
  3192. for (let b = 0; b < prescription.project.length; b++) {
  3193. let obj = {
  3194. id: prescription.project[b].id,
  3195. project_id: prescription.project[b].project_id,
  3196. project_name: prescription.project[b].project.project_name,
  3197. single_dose: prescription.project[b].single_dose,
  3198. delivery_way: prescription.project[b].delivery_way,
  3199. execution_frequency: prescription.project[b].execution_frequency,
  3200. number_days: prescription.project[b].day,
  3201. total: prescription.project[b].count.toString(),
  3202. price: prescription.project[b].price,
  3203. remark: prescription.project[b].remark,
  3204. medical_code: prescription.project[b].project.medical_code,
  3205. unit: prescription.project[b].unit,
  3206. type: prescription.project[b].type
  3207. }
  3208. if (prescription.project[b].type == 2) {
  3209. obj['statistical_classification'] = prescription.project[b].team.project_team
  3210. obj['medical_code'] = prescription.project[b].project.medical_code
  3211. obj['project_name'] = prescription.project[b].project.project_name
  3212. obj['project'] = prescription.project[b].project
  3213. } else if (prescription.project[b].type == 3) {
  3214. if(prescription.project[b].team_id > 0){
  3215. obj['statistical_classification'] = prescription.project[b].team.project_team
  3216. }
  3217. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  3218. obj['project_name'] = prescription.project[b].good_info.good_name
  3219. obj['good_info'] = prescription.project[b].good_info
  3220. }
  3221. tempProject.push(obj)
  3222. }
  3223. //附加收费
  3224. // for (let b = 0; b < prescription.addition.length; b++) {
  3225. // let obj = {
  3226. // id: prescription.addition[b].id,
  3227. // item_name: prescription.addition[b].item_name,
  3228. // price: prescription.addition[b].price,
  3229. // count: prescription.addition[b].count,
  3230. // item_id: prescription.addition[b].item_id
  3231. // }
  3232. // tempAddition.push(obj)
  3233. // }
  3234. var preTime = ''
  3235. if (prescription.pre_time == 0) {
  3236. // preTime = nowTime
  3237. if (this.schedule.schedule_type == 1) {
  3238. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  3239. } else if (this.schedule.schedule_type == 2) {
  3240. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  3241. } else if (this.schedule.schedule_type == 3) {
  3242. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  3243. }
  3244. } else {
  3245. preTime = this.getTime(prescription.pre_time, '{y}-{m}-{d} {h}:{i}')
  3246. }
  3247. let index = i + 1
  3248. let obj = {
  3249. id: prescription.id,
  3250. name: '处方' + index,
  3251. advices: tempAdvice,
  3252. project: tempProject,
  3253. addition: tempAddition,
  3254. order_status: prescription.order_status,
  3255. pre_time: preTime,
  3256. med_type: parseInt(prescription.med_type),
  3257. is_medicine_status: is_medicine,
  3258. }
  3259. this.prescriptions.push(obj)
  3260. }
  3261. } else {
  3262. if (response.data.data.count <= 1 && response.data.data.schedule.id > 0 && response.data.data.sch_prescriptions.length > 0) {
  3263. for (let i = 0; i < response.data.data.sch_prescriptions.length; i++) {
  3264. var prescription = response.data.data.sch_prescriptions[i]
  3265. let tempAdvice = []
  3266. let tempProject = []
  3267. let tempAddition = []
  3268. //药品
  3269. for (let b = 0; b < prescription.advices.length; b++) {
  3270. let index = b + 1
  3271. let obj = {
  3272. advice_id: 0,
  3273. drug_name: prescription.advices[b].advice_name,
  3274. single_dose: prescription.advices[b].single_dose,
  3275. delivery_way: prescription.advices[b].delivery_way,
  3276. execution_frequency: prescription.advices[b].execution_frequency,
  3277. // retail_price: prescription.advices[b].price.toString(),
  3278. remark: prescription.advices[b].remark,
  3279. day: prescription.advices[b].day,
  3280. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  3281. single_dose_unit: prescription.advices[b].single_dose_unit,
  3282. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  3283. medical_insurance_number: prescription.advices[b].med_list_codg,
  3284. id: prescription.advices[b].drug_id,
  3285. drug: prescription.advices[b].drug,
  3286. groupno: prescription.advices[b].groupno,
  3287. hosp_appr_flag: '1'
  3288. }
  3289. console.log('看看数据5:')
  3290. console.log(obj.prescribing_number_unit)
  3291. console.log(prescription.advices[b].drug.min_unit)
  3292. console.log(prescription.advices[b].drug.max_unit)
  3293. if (obj.prescribing_number_unit == prescription.advices[b].drug.min_unit) {
  3294. obj['retail_price'] = prescription.advices[b].drug.min_price
  3295. console.log('1')
  3296. console.log(obj.retail_price)
  3297. } else if (obj.prescribing_number_unit == prescription.advices[b].drug.max_unit) {
  3298. obj['retail_price'] = prescription.advices[b].drug.retail_price
  3299. console.log('2')
  3300. console.log(obj.retail_price)
  3301. } else {
  3302. console.log('3')
  3303. obj['retail_price'] = prescription.advices[b].drug.min_price
  3304. console.log(obj.retail_price)
  3305. }
  3306. tempAdvice.push(obj)
  3307. }
  3308. //项目
  3309. for (let b = 0; b < prescription.project.length; b++) {
  3310. let obj = {
  3311. id: 0,
  3312. project_id: prescription.project[b].project_id,
  3313. project_name: prescription.project[b].project.project_name,
  3314. single_dose: prescription.project[b].single_dose,
  3315. delivery_way: prescription.project[b].delivery_way,
  3316. execution_frequency: prescription.project[b].execution_frequency,
  3317. number_days: prescription.project[b].day,
  3318. total: prescription.project[b].count.toString(),
  3319. remark: prescription.project[b].remark,
  3320. medical_code: prescription.project[b].project.medical_code,
  3321. unit: prescription.project[b].unit,
  3322. type: prescription.project[b].type
  3323. }
  3324. if (prescription.project[b].type == 2) {
  3325. obj['statistical_classification'] = ""
  3326. obj['medical_code'] = prescription.project[b].project.medical_code
  3327. obj['project_name'] = prescription.project[b].project.project_name
  3328. obj['price'] = prescription.project[b].project.price
  3329. obj['project'] = prescription.project[b].project
  3330. } else if (prescription.project[b].type == 3) {
  3331. obj['statistical_classification'] = ''
  3332. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  3333. obj['project_name'] = prescription.project[b].good_info.good_name
  3334. obj['price'] = prescription.project[b].good_info.packing_price
  3335. obj['good_info'] = prescription.project[b].good_info
  3336. }
  3337. tempProject.push(obj)
  3338. }
  3339. // var preTime = nowTime
  3340. var preTime = ''
  3341. if (this.schedule.schedule_type == 1) {
  3342. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '7:00'
  3343. } else if (this.schedule.schedule_type == 2) {
  3344. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '11:00'
  3345. } else if (this.schedule.schedule_type == 3) {
  3346. preTime = nowYear + '-' + (nowMonth < 10 ? '0' + nowMonth : nowMonth) + '-' + (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + '17:00'
  3347. }
  3348. let index = i + 1
  3349. let obj = {
  3350. id: 0,
  3351. name: '处方' + index,
  3352. advices: tempAdvice,
  3353. project: tempProject,
  3354. addition: tempAddition,
  3355. order_status: 1,
  3356. pre_time: preTime,
  3357. med_type: '',
  3358. is_medicine_status: false,
  3359. }
  3360. if (prescription.med_type == 0 || prescription.med_type == '') {
  3361. obj.med_type = ''
  3362. } else {
  3363. obj.med_type = parseInt(prescription.med_type)
  3364. }
  3365. if (obj.med_type == 0 || obj.med_type == '') {
  3366. obj.med_type = 14
  3367. }
  3368. this.prescriptions.push(obj)
  3369. }
  3370. } else {
  3371. let obj = {
  3372. id: 0,
  3373. name: '处方' + 1,
  3374. advices: [],
  3375. project: [],
  3376. addition: [],
  3377. order_status: 0,
  3378. pre_time: nowTime,
  3379. med_type: '',
  3380. is_medicine_status: false,
  3381. }
  3382. obj.med_type = 14
  3383. this.prescriptions.push(obj)
  3384. }
  3385. }
  3386. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info, this.sick, this.diagnosis)
  3387. }
  3388. })
  3389. } else {
  3390. getMonthHisPateintInfo(params).then(response => {
  3391. if (response.data.state == 0) {
  3392. this.$message.error(response.data.msg)
  3393. return false
  3394. } else {
  3395. this.prescriptions = []
  3396. this.month_prescriptions = []
  3397. this.settle_total = response.data.data.settle_total
  3398. var month_prescriptions = response.data.data.month_prescriptions
  3399. this.setMonthPrescription(month_prescriptions)
  3400. this.patientInfo = response.data.data.xt_info
  3401. this.hisPatientInfo = response.data.data.his_info
  3402. this.case_history = response.data.data.case_history
  3403. this.info = response.data.data.info
  3404. this.last_info = response.data.data.last_info
  3405. this.schedule = response.data.data.schedule
  3406. this.doctors = response.data.data.doctors
  3407. this.department = response.data.data.department
  3408. for (let i = 0; i < this.doctors.length; i++) {
  3409. if (this.doctors[i].user_type == 1) {
  3410. this.doctors.splice(i, 1)
  3411. }
  3412. }
  3413. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  3414. if (this.case_history.breathing <= 0) {
  3415. this.case_history.breathing = ''
  3416. }
  3417. if (this.case_history.sick <= 0) {
  3418. this.case_history.sick = ''
  3419. }
  3420. if (this.case_history.diagnose <= 0) {
  3421. this.case_history.diagnose = ''
  3422. }
  3423. if (this.case_history.temperature <= 0) {
  3424. this.case_history.temperature = ''
  3425. }
  3426. if (this.case_history.blood_sugar <= 0) {
  3427. this.case_history.blood_sugar = ''
  3428. }
  3429. if (this.case_history.pulse <= 0) {
  3430. this.case_history.pulse = ''
  3431. }
  3432. if (this.case_history.sbp <= 0) {
  3433. this.case_history.sbp = ''
  3434. }
  3435. if (this.case_history.dbp <= 0) {
  3436. this.case_history.dbp = ''
  3437. }
  3438. if (this.case_history.height <= 0) {
  3439. this.case_history.height = ''
  3440. }
  3441. if (this.case_history.blood_fat <= 0) {
  3442. this.case_history.blood_fat = ''
  3443. }
  3444. if (this.case_history.sick_type <= 0) {
  3445. this.case_history.sick_type = ''
  3446. }
  3447. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  3448. this.case_history.primary_disease = this.case_history.primary_disease
  3449. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  3450. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  3451. this.case_history.physical_examination = this.case_history.physical_examination
  3452. this.case_history.special_inspection = this.case_history.special_inspection
  3453. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  3454. if (this.case_history.is_infect == 1) {
  3455. this.case_history.is_infect = true
  3456. } else {
  3457. this.case_history.is_infect = false
  3458. }
  3459. this.$refs.prescriptions.setMonthData(this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info,this.settle_total)
  3460. }
  3461. })
  3462. }
  3463. }
  3464. }
  3465. },
  3466. currentChange(currentRow, oldCurrentRow) {
  3467. if (oldCurrentRow) {
  3468. this.newPatientId = oldCurrentRow.id
  3469. this.patientid = oldCurrentRow.id
  3470. }
  3471. let isShowDailog = false
  3472. for (let i = 0; i < this.prescriptions.length; i++) {
  3473. if ((this.prescriptions[i].id == 0 && this.prescriptions[i].advices.length > 0) || (this.prescriptions[i].id == 0 && this.prescriptions[i].project.length > 0)) {
  3474. isShowDailog = true
  3475. }
  3476. }
  3477. if (!isShowDailog) {
  3478. this.oldCurrentRow = currentRow
  3479. return
  3480. }
  3481. }, open_two() {
  3482. this.$refs.prescriptions.open_two()
  3483. }, open_three() {
  3484. this.$refs.prescriptions.open_three()
  3485. },
  3486. open(index) {
  3487. this.index = index
  3488. if (index == 1) {
  3489. this.$refs.prescriptions.open(1, this.saveLoading)
  3490. } else if (index == 2) {
  3491. this.getPrescriptionList(this.patientInfo.id, this.record_date, 1)
  3492. // this.$router.push("/outpatientDoctorStation/print?record="+this.record_date+"&prescription_id="+this.prescription_id)
  3493. } else if (index == 3) {
  3494. this.$refs.prescriptions.open(3)
  3495. } else if (index == 4) {
  3496. this.$refs.prescriptions.open(4)
  3497. } else if (index == 6) {
  3498. // this.$router.push("/outpatientDoctorStation/treatPrint?record="+this.record_date+"&prescription_id="+this.prescription_id)
  3499. this.getPrescriptionList(this.patientInfo.id, this.record_date, 2)
  3500. // this.$router.push("/outpatientDoctorStation/treatPrint?record="+this.record_date+"&prescription_id="+this.prescription_id)
  3501. } else if (index == 20) {
  3502. this.getPrescriptionList(this.patientInfo.id, this.record_date, 2, 3)
  3503. }
  3504. },
  3505. // 电子病历打印
  3506. opentwo(index) {
  3507. if (index == 1) {
  3508. if (this.patientInfo.id == undefined) {
  3509. this.$message.error('请先选择病人')
  3510. return
  3511. }
  3512. this.$refs.child.createCaseHistory()
  3513. } else if (index == 2) {
  3514. this.recordVisible = true
  3515. this.$nextTick(() => {
  3516. this.$refs.recordPrint.show(this.patientid,this.org_id)
  3517. })
  3518. // this.$router.push('/outpatientDoctorStation/recordPrint?record='+this.record_date+"&patient_id="+this.patientid)
  3519. } else if (index == 3) {
  3520. var mode_status = this.$refs.saveRecordTemplate.mode_status
  3521. this.$refs.medicalRecord.show(mode_status)
  3522. } else if (index == 4) {
  3523. this.$refs.saveRecordTemplate.show(this.case_history)
  3524. }
  3525. },
  3526. // changePatient(val){
  3527. // console.log("患者val",val)
  3528. // this.hisPatientInfo = val.hisPatientInfo
  3529. // console.log("333333",this.hisPatientInfo)
  3530. // }
  3531. getMsgFormSon(id) {
  3532. this.detalid = id
  3533. },
  3534. changetwo(data) {
  3535. this.prescription_id = data
  3536. },
  3537. getPrescriptionList(id, record_date, type, checkType) {
  3538. getPrescriptionList(id, 1, record_date).then(response => {
  3539. if (response.data.state == 1) {
  3540. if (checkType != 3) {
  3541. this.centerDialogVisible = true
  3542. var list = response.data.data.list
  3543. let arr1 = []
  3544. let arr2 = []
  3545. let arr3 = []
  3546. let arr4 = []
  3547. for (var i = list.length - 1; i >= 0; i--) {
  3548. if (list[i].type == 1) {
  3549. list[i].prescription_number = list[i].prescription_number + i
  3550. arr1.push(list[i])
  3551. }
  3552. if (list[i].type == 2) {
  3553. list[i].prescription_number = list[i].prescription_number + i
  3554. arr2.push(list[i])
  3555. arr3.push(list[i])
  3556. arr4.push(list[i])
  3557. }
  3558. if (list[i].type == 2) {
  3559. let count = 0
  3560. list[i].project.map(item => {
  3561. if (item.type == 2) {
  3562. if (item.project.cost_classify == 3) {
  3563. count++
  3564. }
  3565. }
  3566. })
  3567. if (count == list[i].project.length) {
  3568. arr2.map((items, index) => {
  3569. if (items.id == list[i].id) {
  3570. arr2.splice(index, 1)
  3571. }
  3572. })
  3573. }
  3574. }
  3575. }
  3576. this.tableData1 = arr1
  3577. this.tableData2 = arr2
  3578. this.tableData4 = arr4
  3579. this.tableData3 = [arr3[0]]
  3580. } else {
  3581. var list = response.data.data.list
  3582. let arr = []
  3583. for (let i = 0; i < list.length; i++) {
  3584. if (list[i].type == type) {
  3585. list[i].prescription_number = list[i].prescription_number + i
  3586. arr.push(list[i])
  3587. }
  3588. }
  3589. console.log('arrrrrrrrrr', arr)
  3590. this.selecting_schs = arr
  3591. this.savePrint()
  3592. }
  3593. }
  3594. })
  3595. },
  3596. handleSelectionChange1(val) {
  3597. console.log('val', val)
  3598. this.selecting_schs1 = val
  3599. },
  3600. handleSelectionChange2(val) {
  3601. this.selecting_schs2 = val
  3602. },
  3603. handleSelectionChange3(val) {
  3604. if (val.length == 0) {
  3605. this.selecting_schs3 = []
  3606. } else {
  3607. this.selecting_schs3 = this.tableData4
  3608. }
  3609. },
  3610. handleClick() {
  3611. console.log("hhahdf adf adf ",this.titleType)
  3612. console.log("radio ",this.radio)
  3613. if (this.titleType == '电子处方' || this.titleType == "电子病历") {
  3614. if (this.radio == 1) {
  3615. this.un_cure_data.map(item => {
  3616. if (item.id == this.patientid) {
  3617. this.getPatientInfo(item)
  3618. }
  3619. })
  3620. } else if (this.radio == 2) {
  3621. this.cure_data.map(item => {
  3622. if (item.id == this.patientid) {
  3623. this.getPatientInfo(item)
  3624. }
  3625. })
  3626. } else {
  3627. this.all_data.map(item => {
  3628. if (item.id == this.patientid) {
  3629. this.getPatientInfo(item)
  3630. }
  3631. })
  3632. }
  3633. }
  3634. },
  3635. savePrint() {
  3636. //处方
  3637. var arr1 = []
  3638. if (this.selecting_schs1.length > 0) {
  3639. for (let i = 0; i < this.selecting_schs1.length; i++) {
  3640. arr1.push(this.selecting_schs1[i].id)
  3641. }
  3642. var ids1 = arr1.join(',')
  3643. let obj1 = {
  3644. record: this.record_date,
  3645. prescription_id: this.prescription_id,
  3646. ids: ids1,
  3647. patient_id: this.patientid,
  3648. p_type:1
  3649. }
  3650. this.paramsObj = obj1
  3651. }
  3652. //治疗
  3653. var arr2 = []
  3654. if (this.selecting_schs2.length > 0) {
  3655. for (let i = 0; i < this.selecting_schs2.length; i++) {
  3656. arr2.push(this.selecting_schs2[i].id)
  3657. }
  3658. var ids2 = arr2.join(',')
  3659. let obj2 = {
  3660. record: this.record_date,
  3661. prescription_id: this.prescription_id,
  3662. ids: ids2,
  3663. patient_id: this.patientid,
  3664. p_type:1
  3665. }
  3666. this.paramsObj2 = obj2
  3667. }
  3668. var arr3 = []
  3669. if (this.selecting_schs3.length > 0) {
  3670. for (let i = 0; i < this.selecting_schs3.length; i++) {
  3671. arr3.push(this.selecting_schs3[i].id)
  3672. }
  3673. var ids2 = arr3.join(',')
  3674. let obj3 = {
  3675. record: this.record_date,
  3676. prescription_id: this.prescription_id,
  3677. ids: ids2,
  3678. patient_id: this.patientid,
  3679. p_type:1
  3680. }
  3681. this.paramsObj3 = obj3
  3682. }
  3683. this.innerVisible = true
  3684. // if(this.index == 20){
  3685. // console.log('ids',ids)
  3686. // let obj = {
  3687. // record: this.record_date,
  3688. // prescription_id: this.prescription_id,
  3689. // ids: ids,
  3690. // patient_id: this.patientid
  3691. // };
  3692. // this.paramsObj = obj;
  3693. // this.checkVisible = true
  3694. // }
  3695. }, getTime(val, temp) {
  3696. if (val != 0) {
  3697. return uParseTime(val, temp)
  3698. } else {
  3699. return ''
  3700. }
  3701. }, getGoodUnit(id) {
  3702. var goodUnit = this.$store.getters.good_unit
  3703. for (let i = 0; i < goodUnit.length; i++) {
  3704. if (goodUnit[i].id == id) {
  3705. return goodUnit[i].name
  3706. }
  3707. }
  3708. }, changeDay() {
  3709. this.current_tab = 'day'
  3710. this.getPatientInfo(this.current_data)
  3711. }, changeMonth(val) {
  3712. this.current_tab = 'month'
  3713. var nowDate = new Date()
  3714. var nowYear = nowDate.getFullYear()
  3715. var nowMonth = nowDate.getMonth() + 1
  3716. var nowDay = nowDate.getDate()
  3717. var hours = nowDate.getHours()
  3718. var min = nowDate.getMinutes()
  3719. var nowTime =
  3720. nowYear +
  3721. '-' +
  3722. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  3723. '-' +
  3724. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  3725. ':' + (min < 10 ? '0' + min : min)
  3726. let params = {
  3727. 'record_date': this.record_date,
  3728. 'patient_id': val.id,
  3729. 'his_patient_id': val.his_patient_id,
  3730. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  3731. 'end_time': moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  3732. 'p_type': 1
  3733. }
  3734. this.isloading = true
  3735. getMonthHisPateintInfo(params).then(response => {
  3736. if (response.data.state == 0) {
  3737. this.$message.error(response.data.msg)
  3738. this.isloading = false
  3739. return false
  3740. } else {
  3741. this.patientid = val.id
  3742. this.isloading = false
  3743. this.prescriptions = []
  3744. this.month_prescriptions = []
  3745. this.patientInfo = response.data.data.xt_info
  3746. this.hisPatientInfo = response.data.data.his_info
  3747. this.case_history = response.data.data.case_history
  3748. this.info = response.data.data.info
  3749. this.last_info = response.data.data.last_info
  3750. this.schedule = response.data.data.schedule
  3751. this.doctors = response.data.data.doctors
  3752. this.department = response.data.data.department
  3753. this.settle_total = response.data.data.settle_total
  3754. for (let i = 0; i < this.doctors.length; i++) {
  3755. if (this.doctors[i].user_type == 1) {
  3756. this.doctors.splice(i, 1)
  3757. }
  3758. }
  3759. var month_prescriptions = response.data.data.month_prescriptions
  3760. this.setMonthPrescription(month_prescriptions)
  3761. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}')
  3762. if (this.case_history.temperature <= 0) {
  3763. this.case_history.temperature = ''
  3764. }
  3765. if (this.case_history.blood_sugar <= 0) {
  3766. this.case_history.blood_sugar = ''
  3767. }
  3768. if (this.case_history.pulse <= 0) {
  3769. this.case_history.pulse = ''
  3770. }
  3771. if (this.case_history.sbp <= 0) {
  3772. this.case_history.sbp = ''
  3773. }
  3774. if (this.case_history.dbp <= 0) {
  3775. this.case_history.dbp = ''
  3776. }
  3777. if (this.case_history.height <= 0) {
  3778. this.case_history.height = ''
  3779. }
  3780. if (this.case_history.blood_fat <= 0) {
  3781. this.case_history.blood_fat = ''
  3782. }
  3783. if (this.case_history.sick_type <= 0) {
  3784. this.case_history.sick_type = ''
  3785. }
  3786. if (this.case_history.sick <= 0) {
  3787. this.case_history.sick = ''
  3788. }
  3789. if (this.case_history.diagnose <= 0) {
  3790. this.case_history.diagnose = ''
  3791. }
  3792. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}')
  3793. this.case_history.primary_disease = this.case_history.primary_disease
  3794. this.case_history.confirm_failure_date = uParseTime(this.case_history.confirm_failure_date, '{y}-{m}-{d}')
  3795. this.case_history.drug_allergy_history = this.case_history.drug_allergy_history
  3796. this.case_history.physical_examination = this.case_history.physical_examination
  3797. this.case_history.special_inspection = this.case_history.special_inspection
  3798. this.case_history.lab_apparatus = this.case_history.lab_apparatus
  3799. if (this.case_history.is_infect == 1) {
  3800. this.case_history.is_infect = true
  3801. } else {
  3802. this.case_history.is_infect = false
  3803. }
  3804. this.$refs.prescriptions.setMonthData(this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions, this.last_info,this.settle_total)
  3805. }
  3806. })
  3807. }
  3808. },
  3809. created() {
  3810. this.getInitData()
  3811. var nowDate = new Date()
  3812. var nowYear = nowDate.getFullYear()
  3813. var nowMonth = nowDate.getMonth() + 1
  3814. var nowDay = nowDate.getDate()
  3815. this.record_date =
  3816. nowYear +
  3817. '-' +
  3818. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  3819. '-' +
  3820. (nowDay < 10 ? '0' + nowDay : nowDay)
  3821. this.getList()
  3822. // this.diagnoses = this.getDictionaryDataConfig('system', 'diagnose')
  3823. // this.other_sick = this.getDictionaryDataConfig('system', 'other_sick_history')
  3824. let tableHeight = document.body.clientHeight - 323
  3825. this.tableHeight = tableHeight
  3826. this.org_id = this.$store.getters.xt_user.template_info.org_id
  3827. },
  3828. mounted() {
  3829. const that = this
  3830. window.onresize = () => {
  3831. return (() => {
  3832. window.fullHeight = document.documentElement.clientHeight
  3833. that.fullHeight = window.fullHeight
  3834. })()
  3835. }
  3836. },
  3837. watch: {
  3838. fullHeight(val) {
  3839. if (!this.timer) {
  3840. this.fullHeight = val
  3841. let tableHeight = val - 323
  3842. this.tableHeight = tableHeight
  3843. this.timer = true
  3844. let that = this
  3845. setTimeout(function() {
  3846. that.timer = false
  3847. }, 400)
  3848. }
  3849. }
  3850. }
  3851. }
  3852. </script>
  3853. <style lang="scss" scoped>
  3854. .new-main-contain {
  3855. height: 100%;
  3856. display: flex;
  3857. flex-direction: column;
  3858. }
  3859. .app-container {
  3860. height: 100%;
  3861. }
  3862. .mainCell {
  3863. height: 36px;
  3864. display: flex;
  3865. align-items: center;
  3866. }
  3867. .mainLeft {
  3868. width: 200px;
  3869. height: 100%;
  3870. display: flex;
  3871. flex-direction: column;
  3872. .el-radio {
  3873. margin-right: 5px;
  3874. }
  3875. }
  3876. .mainRight {
  3877. margin-left: 10px;
  3878. flex: 1;
  3879. height: 100%;
  3880. display: flex;
  3881. flex-direction: column;
  3882. overflow-y: auto;
  3883. .cellSpan {
  3884. min-width: 80px;
  3885. display: inline-block;
  3886. margin-right: 10px;
  3887. }
  3888. }
  3889. .mainCenter {
  3890. display: flex;
  3891. flex: 1;
  3892. }
  3893. .centerLeft {
  3894. flex: 1;
  3895. display: flex;
  3896. flex-direction: column;
  3897. position: relative;
  3898. .el-form-item {
  3899. width: 32%;
  3900. margin-right: 1%;
  3901. float: left;
  3902. }
  3903. .el-form-item__label {
  3904. text-align: left;
  3905. }
  3906. }
  3907. .backColor {
  3908. background: #f6f8f9;
  3909. height: 5px;
  3910. margin-bottom: 5px;
  3911. }
  3912. .tabsBox {
  3913. position: relative;
  3914. height: 76%;
  3915. overflow-y: auto;
  3916. margin-bottom: 60px;
  3917. .el-tabs__item {
  3918. padding: 0 10px;
  3919. }
  3920. }
  3921. .preTabs {
  3922. height: 100%;
  3923. display: flex;
  3924. flex-direction: column;
  3925. .el-tabs__content {
  3926. flex: 1;
  3927. overflow-y: auto;
  3928. }
  3929. }
  3930. .costBox {
  3931. width: 100%;
  3932. height: 60px;
  3933. background: #fff;
  3934. position: absolute;
  3935. bottom: 0;
  3936. display: flex;
  3937. align-items: center;
  3938. }
  3939. .addTab {
  3940. position: absolute;
  3941. right: 0;
  3942. top: 14px;
  3943. z-index: 20;
  3944. }
  3945. .centerRight {
  3946. width: 300px;
  3947. margin-left: 10px;
  3948. display: flex;
  3949. flex-direction: column;
  3950. position: relative;
  3951. }
  3952. .rightTab {
  3953. height: 40px;
  3954. width: 100%;
  3955. border: 1px solid #d2d2d2;
  3956. box-sizing: border-box;
  3957. p {
  3958. width: 50%;
  3959. height: 40px;
  3960. line-height: 40px;
  3961. text-align: center;
  3962. background: #eee;
  3963. float: left;
  3964. }
  3965. > p:last-child {
  3966. border-left: 1px solid #d2d2d2;
  3967. float: right;
  3968. }
  3969. .activeP {
  3970. background: #409EFF;
  3971. color: #fff;
  3972. }
  3973. }
  3974. .comfirmBox {
  3975. width: 100%;
  3976. height: 60px;
  3977. background: #fff;
  3978. position: absolute;
  3979. bottom: 0;
  3980. display: flex;
  3981. align-items: center;
  3982. justify-content: space-between;
  3983. }
  3984. .mainHeader {
  3985. width: 100%;
  3986. background: #fff;
  3987. position: fixed;
  3988. z-index: 100;
  3989. height: 36px;
  3990. }
  3991. .titleBox {
  3992. position: fixed;
  3993. z-index: 99;
  3994. background: #fff;
  3995. }
  3996. .fixedCell {
  3997. position: fixed;
  3998. z-index: 99;
  3999. right: 30px;
  4000. background: #fff;
  4001. width: 300px;
  4002. display: flex;
  4003. justify-content: space-between;
  4004. }
  4005. </style>
  4006. <style lang="scss">
  4007. .centerLeft {
  4008. .el-form-item__label {
  4009. text-align: left;
  4010. }
  4011. }
  4012. .tabsBox {
  4013. .el-tabs__item {
  4014. padding: 0 10px;
  4015. }
  4016. .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) {
  4017. padding: 0 10px;
  4018. }
  4019. .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 {
  4020. padding: 0 10px;
  4021. }
  4022. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  4023. padding: 0 10px;
  4024. }
  4025. }
  4026. .centerRight {
  4027. .el-tabs__nav-scroll {
  4028. display: flex;
  4029. }
  4030. .el-tabs__nav {
  4031. margin: 0 auto;
  4032. }
  4033. .el-table th .cell, .el-table td .cell {
  4034. padding: 0 2px;
  4035. }
  4036. }
  4037. .preTabs {
  4038. .el-tabs__content {
  4039. }
  4040. }
  4041. .rightTabs {
  4042. height: 100%;
  4043. .el-tabs__content {
  4044. }
  4045. }
  4046. .centerDialog {
  4047. .el-dialog__body {
  4048. max-height: calc(100vh - 100px) !important;
  4049. padding: 0 20px;
  4050. }
  4051. }
  4052. </style>