1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533 |
- <template>
- <div id="user-edit-group-advice">
- <el-dialog
- title="编辑医嘱"
- :visible.sync="groupEditFormVisible"
- width="700px"
- >
- <el-form
- ref="groupForm"
- :rules="groupRules"
- :model="groupForm"
- label-width="90px"
- >
- <el-row>
- <el-col :span="12">
- <el-form-item label="医嘱类型 :" required prop="advice_type">
- <el-input value="临时" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开始时间 :" required prop="start_time">
- <el-date-picker
- type="datetime"
- format="yyyy-MM-dd HH:mm"
- value-format="yyyy-MM-dd HH:mm"
- placeholder="选择时间"
- v-model="groupForm.start_time"
- ></el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="开嘱医生 :">
- <span>{{ adminusername }} </span>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开嘱时间 :">
- <span>{{ groupForm.advice_date }} </span>
- </el-form-item>
- </el-col>
- </el-row>
-
- <el-row>
- <el-col :span="2"> </el-col>
- <el-col :span="5">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ? true : false
- "
- round
- @click="openAdviceTemplate()"
- >选择医嘱模板
- </el-button>
- </el-col>
- <el-col :span="5">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ? true : false
- "
- round
- @click="openGroupAdvice(0)"
- >新增医嘱内容
- </el-button>
- </el-col>
- <el-col :span="5">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ? true : false
- "
- round
- @click="openGroupAdvice(1)"
- >修改医嘱内容
- </el-button>
- </el-col>
- <el-col :span="5">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ? true : false
- "
- round
- @click="openDeleteGroupAdvice()"
- >删除医嘱内容
- </el-button>
- </el-col>
- </el-row>
-
- <el-row>
- <el-col :span="24">
- <el-table
- id="user-edit-advice-name-table"
- :data="groupForm.adviceNames"
- border
- fit
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- highlight-current-row
- :row-class-name="groupClassName"
- @current-change="selectGroupAdvice"
- style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
- :row-key="getRowKey"
- ref="advicenametable"
- >
- <el-table-column
- label="医嘱名称"
- property="advice_name"
- align="center"
- style="word-break: keep-all;white-space:nowrap;"
- ></el-table-column>
- <el-table-column
- label="药品规格"
- property="advice_desc"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.advice_desc"
- >{{ scope.row.advice_desc
- }}{{ scope.row.drug_spec_unit }}</span
- >
- </template>
- </el-table-column>
- <!-- <el-table-column label="药品规格*数量" min-width="80" property="drug_spec" align="center">
- <template slot-scope="scope">
- <span
- v-if="scope.row.drug_spec!=0"
- >{{scope.row.drug_spec}}{{scope.row.drug_spec_unit}}</span>
- <span
- v-if="scope.row.prescribing_number!=0"
- >*{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
- </template>
- </el-table-column> -->
- <el-table-column
- label="开药数量"
- min-width="80"
- property="prescribing_number"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.prescribing_number != 0"
- >{{ scope.row.prescribing_number
- }}{{ scope.row.prescribing_number_unit }}</span
- >
- </template>
- </el-table-column>
- <el-table-column
- label="单次用量"
- min-width="80"
- property="single_dose"
- align="center"
- >
- <template slot-scope="scope">
- <!-- <span v-if="scope.row.single_dose != 0"
- >{{ scope.row.single_dose
- }}{{ scope.row.single_dose_unit }}</span
- > -->
- {{ scope.row.single_dose}}
- <span v-if="scope.row.single_dose_unit >0"> {{getUnit(scope.row.single_dose_unit )}}</span>
- <span v-else>{{ scope.row.single_dose_unit }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="给药途径"
- min-width="80"
- property="delivery_way"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.parent_row == 0">{{
- scope.row.delivery_way
- }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="执行频率"
- min-width="80"
- property="execution_frequency"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.parent_row == 0">{{
- scope.row.execution_frequency
- }}</span>
- </template>
- </el-table-column>
-
- <el-table-column
- label="医嘱嘱托"
- min-width="80"
- property="remark"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.parent_row == 0">{{
- scope.row.remark
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-row>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="groupEditFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="SaveEditAdvices">保 存</el-button>
- </span>
- </el-dialog>
-
- <el-dialog
- title="选择医嘱模板"
- :visible.sync="templateFormVisible"
- width="72%"
- :close-on-click-modal="false"
- >
- <el-row :gutter="20">
- <el-col :span="8">
- <el-table
- :data="adviceTemplates"
- ref="templatetable"
- border
- highlight-current-row
- @current-change="templateTableChange"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- style="width: 100%"
- >
- <el-table-column prop="name" align="center" label="模板名称">
- </el-table-column>
- </el-table>
- </el-col>
- <el-col :span="16">
- <el-table
- id="dialysis-update-select-template-table"
- :data="selectedTemp.list"
- border
- :span-method="spanselecttable"
- @select="selectAdvice"
- @selection-change="changeAdvice"
- @select-all="selectAllTemplateAdvice"
- row-key="row_key"
- ref="selecttemplatetable"
- style="width: 100%"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- >
- <el-table-column type="selection" width="55"> </el-table-column>
- <el-table-column
- label="医嘱内容"
- property="advice_name"
- align="center"
- style="word-break: keep-all;white-space:nowrap;"
- ></el-table-column>
- <el-table-column label="规格" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.advice_desc"
- >{{ scope.row.advice_desc
- }}{{ scope.row.drug_spec_unit }}</span
- >
- </template>
- </el-table-column>
- <el-table-column
- label="开药数量"
- min-width="80"
- property="prescribing_number"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.prescribing_number != 0"
- >{{ scope.row.prescribing_number
- }}{{ scope.row.prescribing_number_unit }}</span
- >
- </template>
- </el-table-column>
- <el-table-column
- label="单次用量"
- min-width="80"
- property="single_dose"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.single_dose != 0"
- >{{ scope.row.single_dose
- }}{{ scope.row.single_dose_unit }}</span
- >
-
- </template>
- </el-table-column>
- <el-table-column
- label="给药途径"
- min-width="80"
- property="delivery_way"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.parent_row == 0">{{
- scope.row.delivery_way
- }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="执行频率"
- min-width="80"
- property="execution_frequency"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.parent_row == 0">{{
- scope.row.execution_frequency
- }}</span>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-row>
-
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancleDialog()">取消</el-button>
- <el-button
- :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
- type="primary"
- @click="newAddTempForm()"
- >保 存
- </el-button>
- </div>
- </el-dialog>
-
- <el-dialog
- title="选择医嘱模板"
- :visible.sync="oldTemplateFormVisible"
- width="700px"
- >
- <el-form ref="templateForm" :rules="templateRules" :model="templateForm">
- <el-row>
- <el-col :span="24">
- <el-form-item prop="id">
- <el-select
- v-model="templateForm.id"
- filterable
- clearable
- placeholder="请选择(输入可搜索)"
- style="width:100%"
- >
- <el-option
- v-for="item in adviceTemplates"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="templateFormVisible = false">取消</el-button>
- <el-button
- :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
- type="primary"
- @click="addTempForm('templateForm')"
- >保 存
- </el-button>
- </div>
- </el-dialog>
-
- <el-dialog
- :title="nameFormTitle"
- :visible.sync="nameFormVisible"
- width="800px"
- >
- <el-form
- ref="nameForm"
- :rules="nameRules"
- :model="nameForm"
- label-width="120px"
- >
- <el-row>
- <el-col :span="10">
- <el-form-item label="医嘱内容 :" required prop="advice_name">
- <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
- <!-- <el-select
- v-model="nameForm.advice_name"
- filterable
- clearable
- allow-create
- :disabled="isChild"
- placeholder="请选择(输入可搜索)"
- style="width:200px"
- @change="changeDrugName"
- >
- <el-option
- v-for="(item,index) in all_drug"
- :key="index"
- :label="item.drug_name"
- :value="item.drug_name"
- ></el-option>
- </el-select> -->
-
- <el-autocomplete
- style="width:100%;"
- class="inline-input"
- v-model="nameForm.advice_name"
- :fetch-suggestions="querySearch"
- placeholder="请输入内容"
- @select="handleSelect"
- @input="changeDrugName"
- ></el-autocomplete>
- </el-form-item>
-
- </el-col>
- <el-col :span="14">
- <!--<el-form-item label="规格 :" prop="advice_desc">-->
- <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
- <!--</el-form-item>-->
- <el-form-item label="药品规格 :" prop="advice_desc">
- <el-col :span="10">
- <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
- <!-- <el-select
- v-model="nameForm.advice_desc"
- filterable
- clearable
- allow-create
- :disabled="isChild"
- placeholder="请选择(输入可搜索)"
- style="width:150px"
- @change="changeDrugDesc"
- >
- <el-option
- v-for="item in drugSpec"
- :key="item.id"
- :label="item.drug_spec"
- :value="item.drug_spec"
- ></el-option>
- </el-select> -->
-
- <el-autocomplete
- style="width:100px;"
- class="inline-input"
- v-model="nameForm.advice_desc"
- :fetch-suggestions="querySearch1"
- placeholder="请输入内容"
-
- @input="changeDrugDesc"
- ></el-autocomplete>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="10">
- <el-select
- v-model="nameForm.drug_spec_unit"
- filterable
- clearable
- allow-create
- placeholder="选择"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- ></el-option>
- </el-select>
- </el-col>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="开药数量 :" prop="prescribing_number">
- <el-col :span="8">
- <el-input v-model="nameForm.prescribing_number"></el-input>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="14">
- <el-select
- v-model="nameForm.prescribing_number_unit"
- filterable
- clearable
- allow-create
- placeholder="选择"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- ></el-option>
- </el-select>
- </el-col>
- </el-form-item>
- </el-col>
-
- <el-col :span="12">
- <el-form-item label="单次用量 :" prop="single_dose">
- <el-col :span="8">
- <el-input v-model="nameForm.single_dose"></el-input>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="14">
- <el-select
- v-model="nameForm.single_dose_unit"
- filterable
- clearable
- allow-create
- placeholder="选择"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-col>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="给药途径 :" prop="delivery_way">
- <el-select
- v-model="nameForm.delivery_way"
- filterable
- clearable
- allow-create
- :disabled="isChild"
- placeholder="请选择(输入可搜索)"
- style="width:100%"
- >
- <el-option
- v-for="item in deliveryWayOptions"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="执行频率 :" prop="execution_frequency">
- <el-select
- v-model="nameForm.execution_frequency"
- filterable
- clearable
- allow-create
- :disabled="isChild"
- placeholder="请选择(输入可搜索)"
- style="width:100%"
- >
- <el-option
- v-for="item in executionFrequencyOptions"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="nameFormVisible = false">取消</el-button>
- <el-button
- :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
- type="primary"
- @click="submitNameForm('nameForm')"
- >保 存
- </el-button>
- </div>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import {
- CreateDoctorAdvice,
- CreateGroupAdvice,
- DeleteDoctorAdvice,
- DeleteGroupAdvice,
- EditDoctorAdvice,
- getAdviceConfig,
- getDoctorAdviceList,
- StopDoctorAdvice,
- SaveEditAdvices
- } from "@/api/advice";
- import { getDataConfig } from '@/utils/data'
- import { jsGetAge, uParseTime } from "@/utils/tools";
- import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
- export default {
- name: "AddGroupAdvice",
- data() {
- return {
- editRowKey: 0,
- oldTemplateFormVisible: false,
- templateFormVisible: false,
- groupEditFormVisible: false,
- nameFormVisible: false,
- groupSelectRow: null,
- nameFormTitle: "",
- isChild: false,
- isEdit: false,
- groupRules: {
- advice_type: [{ required: true, message: "请选择医嘱类型" }],
- advice_date: [{ required: true, message: "请选择医嘱时间" }],
- start_time: [{ required: true, message: "请选择开始时间" }],
- advice_name: [{ required: true, message: "请填写医嘱名称" }],
- advice_doctor: [{ required: true, message: "请选择开嘱医生" }]
- },
- nameRules: {
- advice_name: [{ required: true, message: "请填写医嘱内容" }]
- },
- templateRules: {
- id: [{ required: true, message: "请选择医嘱模板" }]
- },
- templateForm: { id: "" },
- nameForm: {
- advice_name: "",
- advice_desc: "",
- single_dose: "",
- single_dose_unit: "",
- drug_spec: "",
- drug_spec_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- delivery_way: "",
- execution_frequency: "",
- isEdit: 0,
- index: 0,
- id: 0,
- children: [],
- drug_id:"",
- way:"",
- drug_name_id:"",
- },
- submitGroupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0,
- drug_name_id:"",
- drug_id:"",
- way:""
- },
- groupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0,
- way:"",
- drug_id:"",
- drug_name_id:"",
- },
- adminusername: "",
- selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
- selectedTemplate: [],
- allSelectedTemplate: [],
- medicals:[],
- drugSpec:[],
- all_drug:[],
- current_drug_name:"",
- current_drug_spec: "",
- drug_id: 0,
- src_type:"",
- drug_name_id:0,
- units:[],
- };
- },
- props: {
- patientID: 0,
- adviceType: 0,
- rowKey: 0,
- groupNo: 0,
- adviceTemplates: {
- type: Array,
- default: function() {
- return [];
- }
- },
- recordDate: "",
- adviceTypeOptions: {
- type: Array,
- default: function() {
- return [];
- }
- },
- deliveryWayOptions: {
- type: Array,
- default: () => []
- },
- unitsOption: {
- type: Array,
- default: function() {
- return [];
- }
- },
- executionFrequencyOptions: {
- type: Array,
- default: function() {
- return [];
- }
- },
- adviceTemplateMaps: {
- type: Object,
- default: function() {
- return {};
- }
- },
- adviceTableData: {
- type: Array,
- default: function() {
- return [];
- }
- },
- admin_users: {
- // 系统用户列表
- type: Array,
- default: () => {
- return [];
- }
- }
- },
- methods: {
- handleSelect(val){
- console.log("2222",val)
- var tmp = val.drug_specs[0]
- console.log("tmp",tmp)
- this.nameForm.advice_desc = tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
- this.nameForm.drug_spec_unit = tmp.max_unit
- this.nameForm.prescribing_number = tmp.prescribing_number//开药数量
- this.nameForm.prescribing_number_unit = tmp.prescribing_number_unit
- this.nameForm.single_dose = tmp.single_dose//单次用量
- this.nameForm.single_dose_unit = tmp.drug_dose_unit
- this.nameForm.delivery_way = tmp.delivery_way//给药途径
- this.nameForm.execution_frequency = tmp.execution_frequency//执行频率
- this.nameForm.drug_id = tmp.id
- },
- getXuserName(id) {
- if (id <= 0) {
- return "";
- }
- var name = "";
- if (
- this.admin_users == null ||
- typeof this.admin_users.length === "undefined"
- ) {
- return name;
- }
- var leng = this.admin_users.length;
- if (leng == 0) {
- return name;
- }
- for (let index = 0; index < leng; index++) {
- if (this.admin_users[index].id == id) {
- name = this.admin_users[index].name;
- break;
- }
- }
- return name;
- },
- openDeleteGroupAdvice() {
- if (this.groupSelectRow === null) {
- this.$message.error("未选择要删除的医嘱内容");
- return;
- }
- console.log(this.groupSelectRow);
- var content = "";
-
- if (this.groupSelectRow.children.length > 0) {
- content = "确认删除此医嘱内容,包括它的子药?";
- } else {
- content = "确认删除此医嘱内容?";
- }
- var isChild = !!this.groupSelectRow.parent_row;
- var title = isChild ? "删除子药内容" : "删除医嘱内容";
- var msg = isChild ? "确认删除此子药内容?" : content;
- this.$confirm(msg, title, {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- let mode = "4";
- if (
- this.groupSelectRow.advice_doctor !=
- this.$store.getters.xt_user.user.id
- ) {
- mode = "5";
- }
- DeleteDoctorAdvice(this.groupSelectRow.id, mode).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "医嘱已经删除",
- type: "success",
- duration: 2000
- });
-
- var ale = this.groupForm.adviceNames.length;
- var atle = this.adviceTableData.length;
- for (let index = atle - 1; index >= 0; index--) {
- if (
- this.adviceTableData[index].parent_id ===
- this.groupSelectRow.id ||
- this.adviceTableData[index].id === this.groupSelectRow.id
- ) {
- this.adviceTableData.splice(index, 1);
- }
- }
- if (isChild) {
- for (const index in this.groupForm.adviceNames) {
- if (
- this.groupForm.adviceNames[index].row_key ==
- this.groupSelectRow.parent_row
- ) {
- for (const j in this.groupForm.adviceNames[index]
- .children) {
- if (
- this.groupForm.adviceNames[index].children[j].row_key ==
- this.groupSelectRow.row_key
- ) {
- this.groupForm.adviceNames[index].children.splice(j, 1);
- this.$set(
- this.groupForm.adviceNames,
- index,
- this.groupForm.adviceNames[index]
- );
- break;
- }
- }
- }
- }
- } else {
- for (const index in this.groupForm.adviceNames) {
- if (
- this.groupForm.adviceNames[index].row_key ==
- this.groupSelectRow.row_key
- ) {
- this.groupForm.adviceNames.splice(index, 1);
- break;
- }
- }
- }
- if (isChild) {
- for (const index in this.groupForm.adviceNames) {
- if (
- this.groupForm.adviceNames[index].row_key ==
- this.groupSelectRow.parent_row
- ) {
- for (const j in this.groupForm.adviceNames[index]
- .children) {
- if (
- this.groupForm.adviceNames[index].children[j].row_key ==
- this.groupSelectRow.row_key
- ) {
- this.groupForm.adviceNames[index].children.splice(j, 1);
- this.$set(
- this.groupForm.adviceNames,
- index,
- this.groupForm.adviceNames[index]
- );
- this.toggleRowExpansion();
- break;
- }
- }
- }
- }
- } else {
- for (const index in this.groupForm.adviceNames) {
- if (
- this.groupForm.adviceNames[index].row_key ==
- this.groupSelectRow.row_key
- ) {
- this.groupForm.adviceNames.splice(index, 1);
- this.toggleRowExpansion();
- break;
- }
- }
- }
- }
- });
- })
- .catch(() => {});
- },
- submitNameForm(formName) {
-
- if(this.src_type == ""){
- this.nameForm.way = 0
- this.nameForm.drug_id = 0
- this.nameForm.drug_name_id = 0
- }
-
- if(this.src_type == 2){ //自备药
- var arr = this.nameForm.advice_name.split("(自备药)")
- this.nameForm.advice_name = arr[0]
- }
-
- var _this = this;
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (_this.nameForm.isEdit) {
- var single_dose_unit = ""
- if(_this.nameForm.single_dose_unit > 0){
- single_dose_unit = this.getUnit(_this.nameForm.single_dose_unit)
- }else{
- single_dose_unit = _this.nameForm.single_dose_unit
- }
- console.log("single_dose_unit332323223",single_dose_unit)
- var submitForm = {
- advice_type: _this.groupForm.advice_type,
- advice_date: _this.groupForm.advice_date,
- start_time: _this.groupForm.start_time,
-
- advice_name: _this.nameForm.advice_name,
- advice_desc: _this.nameForm.advice_desc,
- single_dose: "" + _this.nameForm.single_dose,
- single_dose_unit: single_dose_unit,
- drug_spec: "" + _this.nameForm.drug_spec,
- drug_spec_unit: _this.nameForm.drug_spec_unit,
- prescribing_number: "" + _this.nameForm.prescribing_number,
- prescribing_number_unit: _this.nameForm.prescribing_number_unit,
- delivery_way: _this.nameForm.delivery_way,
- execution_frequency: _this.nameForm.execution_frequency,
- isEdit: 0,
- id: 0,
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: _this.groupSelectRow.parent_id,
- groupno: _this.groupForm.groupno,
- drug_name_id:_this.groupForm.drug_name_id,
- drug_id:_this.groupForm.drug_id,
- way:_this.groupForm.way,
-
- };
- let mode = "2";
- if (
- this.groupSelectRow.advice_doctor !=
- this.$store.getters.xt_user.user.id
- ) {
- mode = "3";
- }
- console.log("22222",submitForm)
-
- EditDoctorAdvice(
- this.patientID,
- this.groupSelectRow.id,
- submitForm,
- mode
- ).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "修改医嘱成功",
- type: "success",
- duration: 2000
- });
- var ale = _this.groupForm.adviceNames.length;
- var atle = _this.adviceTableData.length;
-
- for (let index = 0; index < atle; index++) {
- if (
- _this.groupSelectRow.id == _this.adviceTableData[index].id
- ) {
- var advice = response.data.data.advice;
-
- _this.adviceTableData[index].drug_spec = advice.drug_spec;
- _this.adviceTableData[index].drug_spec_unit =
- advice.drug_spec_unit;
- _this.adviceTableData[index].start_time = advice.start_time;
- _this.adviceTableData[index].advice_name =
- advice.advice_name;
- _this.adviceTableData[index].advice_desc =
- advice.advice_desc;
- _this.adviceTableData[index].single_dose =
- advice.single_dose;
- _this.adviceTableData[index].single_dose_unit =
- advice.single_dose_unit;
- _this.adviceTableData[index].delivery_way =
- advice.delivery_way;
- _this.adviceTableData[index].execution_frequency =
- advice.execution_frequency;
- _this.adviceTableData[index].prescribing_number =
- advice.prescribing_number;
- _this.adviceTableData[index].prescribing_number_unit =advice.prescribing_number_unit;
- _this.adviceTableData[index].drug_name_id = advice.drug_name_id;
- _this.adviceTableData[index].drug_id = advice.drug_id,
- _this.adviceTableData[index].way = advice.way
- break;
- }
- }
-
- if (_this.isChild) {
- for (let index = 0; index < ale; index++) {
- if (
- _this.groupSelectRow.parent_row ==
- _this.groupForm.adviceNames[index].row_key
- ) {
- var cle =
- _this.groupForm.adviceNames[index].children.length;
- var children =
- _this.groupForm.adviceNames[index].children;
- for (let j = 0; j < ale; j++) {
- if (
- _this.groupSelectRow.row_key == children[j].row_key
- ) {
- _this.groupForm.adviceNames[index].children[
- j
- ].advice_name = _this.nameForm.advice_name;
- _this.groupForm.adviceNames[index].children[
- j
- ].advice_desc = _this.nameForm.advice_desc;
- _this.groupForm.adviceNames[index].children[
- j
- ].single_dose = "" + _this.nameForm.single_dose;
- _this.groupForm.adviceNames[index].children[
- j
- ].single_dose_unit = _this.nameForm.single_dose_unit;
- _this.groupForm.adviceNames[index].children[
- j
- ].drug_spec = "" + _this.nameForm.drug_spec;
- _this.groupForm.adviceNames[index].children[
- j
- ].drug_spec_unit = _this.nameForm.drug_spec_unit;
- _this.groupForm.adviceNames[index].children[
- j
- ].prescribing_number =
- "" + _this.nameForm.prescribing_number;
- _this.groupForm.adviceNames[index].children[
- j
- ].prescribing_number_unit =
- _this.nameForm.prescribing_number_unit;
- _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
- _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
- _this.groupForm.adviceNames[index].children[j].drug_id =_this.nameForm.drug_id;
- _this.groupForm.adviceNames[index].children[j].drug_name_id =_this.nameForm.drug_name_id;
- _this.groupForm.adviceNames[index].children[j].way =_this.nameForm.way;
- _this.$set(
- _this.groupForm.adviceNames[index].children,
- j,
- _this.groupForm.adviceNames[index].children[j]
- );
- break;
- }
- }
- }
- }
- } else {
- for (let index = 0; index < ale; index++) {
- if (
- _this.groupSelectRow.row_key ==
- _this.groupForm.adviceNames[index].row_key
- ) {
- _this.groupForm.adviceNames[index].advice_name =
- _this.nameForm.advice_name;
- _this.groupForm.adviceNames[index].advice_desc =
- _this.nameForm.advice_desc;
- _this.groupForm.adviceNames[index].single_dose =
- "" + _this.nameForm.single_dose;
- _this.groupForm.adviceNames[index].single_dose_unit =
- _this.nameForm.single_dose_unit;
- _this.groupForm.adviceNames[index].drug_spec =
- "" + _this.nameForm.drug_spec;
- _this.groupForm.adviceNames[index].drug_spec_unit =
- _this.nameForm.drug_spec_unit;
- _this.groupForm.adviceNames[index].prescribing_number =
- "" + _this.nameForm.prescribing_number;
- _this.groupForm.adviceNames[
- index
- ].prescribing_number_unit =
- _this.nameForm.prescribing_number_unit;
- _this.groupForm.adviceNames[index].delivery_way =
- _this.nameForm.delivery_way;
- _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
- _this.groupForm.adviceNames[index].drug_name_id =_this.nameForm.drug_name_id;
- _this.groupForm.adviceNames[index].drug_id =_this.nameForm.drug_id;
- _this.groupForm.adviceNames[index].way =_this.nameForm.way;
- _this.$set(
- _this.groupForm.adviceNames,
- index,
- _this.groupForm.adviceNames[index]
- );
- break;
- }
- }
- }
- }
- });
- } else {
- if (_this.isChild) {
- var submitForm = {
- advice_type: _this.groupForm.advice_type,
- advice_date: _this.groupForm.advice_date,
- start_time: _this.groupForm.start_time,
- advice_name: _this.nameForm.advice_name,
- advice_desc: _this.nameForm.advice_desc,
- single_dose: "" + _this.nameForm.single_dose,
- single_dose_unit: _this.nameForm.single_dose_unit,
- drug_spec: "" + _this.nameForm.drug_spec,
- drug_spec_unit: _this.nameForm.drug_spec_unit,
- prescribing_number: "" + _this.nameForm.prescribing_number,
- prescribing_number_unit: _this.nameForm.prescribing_number_unit,
- delivery_way: _this.nameForm.delivery_way,
- execution_frequency: _this.nameForm.execution_frequency,
- drug_name_id:_this.nameForm.drug_name_id,
- drug_id:_this.nameForm.drug_id,
- way:_this.nameForm.way,
- isEdit: 0,
- id: 0,
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: _this.groupSelectRow.id,
- groupno: _this.groupForm.groupno
- };
- let mode = "1";
-
- CreateDoctorAdvice(this.patientID, submitForm, mode).then(
- response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "新增子药成功",
- type: "success",
- duration: 2000
- });
- var spliceIndex = -1;
- for (
- let index = _this.adviceTableData.length - 1;
- ;
- index--
- ) {
- if (
- _this.adviceTableData[index].parent_id ===
- _this.groupSelectRow.id
- ) {
- spliceIndex = index;
- break;
- } else if (
- _this.adviceTableData[index].id ===
- _this.groupSelectRow.id
- ) {
- spliceIndex = index;
- break;
- }
- }
-
- if (spliceIndex > -1) {
- spliceIndex += 1;
- if (spliceIndex === _this.adviceTableData.length) {
- _this.adviceTableData.push(response.data.data.advice);
- } else {
- _this.adviceTableData.splice(
- spliceIndex,
- 0,
- response.data.data.advice
- );
- }
- }
- var ale = _this.groupForm.adviceNames.length;
- for (let index = 0; index < ale; index++) {
- if (
- _this.nameForm.parent_row ==
- _this.groupForm.adviceNames[index].row_key
- ) {
- _this.editRowKey++;
- _this.nameForm.row_key = _this.editRowKey;
- _this.groupForm.adviceNames[index].children.push(
- _this.nameForm
- );
- _this.$set(
- _this.groupForm.adviceNames,
- index,
- _this.groupForm.adviceNames[index]
- );
- break;
- }
- }
- // _this.resetForm(formName);
- return false;
- }
- }
- );
- } else {
- _this.submitGroupForm = {
- advice_type: _this.groupForm.advice_type,
- advice_date: _this.groupForm.advice_date,
- start_time: _this.groupForm.start_time,
- adviceNames: [
- {
- advice_name: _this.nameForm.advice_name,
- advice_desc: _this.nameForm.advice_desc,
- single_dose: "" + _this.nameForm.single_dose,
- single_dose_unit: _this.nameForm.single_dose_unit,
- drug_spec: "" + _this.nameForm.drug_spec,
- drug_spec_unit: _this.nameForm.drug_spec_unit,
- prescribing_number: "" + _this.nameForm.prescribing_number,
- prescribing_number_unit:
- _this.nameForm.prescribing_number_unit,
- delivery_way: _this.nameForm.delivery_way,
- execution_frequency: _this.nameForm.execution_frequency,
- drug_name_id:_this.nameForm.drug_name_id,
- drug_id:_this.nameForm.drug_id,
- way:_this.nameForm.way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0
- }
- ],
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: 0
- };
- let mode = "1";
-
- CreateGroupAdvice(
- _this.patientID,
- _this.groupForm.groupno,
- _this.submitGroupForm,
- mode
- ).then(response => {
- if (response.data.state == 0) {
- _this.$message.error(response.data.msg);
- return false;
- } else {
- _this.$notify({
- title: "成功",
- message: "新增成功",
- type: "success",
- duration: 2000
- });
- // var alen = response.data.data.advices.length
- // for (let index = alen-1; index >=0; index--) {
- // _this.adviceTableData.unshift(response.data.data.advices[index]);
- // }
- // for (const index in response.data.data.advices) {
- // _this.adviceTableData.unshift(response.data.data.advices[index]);
- // }
- var groups = response.data.data.advices;
- var childMap = {};
- for (const index in groups) {
- if (groups[index].parent_id == 0) {
- continue;
- }
- if (groups[index].parent_id in childMap === false) {
- childMap[groups[index].parent_id] = [];
- }
- childMap[groups[index].parent_id].push(groups[index]);
- }
-
- var parentArr = [];
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- parentArr.push(groups[index]);
- }
-
- var groupNo = groups[0].groupno;
- var newData = { groupNo: parentArr };
- for (const index in _this.adviceTableData) {
- if (_this.adviceTableData[index].groupno == groupNo) {
- for (const i in parentArr) {
- if (parentArr[i].id in childMap) {
- for (const j in childMap[parentArr[i].id]) {
- _this.adviceTableData.splice(
- index,
- 0,
- childMap[parentArr[i].id][j]
- );
- }
- }
- _this.adviceTableData.splice(index, 0, parentArr[i]);
- }
- break;
- }
- }
-
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- _this.editRowKey++;
- var item = {
- advice_name: groups[index].advice_name,
- advice_desc: groups[index].advice_desc,
- single_dose: "" + groups[index].single_dose,
- single_dose_unit: groups[index].single_dose_unit,
- drug_spec: "" + groups[index].drug_spec,
- drug_spec_unit: groups[index].drug_spec_unit,
- prescribing_number: "" + groups[index].prescribing_number,
- prescribing_number_unit:
- groups[index].prescribing_number_unit,
- delivery_way: groups[index].delivery_way,
- execution_frequency: groups[index].execution_frequency,
- drug_name_id:groups[index].drug_name_id,
- drug_id:groups[index].drug_id,
- way:groups[index].way,
- isEdit: 0,
- index: 0,
- id: groups[index].id,
- children: [],
- parent_row: 0,
- row_key: _this.editRowKey
- };
- if (item.id in childMap) {
- for (const key in childMap[item.id]) {
- _this.editRowKey++;
- var child = {
- advice_name: childMap[item.id][key].advice_name,
- advice_desc: childMap[item.id][key].advice_desc,
- single_dose: "" + childMap[item.id][key].single_dose,
- single_dose_unit:
- childMap[item.id][key].single_dose_unit,
- drug_spec: "" + childMap[item.id][key].drug_spec,
- drug_spec_unit: childMap[item.id][key].drug_spec_unit,
- prescribing_number:
- "" + childMap[item.id][key].prescribing_number,
- prescribing_number_unit:
- childMap[item.id][key].prescribing_number_unit,
- delivery_way: childMap[item.id][key].delivery_way,
- execution_frequency:childMap[item.id][key].execution_frequency,
- drug_name_id:childMap[item.id][key].drug_name_id,
- drug_id:childMap[item.id][key].drug_id,
- way:childMap[item.id][key].way,
- isEdit: 0,
- index: 0,
- id: childMap[item.id][key].id,
- children: [],
- parent_row: item.row_key,
- row_key: _this.editRowKey
- };
- item.children.push(child);
- }
- _this.$set(item, "children", item.children);
- }
- _this.groupForm.adviceNames.unshift(item);
- }
-
- _this.resetForm(formName);
- return false;
- }
- });
- }
- }
- _this.nameFormVisible = false;
- }
- });
- },
-
- openGroupChild() {
- if (this.groupSelectRow === null) {
- this.$message.error("未选择医嘱内容,无法添加子药");
-
- return;
- } else if (this.groupSelectRow.parent_row > 0) {
- this.$notify.error({
- title: "错误",
- message: "子药不能添加子药"
- });
- return;
- }
- this.nameForm = {
- advice_name: "",
- advice_desc: "",
- single_dose: "",
- single_dose_unit: "",
- drug_spec: "",
- drug_spec_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- delivery_way: this.groupSelectRow.delivery_way,
- execution_frequency: this.groupSelectRow.execution_frequency,
- isEdit: 0,
- index: 0,
- children: [],
- parent_row: this.groupSelectRow.row_key,
- id: 0,
- drug_name_id:"",
- way:"",
- drug_id:"",
- };
- this.isChild = true;
- this.nameFormVisible = true;
- this.nameFormTitle = "添加子药内容";
- },
- openGroupAdvice(isEdit) {
- this.isChild = false;
- if (isEdit) {
- if (this.groupSelectRow === null) {
- this.$message.error("未选择要修改的医嘱内容");
- return;
- }
- if (this.groupSelectRow.parent_row) {
- this.isChild = true;
- }
-
- this.nameForm = {
- advice_name: this.groupSelectRow.advice_name,
- advice_desc: this.groupSelectRow.advice_desc,
- single_dose:
- this.groupSelectRow.single_dose != 0
- ? this.groupSelectRow.single_dose
- : "",
- single_dose_unit: this.groupSelectRow.single_dose_unit,
- drug_spec:
- this.groupSelectRow.drug_spec != 0
- ? this.groupSelectRow.drug_spec
- : "",
- drug_spec_unit: this.groupSelectRow.drug_spec_unit,
- prescribing_number:
- this.groupSelectRow.prescribing_number != 0
- ? this.groupSelectRow.prescribing_number
- : "",
- prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
- delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
- execution_frequency: this.isChild? "": this.groupSelectRow.execution_frequency,
- drug_name_id:this.isChild?"":this.groupSelectRow.drug_name_id,
- drug_id:this.isChild?"":this.groupSelectRow.drug_id,
- way:this.isChild?"":this.groupSelectRow.way,
- isEdit: 1,
- index: this.groupSelectRow.index,
- id: this.groupSelectRow.id,
- children: [],
- parent_row: this.groupSelectRow.parent_row,
- // row_key:this.groupSelectRow.row_key,
- };
- this.nameFormTitle = "修改医嘱内容";
- this.nameFormVisible = true;
- } else {
- this.nameForm = {
- advice_name: "",
- advice_desc: "",
- single_dose: "",
- single_dose_unit: "",
- drug_spec: "",
- drug_spec_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- delivery_way: "",
- execution_frequency: "",
- drug_name_id:"",
- drug_id:"",
- way:"",
- isEdit: 0,
- index: 0,
- id: 0,
- children: [],
- parent_row: 0
- };
- this.nameFormTitle = "新增医嘱内容";
- }
- this.nameFormVisible = true;
- },
-
- changeAdvice(selection) {
- this.selectedTemplate = selection;
- },
- selectAllTemplateAdvice(selection) {
- var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
- .DoctorAdviceTemplate;
- for (let y = 0; y < adviceArray.length; y++) {
- adviceArray[y].selection = false;
- }
- if (selection.length > 0) {
- for (let y = 0; y < adviceArray.length; y++) {
- for (let i = 0; i < selection.length; i++) {
- if (adviceArray[y].id == selection[i].advice_id) {
- adviceArray[y].selection = true;
- }
- }
- }
- }
- },
- selectAdvice(selection, row) {
- // this.selectedTemplate = [];
- var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
- .DoctorAdviceTemplate;
- for (let y = 0; y < adviceArray.length; y++) {
- adviceArray[y].selection = false;
- }
- if (selection.length > 0) {
- for (let y = 0; y < adviceArray.length; y++) {
- for (let i = 0; i < selection.length; i++) {
- if (adviceArray[y].id == selection[i].advice_id) {
- adviceArray[y].selection = true;
- }
- }
- }
- }
-
- // this.selectedTemplate = [];
- if (row.children.length > 0) {
- for (const index in row.children) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- row.children[index]
- );
- }
- }
-
- // 下面两步的作用是为了上选中的数据的输出顺序不变
- for (const index in this.selectedTemp.list) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- this.selectedTemp.list[index]
- );
- if (this.selectedTemp.list[index].children.length > 0) {
- for (const j in this.selectedTemp.list[index].children) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- this.selectedTemp.list[index].children[j]
- );
- }
- }
- }
-
- for (const index in this.selectedTemp.list) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- this.selectedTemp.list[index]
- );
- if (this.selectedTemp.list[index].children.length > 0) {
- for (const j in this.selectedTemp.list[index].children) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- this.selectedTemp.list[index].children[j]
- );
- }
- }
- }
- },
- cancleDialog() {
- this.templateFormVisible = false;
- for (const indexs in this.adviceTemplateMaps) {
- const adviceTemplate = this.adviceTemplateMaps[indexs];
- for (const index in adviceTemplate.DoctorAdviceTemplate) {
- adviceTemplate.DoctorAdviceTemplate[index].selection = false;
- }
- }
- },
- spanselecttable({ row, column, rowIndex, columnIndex }) {
- if (columnIndex == 0) {
- const _row = this.selectedTemp.rows[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- },
- calcselectedTemp() {
- var rowKeys = 0;
- for (const index in this.selectedTemp.list) {
- var pkey = rowKeys;
- this.selectedTemp.rows[rowKeys] = 1;
- if (this.selectedTemp.list[index].children.length > 0) {
- for (const childindex in this.selectedTemp.list[index].children) {
- rowKeys++;
- this.selectedTemp.rows[pkey] += 1;
- this.selectedTemp.rows[rowKeys] = 0;
- }
- }
- rowKeys++;
- this.$nextTick(function() {
- if (this.selectedTemp.list[index].selection) {
- this.$refs.selecttemplatetable.toggleRowSelection(
- this.selectedTemp.list[index]
- );
- }
- });
- }
- },
- templateTableChange(currentRow, oldCurrentRow) {
- this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
- if (currentRow == null) {
- return false;
- }
- this.selectedTemp.id = currentRow.id;
- this.selectedTemp.name = currentRow.name;
- this.selectedTemp.org_id = currentRow.org_id;
- if (this.selectedTemp.id in this.adviceTemplateMaps) {
- var mapid = this.selectedTemp.id;
- var thisRowKey = 0;
- for (const index in this.adviceTemplateMaps[mapid]
- .DoctorAdviceTemplate) {
- thisRowKey++;
- var item = {
- advice_name: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].advice_name,
- advice_desc: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].advice_desc,
- single_dose:
- "" +
- this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .single_dose,
- single_dose_unit: this.adviceTemplateMaps[mapid]
- .DoctorAdviceTemplate[index].single_dose_unit,
- drug_spec:
- "" +
- this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .drug_spec,
- drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].drug_spec_unit,
- prescribing_number:
- "" +
- this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .prescribing_number,
- prescribing_number_unit: this.adviceTemplateMaps[mapid]
- .DoctorAdviceTemplate[index].prescribing_number_unit,
- delivery_way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].delivery_way,
- execution_frequency: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
- drug_name_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
- way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
- drug_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
- advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].id,
- selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].selection,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0,
- row_key: thisRowKey
- };
- if (
- "children" in
- this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
- this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].children
- .length > 0
- ) {
- var parentRow = thisRowKey;
- var children = this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].children;
- for (const key in children) {
- thisRowKey++;
- var child = {
- advice_id: children[key].id,
- advice_name: children[key].advice_name,
- advice_desc: children[key].advice_desc,
- single_dose: "" + children[key].single_dose,
- single_dose_unit: children[key].single_dose_unit,
- drug_spec: "" + children[key].drug_spec,
- drug_spec_unit: children[key].drug_spec_unit,
- prescribing_number: "" + children[key].prescribing_number,
- prescribing_number_unit: children[key].prescribing_number_unit,
- delivery_way: children[key].delivery_way,
- execution_frequency: children[key].execution_frequency,
- drug_name_id:children[key].drug_name_id,
- drug_id:children[key].drug_id,
- way:children[key].way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: thisRowKey
- };
- item.children.push(child);
- }
- this.$set(item, "children", item.children);
- }
-
- this.selectedTemp.list.unshift(item);
- }
- }
- },
- newAddTempForm() {
- this.allSelectedTemplate = [];
-
- var thisRowKey = 0;
- for (const indexs in this.adviceTemplateMaps) {
- const adviceTemplate = this.adviceTemplateMaps[indexs];
- for (const index in adviceTemplate.DoctorAdviceTemplate) {
- if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
- thisRowKey++;
- var item = {
- advice_name:
- adviceTemplate.DoctorAdviceTemplate[index].advice_name,
- advice_desc:
- adviceTemplate.DoctorAdviceTemplate[index].advice_desc,
- single_dose:
- "" + adviceTemplate.DoctorAdviceTemplate[index].single_dose,
- single_dose_unit:
- adviceTemplate.DoctorAdviceTemplate[index].single_dose_unit,
- drug_spec:
- "" + adviceTemplate.DoctorAdviceTemplate[index].drug_spec,
- drug_spec_unit:
- adviceTemplate.DoctorAdviceTemplate[index].drug_spec_unit,
- prescribing_number:
- "" +
- adviceTemplate.DoctorAdviceTemplate[index].prescribing_number,
- prescribing_number_unit:
- adviceTemplate.DoctorAdviceTemplate[index]
- .prescribing_number_unit,
- delivery_way:
- adviceTemplate.DoctorAdviceTemplate[index].delivery_way,
- execution_frequency:adviceTemplate.DoctorAdviceTemplate[index].execution_frequency,
- drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
- drug_id:adviceTemplate.DoctorAdviceTemplate[index].drug_id,
- way:adviceTemplate.DoctorAdviceTemplate[index].way,
- advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
- selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0,
- row_key: thisRowKey
- };
- if (
- "children" in adviceTemplate.DoctorAdviceTemplate[index] &&
- adviceTemplate.DoctorAdviceTemplate[index].children.length > 0
- ) {
- var parentRow = thisRowKey;
- var children =
- adviceTemplate.DoctorAdviceTemplate[index].children;
- for (const key in children) {
- thisRowKey++;
- var child = {
- advice_id: children[key].id,
- advice_name: children[key].advice_name,
- advice_desc: children[key].advice_desc,
- single_dose: "" + children[key].single_dose,
- single_dose_unit: children[key].single_dose_unit,
- drug_spec: "" + children[key].drug_spec,
- drug_spec_unit: children[key].drug_spec_unit,
- prescribing_number: "" + children[key].prescribing_number,
- prescribing_number_unit:
- children[key].prescribing_number_unit,
- delivery_way: children[key].delivery_way,
- execution_frequency: children[key].execution_frequency,
- drug_name_id: children[key].drug_name_id,
- drug_id:children[key].drug_id,
- way:children[key].way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: thisRowKey
- };
- item.children.push(child);
- this.allSelectedTemplate.unshift(child);
- }
- this.$set(item, "children", item.children);
- }
- this.allSelectedTemplate.unshift(item);
- adviceTemplate.DoctorAdviceTemplate[index].selection = false;
- }
- }
- }
-
- var childMap = {};
- for (const index in this.allSelectedTemplate) {
- if (this.allSelectedTemplate[index].parent_row > 0) {
- if (!(this.allSelectedTemplate[index].parent_row in childMap)) {
- childMap[this.allSelectedTemplate[index].parent_row] = [];
- }
- childMap[this.allSelectedTemplate[index].parent_row].push(
- this.allSelectedTemplate[index]
- );
- }
- }
-
- this.submitGroupForm = {
- advice_type: this.groupForm.advice_type,
- advice_date: this.groupForm.advice_date,
- start_time: this.groupForm.start_time,
- adviceNames: [],
- advice_doctor: "",
- remark: this.groupForm.remark,
- parent_id: 0
- };
-
- for (const index in this.allSelectedTemplate) {
- if (this.allSelectedTemplate[index].parent_row > 0) {
- continue;
- }
- this.editRowKey++;
- var item = {
- advice_name: this.allSelectedTemplate[index].advice_name,
- advice_desc: this.allSelectedTemplate[index].advice_desc,
- single_dose: "" + this.allSelectedTemplate[index].single_dose,
- single_dose_unit: this.allSelectedTemplate[index].single_dose_unit,
- drug_spec: "" + this.allSelectedTemplate[index].drug_spec,
- drug_spec_unit: this.allSelectedTemplate[index].drug_spec_unit,
- prescribing_number:
- "" + this.allSelectedTemplate[index].prescribing_number,
- prescribing_number_unit: this.allSelectedTemplate[index]
- .prescribing_number_unit,
- delivery_way: this.allSelectedTemplate[index].delivery_way,
- execution_frequency: this.allSelectedTemplate[index].execution_frequency,
- drug_name_id: this.allSelectedTemplate[index].drug_name_id,
- way:this.allSelectedTemplate[index].way,
- drug_id:this.allSelectedTemplate[index].drug_id,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0,
- row_key: this.editRowKey
- };
- if (this.allSelectedTemplate[index].children.length > 0) {
- if (this.allSelectedTemplate[index].row_key in childMap) {
- var parentRow = this.editRowKey;
- var children = childMap[this.allSelectedTemplate[index].row_key];
- for (const key in children) {
- this.editRowKey++;
- var child = {
- advice_name: children[key].advice_name,
- advice_desc: children[key].advice_desc,
- single_dose: "" + children[key].single_dose,
- single_dose_unit: children[key].single_dose_unit,
- drug_spec: "" + children[key].drug_spec,
- drug_spec_unit: children[key].drug_spec_unit,
- prescribing_number: "" + children[key].prescribing_number,
- prescribing_number_unit: children[key].prescribing_number_unit,
- delivery_way: children[key].delivery_way,
- execution_frequency: children[key].execution_frequency,
- drug_name_id: children[key].drug_name_id,
- drug_id:children[key].drug_id,
- way:children[key].way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: this.editRowKey
- };
- item.children.push(child);
- }
- this.$set(item, "children", item.children);
- }
- }
- this.submitGroupForm.adviceNames.unshift(item);
- }
- let mode = "1";
-
- CreateGroupAdvice(
- this.patientID,
- this.groupForm.groupno,
- this.submitGroupForm,
- mode
- ).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "新增成功",
- type: "success",
- duration: 2000
- });
-
- var groups = response.data.data.advices;
- var childMap = {};
- for (const index in groups) {
- if (groups[index].parent_id == 0) {
- continue;
- }
- if (groups[index].parent_id in childMap === false) {
- childMap[groups[index].parent_id] = [];
- }
- childMap[groups[index].parent_id].push(groups[index]);
- }
- var parentArr = [];
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- parentArr.push(groups[index]);
- }
-
- var groupNo = groups[0].groupno;
- var newData = { groupNo: parentArr };
- for (const index in this.adviceTableData) {
- if (this.adviceTableData[index].groupno == groupNo) {
- for (const i in parentArr) {
- if (parentArr[i].id in childMap) {
- for (const j in childMap[parentArr[i].id]) {
- this.adviceTableData.splice(
- index,
- 0,
- childMap[parentArr[i].id][j]
- );
- }
- }
- this.adviceTableData.splice(index, 0, parentArr[i]);
- }
- break;
- }
- }
-
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- this.editRowKey++;
- var item = {
- advice_name: groups[index].advice_name,
- advice_desc: groups[index].advice_desc,
- single_dose: "" + groups[index].single_dose,
- single_dose_unit: groups[index].single_dose_unit,
- drug_spec: "" + groups[index].drug_spec,
- drug_spec_unit: groups[index].drug_spec_unit,
- prescribing_number: "" + groups[index].prescribing_number,
- prescribing_number_unit: groups[index].prescribing_number_unit,
- delivery_way: groups[index].delivery_way,
- execution_frequency: groups[index].execution_frequency,
- drug_name_id: groups[index].drug_name_id,
- drug_id:groups[index].drug_id,
- way:groups[index].way,
- isEdit: 0,
- index: 0,
- id: groups[index].id,
- children: [],
- parent_row: 0,
- row_key: this.editRowKey
- };
- if (item.id in childMap) {
- for (const key in childMap[item.id]) {
- this.editRowKey++;
- var child = {
- advice_name: childMap[item.id][key].advice_name,
- advice_desc: childMap[item.id][key].advice_desc,
- single_dose: "" + childMap[item.id][key].single_dose,
- single_dose_unit: childMap[item.id][key].single_dose_unit,
- drug_spec: "" + childMap[item.id][key].drug_spec,
- drug_spec_unit: childMap[item.id][key].drug_spec_unit,
- prescribing_number:
- "" + childMap[item.id][key].prescribing_number,
- prescribing_number_unit:
- childMap[item.id][key].prescribing_number_unit,
- delivery_way: childMap[item.id][key].delivery_way,
- execution_frequency:childMap[item.id][key].execution_frequency,
- way:childMap[item.id][key].way,
- drug_name_id:childMap[item.id][key].drug_name_id,
- drug_id:childMap[item.id][key].drug_id,
- isEdit: 0,
- index: 0,
- id: childMap[item.id][key].id,
- children: [],
- parent_row: item.row_key,
- row_key: this.editRowKey
- };
- item.children.push(child);
- }
- this.$set(item, "children", item.children);
- }
- this.groupForm.adviceNames.unshift(item);
- }
- return false;
- }
- });
- this.templateFormVisible = false;
- },
- addTempForm(formName) {
- var _this = this;
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (_this.templateForm.id in _this.adviceTemplateMaps) {
- _this.submitGroupForm = {
- advice_type: _this.groupForm.advice_type,
- advice_date: _this.groupForm.advice_date,
- start_time: _this.groupForm.start_time,
- adviceNames: [],
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: 0
- };
- var mapid = _this.templateForm.id;
- for (const index in _this.adviceTemplateMaps[mapid]
- .DoctorAdviceTemplate) {
- _this.editRowKey++;
- var item = {
- advice_name:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .advice_name,
- advice_desc:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .advice_desc,
- single_dose:
- "" +
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .single_dose,
- single_dose_unit:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .single_dose_unit,
- drug_spec:
- "" +
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .drug_spec,
- drug_spec_unit:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .drug_spec_unit,
- prescribing_number:
- "" +
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .prescribing_number,
- prescribing_number_unit:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .prescribing_number_unit,
- delivery_way:
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .delivery_way,
- execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
- drug_name_id: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
- drug_id: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
- way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0,
- row_key: _this.editRowKey
- };
- if (
- "children" in
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .children
- ) {
- var parentRow = _this.editRowKey;
- var children =
- _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
- .children;
- for (const key in children) {
- _this.editRowKey++;
- var child = {
- advice_name: children[key].advice_name,
- advice_desc: children[key].advice_desc,
- single_dose: "" + children[key].single_dose,
- single_dose_unit: children[key].single_dose_unit,
- drug_spec: "" + children[key].drug_spec,
- drug_spec_unit: children[key].drug_spec_unit,
- prescribing_number: "" + children[key].prescribing_number,
- prescribing_number_unit:
- children[key].prescribing_number_unit,
- delivery_way: children[key].delivery_way,
- execution_frequency: children[key].execution_frequency,
- drug_name_id: children[key].drug_name_id,
- drug_id: children[key].drug_id,
- way:children[key].way,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: _this.editRowKey
- };
- item.children.push(child);
- }
- _this.$set(item, "children", item.children);
- }
-
- _this.submitGroupForm.adviceNames.push(item);
- }
- let mode = "1";
-
- CreateGroupAdvice(
- _this.patientID,
- _this.groupForm.groupno,
- _this.submitGroupForm,
- mode
- ).then(response => {
- if (response.data.state == 0) {
- _this.$message.error(response.data.msg);
- return false;
- } else {
- _this.$notify({
- title: "成功",
- message: "新增成功",
- type: "success",
- duration: 2000
- });
-
- // var alen = response.data.data.advices.length
- // for (let index = alen-1; index >=0; index--) {
- // this.adviceTableData.unshift(response.data.data.advices[index]);
- // }
-
- var groups = response.data.data.advices;
- var childMap = {};
- for (const index in groups) {
- if (groups[index].parent_id == 0) {
- continue;
- }
- if (groups[index].parent_id in childMap === false) {
- childMap[groups[index].parent_id] = [];
- }
- childMap[groups[index].parent_id].push(groups[index]);
- }
- var parentArr = [];
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- parentArr.push(groups[index]);
- }
-
- var groupNo = groups[0].groupno;
- var newData = { groupNo: parentArr };
- for (const index in _this.adviceTableData) {
- if (_this.adviceTableData[index].groupno == groupNo) {
- for (const i in parentArr) {
- if (parentArr[i].id in childMap) {
- for (const j in childMap[parentArr[i].id]) {
- _this.adviceTableData.splice(
- index,
- 0,
- childMap[parentArr[i].id][j]
- );
- }
- }
- _this.adviceTableData.splice(index, 0, parentArr[i]);
- }
- break;
- }
- }
-
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- _this.editRowKey++;
- var item = {
- advice_name: groups[index].advice_name,
- advice_desc: groups[index].advice_desc,
- single_dose: "" + groups[index].single_dose,
- single_dose_unit: groups[index].single_dose_unit,
- drug_spec: "" + groups[index].drug_spec,
- drug_spec_unit: groups[index].drug_spec_unit,
- prescribing_number: "" + groups[index].prescribing_number,
- prescribing_number_unit:
- groups[index].prescribing_number_unit,
- delivery_way: groups[index].delivery_way,
- execution_frequency: groups[index].execution_frequency,
- drug_name_id:groups[index].drug_name_id,
- drug_id:groups[index].drug_id,
- way:groups[index].way,
- isEdit: 0,
- index: 0,
- id: groups[index].id,
- children: [],
- parent_row: 0,
- row_key: _this.editRowKey
- };
- if (item.id in childMap) {
- for (const key in childMap[item.id]) {
- _this.editRowKey++;
- var child = {
- advice_name: childMap[item.id][key].advice_name,
- advice_desc: childMap[item.id][key].advice_desc,
- single_dose: "" + childMap[item.id][key].single_dose,
- single_dose_unit:
- childMap[item.id][key].single_dose_unit,
- drug_spec: "" + childMap[item.id][key].drug_spec,
- drug_spec_unit: childMap[item.id][key].drug_spec_unit,
- prescribing_number:
- "" + childMap[item.id][key].prescribing_number,
- prescribing_number_unit:
- childMap[item.id][key].prescribing_number_unit,
- delivery_way: childMap[item.id][key].delivery_way,
- execution_frequency:childMap[item.id][key].execution_frequency,
- drug_name_id:childMap[item.id][key].drug_name_id,
- drug_id:childMap[item.id][key].drug_id,
- way:childMap[item.id][key].way,
- isEdit: 0,
- index: 0,
- id: childMap[item.id][key].id,
- children: [],
- parent_row: item.row_key,
- row_key: _this.editRowKey
- };
- item.children.push(child);
- }
- _this.$set(item, "children", item.children);
- }
- _this.groupForm.adviceNames.unshift(item);
- }
-
- _this.resetForm(formName);
- return false;
- }
- });
- }
- _this.templateFormVisible = false;
- }
- });
- },
- openAdviceTemplate() {
- this.templateForm = { id: "" };
- this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
- this.selectedTemplate = [];
- if (typeof this.$refs.templatetable !== "undefined") {
- this.$refs.templatetable.setCurrentRow(null);
- }
- this.templateFormVisible = true;
- },
- selectGroupAdvice(row) {
- console.log('row',row)
- this.groupSelectRow = row;
- },
- groupClassName({ row, rowIndex }) {
- row.index = rowIndex;
- },
- getRowKey(row) {
- return row.row_key;
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- open(groupNo) {
- this.groupEditFormVisible = true;
- this.groupSelectRow = null;
- if (typeof this.$refs.advicenametable !== "undefined") {
- this.$refs.advicenametable.setCurrentRow(null);
- }
- // groupNo
- this.editRowKey = 0;
- var groups = [];
- for (const index in this.adviceTableData) {
- if (groupNo == this.adviceTableData[index].groupno) {
- groups.push(this.adviceTableData[index]);
- }
- }
- if (groups.length == 0) {
- return false;
- }
-
- console.log(groups[0].advice_doctor);
- this.adminusername = this.getXuserName(groups[0].advice_doctor);
- this.groupForm = {
- advice_type: groups[0].advice_type,
- advice_date: uParseTime(groups[0].advice_date, "{y}-{m}-{d}"),
- start_time: uParseTime(groups[0].start_time, "{y}-{m}-{d} {h}:{i}"),
- adviceNames: [],
- advice_doctor: "",
- remark: groups[0].remark,
- groupno: groupNo
- };
-
- var childMap = {};
- for (const index in groups) {
- if (groups[index].parent_id == 0) {
- continue;
- }
- if (groups[index].parent_id in childMap === false) {
- childMap[groups[index].parent_id] = [];
- }
- childMap[groups[index].parent_id].push(groups[index]);
- }
-
- for (const index in groups) {
- if (groups[index].parent_id > 0) {
- continue;
- }
- this.editRowKey++;
- var item = {
- advice_doctor: groups[index].advice_doctor,
- advice_name: groups[index].advice_name,
- advice_desc: groups[index].advice_desc,
- single_dose: "" + groups[index].single_dose,
- single_dose_unit: groups[index].single_dose_unit,
- drug_spec: "" + groups[index].drug_spec,
- drug_spec_unit: groups[index].drug_spec_unit,
- prescribing_number: "" + groups[index].prescribing_number,
- prescribing_number_unit: groups[index].prescribing_number_unit,
- delivery_way: groups[index].delivery_way,
- execution_frequency: groups[index].execution_frequency,
- drug_name_id:groups[index].drug_name_id,
- drug_id:groups[index].drug_id,
- way:groups[index].way,
- isEdit: 0,
- index: 0,
- id: groups[index].id,
- children: [],
- parent_row: 0,
- row_key: this.editRowKey
- };
- if (item.id in childMap) {
- for (const key in childMap[item.id]) {
- this.editRowKey++;
- var child = {
- advice_doctor: childMap[item.id][key].advice_doctor,
- advice_name: childMap[item.id][key].advice_name,
- advice_desc: childMap[item.id][key].advice_desc,
- single_dose: "" + childMap[item.id][key].single_dose,
- single_dose_unit: childMap[item.id][key].single_dose_unit,
- drug_spec: "" + childMap[item.id][key].drug_spec,
- drug_spec_unit: childMap[item.id][key].drug_spec_unit,
- prescribing_number:
- "" + childMap[item.id][key].prescribing_number,
- prescribing_number_unit:
- childMap[item.id][key].prescribing_number_unit,
- delivery_way: childMap[item.id][key].delivery_way,
- execution_frequency: childMap[item.id][key].execution_frequency,
- drug_name_id: childMap[item.id][key].drug_name_id,
- drug_id: childMap[item.id][key].drug_id,
- way: childMap[item.id][key].way,
- isEdit: 0,
- index: 0,
- id: childMap[item.id][key].id,
- children: [],
- parent_row: item.row_key,
- row_key: this.editRowKey
- };
- item.children.push(child);
- }
- this.$set(item, "children", item.children);
- }
- this.groupForm.adviceNames.push(item);
- }
- },
- SaveEditAdvices() {
- console.log("aaa")
- const params = {
- start_time: this.groupForm.start_time,
- groupno: this.groupForm.groupno,
- date: this.$route.query.date,
- patient_id: this.$route.query.patient_id
- };
- console.log("params", params);
- SaveEditAdvices(params).then(response => {
- if (response.data.state == 1) {
- var advice = response.data.data.advice;
- this.$message.success("保存成功!");
- this.groupEditFormVisible = false;
- this.$parent.getDialysisScheduleDetail()
- }
- });
- },
- getSelfMedicalList(){
- const params = {
- patient_id:this.$route.query.patient_id
- }
- getSelfMedicalList(params).then(response=>{
- if (response.data.state == 1) {
- this.arr_drug = []
- var medicalList = response.data.data.private_drug_list
- var base_drug_list = response.data.data.base_drug_list
- var base_drug_cofig = response.data.data.base_drug_config
- var private_drug_cofig = response.data.data.private_drug_config
-
-
- if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
-
- for (let i = 0; i < medicalList.length; i++) {
- if(medicalList[i].drug_specs != null) {
- for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
- medicalList[i].drug_specs[a]['type'] = 2
- }
- }
- let obj = {
- drug_name: "",
- drug_desc: "",
- delivery_way: "",
- execution_frequency: "",
- single_dose: "",
- single_dose_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- type_id: "",
- type: "",
- custom_id: "",
- drug_specs: [],
- }
-
- medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
- obj.drug_name = medicalList[i].drug_name
- obj.delivery_way = medicalList[i].delivery_way
- obj.execution_frequency = medicalList[i].execution_frequency
- obj.single_dose = medicalList[i].single_dose
- obj.prescribing_number = medicalList[i].prescribing_number
- obj.type_id = medicalList[i].id
- obj.type = 2
- obj.custom_id = this.rand(10000000, 99999999)
- obj.drug_specs = medicalList[i].drug_specs
- this.all_drug.push(obj)
- }
- }
-
-
- for (let i = 0; i < base_drug_list.length; i++) {
- if(base_drug_list[i].drug_specs != null) {
- for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
- base_drug_list[i].drug_specs[a]['type'] = 1
- }
- }
- let obj = {
- drug_name: "",
- drug_desc: "",
- delivery_way: "",
- execution_frequency: "",
- single_dose: "",
- single_dose_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- type_id: "",
- type: "",
- custom_id: "",
- drug_specs: [],
- }
-
- obj.drug_name = base_drug_list[i].drug_name
- obj.delivery_way = base_drug_list[i].delivery_way
- obj.execution_frequency = base_drug_list[i].execution_frequency
- obj.single_dose = base_drug_list[i].single_dose
- obj.prescribing_number = base_drug_list[i].prescribing_number
- obj.type_id = base_drug_list[i].id
- obj.type = 1
- obj.custom_id = this.rand(10000000, 99999999)
- obj.drug_specs = base_drug_list[i].drug_specs
- this.all_drug.push(obj)
- }
- }
- })
-
- },
- changeDrugName(name){
- this.current_drug_name = name
- this.nameForm.advice_desc = ''
- this.drugSpec = []
- for (let i = 0; i < this.all_drug.length; i++) {
- if (this.all_drug[i].drug_name == name) {
- this.drugSpec = this.all_drug[i].drug_specs
- }
- }
- },
- changeDrugDesc(name) {
- this.current_drug_spec = name
- for (let i = 0; i < this.drugSpec.length; i++) {
- if (this.drugSpec[i].drug_spec == name) {
- this.nameForm.advice_desc = this.drugSpec[i].drug_spec
- this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
- this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
- this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
- this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
- this.drug_id = this.drugSpec[i].id
- this.src_type = this.drugSpec[i].type
- this.nameForm.drug_id = this.drugSpec[i].id
- this.nameForm.way = this.drugSpec[i].type
- this.drug_name_id = this.drugSpec[i].drug_name_id
- this.nameForm.drug_name_id = this.drugSpec[i].drug_name_id
- }
- }
- },
- rand(min, max) {
- return Math.floor(Math.random() * (max - min)) + min;
- },
- querySearch(queryString, cb) {
-
- var restaurants = this.all_drug;
- restaurants.map(item => {
- item.value = item.drug_name
- })
- var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
- // 调用 callback 返回建议列表的数据
-
- cb(results);
- },
-
- createFilter(queryString) {
- return (restaurant) => {
- return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
- };
- },
-
- querySearch1(queryString, cb) {
- console.log('queryString',queryString)
- var restaurants = this.drugSpec;
- console.log(restaurants)
- restaurants.map(item => {
- item.value = item.drug_spec
- })
- var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
- // 调用 callback 返回建议列表的数据
- console.log('results',results)
- cb(results);
- },
- getDataConfig(module, filed_name) {
- return getDataConfig(module, filed_name)
- },
- getUnit(id){
- var name = ""
- for(let i=0;i<this.units.length;i++){
- if(id == this.units[i].id){
- name = this.units[i].name
- }
- }
- return name
- }
- },
- watch: {
- "selectedTemp.list": function() {
- this.calcselectedTemp();
- }
- },
- created(){
- this.units = this.getDataConfig('hemodialysis','units')
- console.log("32322323232我的",this.units)
- //获取自备药
- this.getSelfMedicalList()
- }
- };
- </script>
-
- <style>
- #user-edit-advice-name-table .el-table__row {
- display: table-row !important;
- }
-
- #user-edit-advice-name-table .el-table__expand-icon {
- -webkit-transform: rotate(90deg) !important;
- transform: rotate(90deg) !important;
- }
-
- #dialysis-update-select-template-table .el-table__row {
- display: table-row !important;
- }
-
- #dialysis-update-select-template-table .el-table__expand-icon {
- -webkit-transform: rotate(90deg) !important;
- transform: rotate(90deg) !important;
- }
- </style>
|