12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856 |
- <template>
- <div id="user-edit-group-advice">
- <el-dialog
- title="新增医嘱"
- :visible.sync="groupAddFormVisible"
- 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"
- style="width:100%;"
- >
- <el-date-picker
- type="datetime"
- format="yyyy-MM-dd HH:mm"
- value-format="yyyy-MM-dd HH:mm"
- placeholder="选择时间"
- v-model="groupForm.start_time"
- style="width:100%;"
- ></el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
-
- <el-form-item label="备注 :">
- <el-input type="textarea" v-model="groupForm.remark"></el-input>
- </el-form-item>
-
- <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
- highlight-current-row
- :row-class-name="groupClassName"
- @current-change="selectGroupAdvice"
- style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
- :row-key="getRowKey"
- ref="advicenametable"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- >
- <el-table-column
- label="医嘱名称"
- property="advice_name"
- style="word-break: keep-all;white-space:nowrap;"
- align="center"
- ></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="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
- vf-i="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">
- <!-- //从1到20-->
- <span v-if="scope.row.single_dose != 0" @click="lili(scope.row)">
- {{ 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>
- <!-- <span v-if="scope.row.single_dose_unit == 1" >{{ scope.row.single_dose}}g</span>
- <span v-else-if="scope.row.single_dose_unit == 2" >{{ scope.row.single_dose}}mg</span>
- <span v-else-if="scope.row.single_dose_unit == 3" >{{ scope.row.single_dose}}u</span>
- <span v-else-if="scope.row.single_dose_unit == 4" >{{ scope.row.single_dose}}ml</span>
- <span v-else-if="scope.row.single_dose_unit == 5" >{{ scope.row.single_dose}}万U</span>
- <span v-else-if="scope.row.single_dose_unit == 6" >{{ scope.row.single_dose}}枚</span>
- <span v-else-if="scope.row.single_dose_unit == 7" >{{ scope.row.single_dose}}粒</span>
- <span v-else-if="scope.row.single_dose_unit == 8" >{{ scope.row.single_dose}}片</span>
- <span v-else-if="scope.row.single_dose_unit == 9" >{{ scope.row.single_dose}}支</span>
- <span v-else-if="scope.row.single_dose_unit == 10" >{{ scope.row.single_dose}}ug</span>
- <span v-else-if="scope.row.single_dose_unit == 11" >{{ scope.row.single_dose}}iu</span>
- <span v-else-if="scope.row.single_dose_unit == 12" >{{ scope.row.single_dose}}包</span>
- <span v-else-if="scope.row.single_dose_unit == 13" >{{ scope.row.single_dose}}袋</span>
- <span v-else-if="scope.row.single_dose_unit == 14" >{{ scope.row.single_dose}}万</span>
- <span v-else-if="scope.row.single_dose_unit == 15" >{{ scope.row.single_dose}}万iu</span>
- <span v-else-if="scope.row.single_dose_unit == 16" >{{ scope.row.single_dose}}丸</span>
- <span v-else-if="scope.row.single_dose_unit == 17" >{{ scope.row.single_dose}}盒</span>
- <span v-else-if="scope.row.single_dose_unit == 18" >{{ scope.row.single_dose}}瓶</span>
- <span v-else-if="scope.row.single_dose_unit == 19" >{{ scope.row.single_dose}}瓶(袋)</span>
- <span v-else-if="scope.row.single_dose_unit == 20" >{{ scope.row.single_dose}}次</span>
- <span v-else >{{ scope.row.single_dose}}{{ scope.row.single_dose_unit }}</span> -->
- </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>
- <div slot="footer" class="dialog-footer">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ||
- groupForm.adviceNames.length == 0
- ? true
- : false
- "
- type="primary"
- @click="submitgroupAdvice('groupForm')"
- >保 存
- </el-button><!--bug2-->
- </div>
- </el-dialog>
-
- <el-dialog
- title="选择医嘱模板"
- :close-on-click-modal="false"
- :visible.sync="templateFormVisible"
- width="72%"
- >
- <el-row :gutter="20">
- <el-col :span="8">
- <el-table
- :data="adviceTemplates"
- ref="templatetable"
- border
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- highlight-current-row
- @current-change="templateTableChange"
- 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-add-select-template-table"
- :data="selectedTemp.list"
- border
- :span-method="spanselecttable"
- @select="selectAdvice"
- @select-all="selectAllTemplateAdvice"
- @selection-change="changeAdvice"
- row-key="row_key"
- ref="selecttemplatetable"
- style="width: 100%"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- >
- <el-table-column type="selection" align="center" width="55">
- </el-table-column>
- <el-table-column
- label="医嘱内容"
- property="advice_name"
- style="word-break: keep-all;white-space:nowrap;"
- align="center"
- ></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><!--bug1-->
- </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="854px"
- >
- <el-form
- ref="nameForm"
- :rules="nameRules"
- :model="nameForm"
- label-width="90px"
- >
- <el-row>
- <el-col :span="24">
- <el-form-item label="医嘱内容 :" required prop="advice_name"><!--第一处-->
- <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>
- <!-- <div style="margin-left:120px;margin-top:-20px;font-size:12px;color:red">
- 库存不足50
- </div> -->
-
- </el-col>
-
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="药品规格 :" prop="advice_desc">
- <el-col :span="8">
- <el-autocomplete
- style="width:100px;"
- class="inline-input"
- v-model="nameForm.advice_desc"
- :fetch-suggestions="querySearch1"
- placeholder="请输入内容"
- @select="handleSelect1"
- @input="changeDrugDesc"
- ></el-autocomplete>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="14">
- <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-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-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-row>
- <el-row>
-
- <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-row>-->
- <!--<el-col :span="12">-->
- <!--<el-form-item label="医嘱嘱托 :" prop="delivery_way">-->
- <!--<el-input v-model="nameForm.remark"></el-input>-->
- <!--</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
- } from "@/api/advice";
- import { getDataConfig } from '@/utils/data'
- import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
- import { duration } from 'moment';
- export default {
- name: "AddGroupAdvice",
- data() {
- return {
- editRowKey: 0,
- oldTemplateFormVisible: false,
- templateFormVisible: false,
- groupAddFormVisible: false,
- nameFormVisible: false,
- groupSelectRow: null,
- nameFormTitle: "",
- isChild: false,
- isEdit: false,
- adminusername: "",
- 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: "",
- remark: "",
- isEdit: 0,
- index: 0,
- id: 0,
- children: [],
- drug_id:0,
- way:0,
- drug_name_id:0,
- },
- submitGroupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0
- },
- groupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0,
- drug_id:"",
- way:"",
- drug_name_id:0,
- },
- selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
- selectedTemplate: [],
- allSelectedTemplate: [],
- medicals:[],
- drugSpec:[],
- all_drug:[],
- current_drug_name:"",
- current_drug_spec: "",
- drug_id: 0,
- drug_name_id:"",
- src_type:"",
- private_drug_config:{},
- units:[],
- };
- },
- props: {
- patientID: 0,
- adviceType: 0,
- rowKey: 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 [];
- }
- },
- predialysis: {
- type: Object,
- default: () => {
- return { id: 0 }
- }
- },
- schedulePatient:{
- type: Object,
- default: () => {
- return { id: 0 }
- }
- }
- },
- methods: {
- lili(val){
- console.log("=3=val=3=",val)
- },
- submitgroupAdvice(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- var submitForm = {
- advice_type: this.groupForm.advice_type,
- advice_date: this.groupForm.advice_date,
- start_time: this.groupForm.start_time,
- adviceNames: [],
- advice_doctor: this.groupForm.advice_doctor,
- remark: this.groupForm.remark,
- parent_id: this.groupForm.parent_id,
- id:this.groupForm.id,
-
- };
- var adviceNames = [];
- for (const index in this.groupForm.adviceNames) {
- adviceNames.unshift(this.groupForm.adviceNames[index]);
- }
- for(let i=0;i<adviceNames.length;i++){
- adviceNames[i].template_id = "888888888"
- }
- submitForm.adviceNames = adviceNames;
- let mode = "1";
-
- if(this.private_drug_config != null&& this.private_drug_config.drug_start == 1){
-
- for(let index=0;index<submitForm.adviceNames.length;index++){
- for(let i=0;i<this.medicals.length;i++){
- if(submitForm.adviceNames[index].children.length >0){
- for(let y=0;y<submitForm.adviceNames[index].children.length;y++){
- if(submitForm.adviceNames[index].children[y].drug_id == this.medicals[i].drug_name_id){
- submitForm.adviceNames[index].children[y].drug_name_id = this.medicals[i].drug_name_id
- submitForm.adviceNames[index].children[y].way = 2
- }
- }
- }
- if(submitForm.adviceNames[index].children.length == 0){
- if(submitForm.adviceNames[index].drug_id == this.medicals[i].drug_name_id){
- submitForm.adviceNames[index].way = 2
- submitForm.adviceNames[index].drug_name_id = this.medicals[i].drug_name_id
- }
- }
-
- }
- }
- }
-
- CreateGroupAdvice(this.patientID, 0, 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 childMap = {};
- for (const index in response.data.data.advices) {
- if (response.data.data.advices[index].parent_id == 0) {
- continue;
- }
- if (
- response.data.data.advices[index].parent_id in childMap ===
- false
- ) {
- childMap[response.data.data.advices[index].parent_id] = [];
- }
- childMap[response.data.data.advices[index].parent_id].unshift(
- response.data.data.advices[index]
- );
- }
- var parentArr = [];
- for (const index in response.data.data.advices) {
- if (response.data.data.advices[index].parent_id > 0) {
- continue;
- }
- parentArr.push(response.data.data.advices[index]);
- }
-
- for (const index in parentArr) {
- if (parentArr[index].id in childMap) {
- for (const j in childMap[parentArr[index].id]) {
- this.adviceTableData.unshift(
- childMap[parentArr[index].id][j]
- );
- }
- }
- this.adviceTableData.unshift(parentArr[index]);
- }
-
- // var alen = response.data.data.advices.length
- // for (let index = alen-1; index >=0; index--) {
- // this.adviceTableData.unshift(response.data.data.advices[index]);
- // }
-
- this.resetForm(formName);
- this.groupAddFormVisible = false;
- this.$parent.getDialysisScheduleDetail()
- return false;
- }
- }
- );
- }
- });
- },
-
- openDeleteGroupAdvice() {
- if (this.groupSelectRow === null) {
- this.$message.error("未选择要删除的医嘱内容");
-
- return;
- }
- 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(() => {
- 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;
- }
- }
- }
- })
- .catch(() => {});
- },
- submitNameForm(formName) {
- console.log("forname",this.nameForm)
- if(this.src_type == ""){
- this.nameForm.way = 1
- this.nameForm.drug_id = this.drug_id
- 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 ale = _this.groupForm.adviceNames.length;
- 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].remark =_this.nameForm.remark;
- // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
- // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
- // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
- _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].remark =_this.nameForm.remark;
- // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
- // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
- // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
- _this.$set(
- _this.groupForm.adviceNames,
- index,
- _this.groupForm.adviceNames[index]
- );
- break;
- }
- }
- }
- } else {
- if (_this.isChild) {
- _this.editRowKey++;
- _this.nameForm.row_key = _this.editRowKey;
-
- 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.groupForm.adviceNames[index].children.push(_this.nameForm);
- _this.$set(_this.groupForm.adviceNames,index,_this.groupForm.adviceNames[index]);
- break;
- }
- }
- } else {
- _this.editRowKey++;
- _this.nameForm.row_key = _this.editRowKey;
- _this.groupForm.adviceNames.push(_this.nameForm);
- }
- }
- _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,
- remark: "",
- isEdit: 0,
- index: 0,
- children: [],
- parent_row: this.groupSelectRow.row_key,
- id: 0
- };
- this.isChild = true;
- this.nameFormVisible = true;
- this.nameFormTitle = "添加子药内容";
- },
- openGroupAdvice(isEdit) {
- console.log("hhhahhdhahdhahddhhdhdhh",this.groupSelectRow)
- 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,
- isEdit: 1,
- index: this.groupSelectRow.index,
- id: this.groupSelectRow.id,
- children: [],
- parent_row: this.groupSelectRow.parent_row,
- remark: this.groupSelectRow.remark,
- drug_name_id:this.groupSelectRow.drug_name_id,
- drug_id:this.groupSelectRow.drug_id,
- way:this.groupSelectRow.way
- // row_key:this.groupSelectRow.row_key,
- };
- this.nameFormTitle = "修改医嘱内容";
- } 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: "",
- isEdit: 0,
- index: 0,
- id: 0,
- remark: "",
- children: [],
- parent_row: 0
- };
- this.nameFormTitle = "新增医嘱内容";
- }
- this.nameFormVisible = true;
- },
-
- changeAdvice(selection) {
- this.selectedTemplate = selection;
- },
- selectAdvice(selection, row) {
-
- 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;
- }
- }
- }
- }
-
-
- 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]
- );
- }
- }
- }
- },
- 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,
- selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].selection,
- advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].id,
- drug_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
- way:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
- drug_name_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
- 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_id:children[key].drug_id,
- way:children[key].way,
- drug_name_id:children[key].drug_name_id,
- 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,
- advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
- selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
- drug_id: adviceTemplate.DoctorAdviceTemplate[index].drug_id,
- way:adviceTemplate.DoctorAdviceTemplate[index].way,
- drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0,
- row_key: thisRowKey
- };
- console.log("items========",item)
- 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_id:children[key].drug_id,
- way:children[key].way,
- drug_name_id:children[key].drug_name_id,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: thisRowKey
- };
- console.log("child",child)
- 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]
- );
- }
- }
-
- 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_id:this.allSelectedTemplate[index].drug_id,
- way:this.allSelectedTemplate[index].way,
- drug_name_id:this.allSelectedTemplate[index].drug_name_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_id:children[key].drug_id,
- way:children[key].way,
- drug_name_id:children[key].drug_name_id,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: this.editRowKey
- };
- item.children.push(child);
- }
- this.$set(item, "children", item.children);
- }
- }
- console.log(this.groupForm.adviceNames)
- this.groupForm.adviceNames.push(item);
- }
- this.templateFormVisible = false;
- },
- addTempForm(formName) {
- var _this = this;
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (_this.templateForm.id in _this.adviceTemplateMaps) {
- 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,
- 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,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: parentRow,
- row_key: this.editRowKey
- };
- item.children.push(child);
- }
- _this.$set(item, "children", item.children);
- }
-
- _this.groupForm.adviceNames.unshift(item);
- }
- }
- _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) {
- this.groupSelectRow = row;
- },
- groupClassName({ row, rowIndex }) {
- row.index = rowIndex;
- },
- getRowKey(row) {
- return row.row_key;
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- open() {
- this.groupAddFormVisible = true;
- this.groupSelectRow = null;
- if (typeof this.$refs.advicenametable !== "undefined") {
- this.$refs.advicenametable.setCurrentRow(null);
- }
- this.editRowKey = 0;
- this.groupForm = {
- advice_type: 2,
- advice_date: this.recordDate,
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0
- };
- var xtuser = this.$store.getters.xt_user;
- // this.orgname = xtuser.org.org_name;
- this.adminusername = xtuser.user.user_name;
- if(this.$store.getters.xt_user.org.id == 10101){
- if (this.predialysis.id > 0 && this.predialysis.created_time > 0) {
- var date = new Date(this.predialysis.created_time * 1000)
- var year = date.getFullYear()
- var month = date.getMonth() + 1
- var day = date.getDate()
-
- var hours = date.getHours()
- var minites = date.getMinutes()
-
- if (month < 10) {
- month = '0' + month
- }
- if (day < 10) {
- day = '0' + day
- }
- if (hours < 10) {
- hours = '0' + hours
- }
- if (minites < 10) {
- minites = '0' + minites
- }
-
- this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + hours + ':' + minites
- } else {
- var date = new Date()
- var year = date.getFullYear()
- var month = date.getMonth() + 1
- var day = date.getDate()
-
- var hours = date.getHours()
- var minites = date.getMinutes()
-
- if (month < 10) {
- month = '0' + month
- }
- if (day < 10) {
- day = '0' + day
- }
- if (hours < 10) {
- hours = '0' + hours
- }
- if (minites < 10) {
- minites = '0' + minites
- }
- this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + hours + ':' + minites
- }
- }
-
- if( this.$store.getters.xt_user.org.id == 0 || this.$store.getters.xt_user.org.id == 9671 || this.$store.getters.xt_user.org.id == 9675 || this.$store.getters.xt_user.org.id == 10340 || this.$store.getters.xt_user.org.id == 10447){
- var date = new Date()
- var year = date.getFullYear()
- var month = date.getMonth() + 1
- var day = date.getDate()
-
- var hours = date.getHours()
- var minites = date.getMinutes()
-
- if (month < 10) {
- month = '0' + month
- }
- if (day < 10) {
- day = '0' + day
- }
- if (hours < 10) {
- hours = '0' + hours
- }
- if (minites < 10) {
- minites = '0' + minites
- }
- if (this.schedulePatient.schedule_type == 1) {
- this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + '07:00'
- } else if (this.schedulePatient.schedule_type == 2) {
- this.groupForm.start_time= year + '-' + month + '-' + day + ' ' + '11:00'
- } else if (this.schedulePatient.schedule_type == 3) {
- this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + '18:00'
- }
- }
-
- },
- selectAllTemplateAdvice(selection) {
- console.log("params",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;
- }
- }
- }
- }
- },
- 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;
- }
- }
- },
- rand(min, max) {
- return Math.floor(Math.random() * (max - min)) + min;
- },
- //
- 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
- console.log("medicallist",medicalList)
- var base_drug_list = response.data.data.base_drug_list
- console.log("base_drug_list23233232322323",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
- obj.id = medicalList[i].id
- 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
- obj.id = base_drug_list[i].id
- this.all_drug.push(obj)
-
- }
-
- this.private_drug_config = response.data.data.private_drug_config
- this.medicals = medicalList
- }
-
- })
-
- },
- 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.nameForm.single_dose_unit = this.drugSpec[i].min_unit
- this.nameForm.drug_spec_unit = this.drugSpec[i].min_unit
- this.nameForm.prescribing_number_unit = this.drugSpec[i].min_unit
- if(this.drugSpec[i].drug_name_id){
- this.nameForm.drug_name_id = this.drugSpec[i].drug_name_id
- }else{
- this.nameForm.drug_name_id = 0
- }
-
- }
- }
- },
-
- querySearch(queryString, cb) {
- console.log("aaaaa")
- 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) {
-
- 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 返回建议列表的数据
-
- cb(results);
- },
-
- handleSelect(val){
- console.log("22222",val)
- this.drug_id = val.id
- this.nameForm.way = 1
- var tmp = val.drug_specs[0]
- console.log("tmp",tmp)
- console.log("unitsOption",this.unitsOption)
- 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
- },
- handleSelect1(){
-
- },
- 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-add-select-template-table .el-table__row {
- display: table-row !important;
- }
-
- #dialysis-add-select-template-table .el-table__expand-icon {
- -webkit-transform: rotate(90deg) !important;
- transform: rotate(90deg) !important;
- }
- </style>
|