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

deskPrescription.vue 141KB

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