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

deskPrescription.vue 131KB

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