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

deskPrescription.vue 137KB

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