deskPrescription.vue 174KB

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