123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574 |
- <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="医嘱类型 :">
- <el-select
- v-model="groupForm.advice_type"
- placeholder="请选择"
- disabled
- >
- <el-option
- :label="item.label"
- :key="item.value"
- :value="item.value"
- v-for="item in adviceTypeOptions"
- ></el-option>
- </el-select>
- </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>{{ groupForm.advice_doctor }} </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 style="margin-bottom: 20px">
- <el-col :span="2"> </el-col>
- <el-col :span="5">
- <el-button
- :disabled="
- $store.getters.xt_user.subscibe.state == 3 ? true : false
- "
- @click="openAdviceTemplate()"
- round
- >选择医嘱模板
- </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="openDeleteGroupAdvice()"
- >删除医嘱内容
- </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-row>
- <el-row>
- <el-col :span="24">
- <el-table
- id="user-edit-advice-name-table"
- :data="groupForm.adviceNames"
- border
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- fit
- highlight-current-row
- :row-class-name="groupClassName"
- @current-change="selectGroupAdvice"
- style="width: 100%"
- :row-key="getRowKey"
- ref="advicenametable"
- type="expand"
- default-expand-all
- >
- <el-table-column
- label="医嘱内容"
- property="advice_name"
- style="word-break: keep-all;white-space:nowrap;"
- ></el-table-column>
- <el-table-column label="药品规格" property="advice_desc">
- <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-column
- label="提醒频率"
- min-width="80"
- property="execution_frequency"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.frequency_type == 1">每次必推</span>
- <span v-if="scope.row.frequency_type == 2"
- >{{ scope.row.day_count }}天/1次</span
- >
- <span v-if="scope.row.frequency_type == 3"
- >每周{{ scope.row.week_day }}</span
- >
- </template>
- </el-table-column>
-
- <el-table-column
- label="推送截止日期"
- min-width="80"
- property="execution_frequency"
- align="center"
- >
- <template slot-scope="scope">
- {{scope.row.push_start_time}}
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-row>
- </el-form>
- </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
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- highlight-current-row
- @current-change="templateTableChange"
- style="width: 100%"
- >
- <el-table-column prop="name" 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"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
- >
- <el-table-column type="selection" width="55"></el-table-column>
- <el-table-column
- label="医嘱内容"
- property="advice_name"
- style="word-break: keep-all;white-space:nowrap;"
- ></el-table-column>
- <el-table-column label="药品规格" property="advice_desc">
- <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-column
- v-if="groupForm.advice_type == 1"
- label="提醒频率"
- min-width="80"
- align="center"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.frequency_type == 1">每次必推</span>
- <span v-if="scope.row.frequency_type == 2"
- >{{ scope.row.day_count }}天/1次</span
- >
- <span v-if="scope.row.frequency_type == 3"
- >每周{{ scope.row.week_days }}</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-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-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="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.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-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-col :span="24" v-if="groupForm.advice_type == 1 && !isChild">
- <el-form-item label="周期提醒 :">
- <el-radio-group v-model="nameForm.frequency_type">
- <el-radio :label="1">每次必推</el-radio>
- <el-radio :label="2">天数频率</el-radio>
- <el-radio :label="3">星期频率</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
-
- <el-col :span="12" v-if="nameForm.frequency_type == 2">
- <el-form-item prop="day_count">
- <el-input
- style="width: 50px"
- v-model="nameForm.day_count"
- ></el-input
- > 天/一次
- </el-form-item>
- </el-col>
-
- <el-col :span="24" v-if="nameForm.frequency_type == 3">
- <el-form-item prop="weekday">
- <el-checkbox-group v-model="weeks">
- <el-checkbox label="周一" name="type"></el-checkbox>
- <el-checkbox label="周二" name="type"></el-checkbox>
- <el-checkbox label="周三" name="type"></el-checkbox>
- <el-checkbox label="周四" name="type"></el-checkbox>
- <el-checkbox label="周五" name="type"></el-checkbox>
- <el-checkbox label="周六" name="type"></el-checkbox>
- <el-checkbox label="周日" name="type"></el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- </el-col>
-
- <el-col :span="24">
- <el-form-item label="推送截止日期:">
- <el-date-picker
- v-model="nameForm.push_start_time"
- type="date"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptionsOne"
- placeholder="推送截止日期">
- </el-date-picker>
- </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 {
- CreateNewDoctorAdvice,
- CreateNewGroupAdvice,
- DeleteNewDoctorAdvice,
- DeleteNewGroupAdvice,
- EditNewDoctorAdvice,
- getAdviceConfig,
- getDoctorAdviceList,
- StopDoctorAdvice
- } from "@/api/advice";
- import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
- import { uParseTime } from "@/utils/tools";
- export default {
- name: "EditGroupAdvice",
- data() {
- return {
- pickerOptionsOne: {
- // 限制收货时间不让选择今天以前的
- disabledDate(time) {
- return time.getTime() < Date.now() - 8.64e7;
- },
- },
- weeks: [],
- editRowKey: 0,
- templateFormVisible: false,
- oldTemplateFormVisible: 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: 0,
- isEdit: 0,
- index: 0,
- id: 0,
- children: [],
- way:0,
- drug_id:0,
- src_type:"",
- drug_name_id:0,
- push_start_time:"",
- },
-
- drugOptions: [],
- deliveryWayOptions: [],
- executionFrequencyOptions: [],
- adviceTemplates: [],
- submitGroupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0
- },
- selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
- selectedTemplate: [],
- allSelectedTemplate: [],
- adviceTemplateMaps: {},
- medicals:[],
- drugSpec:[],
- all_drug:[],
- current_drug_name:"",
- current_drug_spec: "",
- drug_id: 0,
- src_type:""
- };
- },
- props: {
- patientID: 0,
- adviceType: 0,
- adminusername: "",
- rowKey: 0,
-
- weekList: [
- { id: 1, name: "周一" },
- { id: 2, name: "周二" },
- { id: 3, name: "周三" },
- { id: 4, name: "周四" },
- { id: 5, name: "周五" },
- { id: 6, name: "周六" },
- { id: 7, name: "周日" }
- ],
- weekday: [],
- groupFormVisible: false,
- groupForm: {
- advice_type: "",
- advice_date: "",
- start_time: "",
- adviceNames: [],
- advice_doctor: "",
- remark: "",
- parent_id: 0,
- remind: 0,
- frequency_type: 0,
- day_count: "",
- doctor: 0
- },
- adviceTypeOptions: {
- type: Array,
- default: function() {
- return [];
- }
- },executionFrequencyOptions:{
- type: Array,
- default: function() {
- return [];
- }
- },deliveryWayOptions:{
- type: Array,
- default: function() {
- return [];
- }
- },
-
- unitsOption: {
- type: Array,
- default: function() {
- return [];
- }
- },
- adviceTableData: {
- type: Array,
- default: function() {
- return [];
- }
- }
- },
- methods: {
- 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(() => {
- let mode = "";
- if (this.groupForm.advice_type == 1) {
- mode = "1-6";
- if (this.groupForm.doctor != this.$store.getters.xt_user.user.id) {
- mode = "1-7";
- }
- } else if (this.groupForm.advice_type == 3) {
- mode = "4-1";
- if (this.groupForm.doctor != this.$store.getters.xt_user.user.id) {
- mode = "5-1";
- }
- }
- DeleteNewDoctorAdvice(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) {
- console.log("888888",this.nameForm)
- if(this.src_type == ""){
- this.nameForm.way = 0
- this.nameForm.drug_id = 0
- }
-
- if(this.src_type == 2){ //自备药
- var arr = this.nameForm.advice_name.split("(自备药)")
- this.nameForm.advice_name = arr[0]
- }
- console.log("新增医嘱内容")
- var _this = this;
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (_this.nameForm.isEdit) {
- var submitForm = null;
- if (!this.isChild) {
- console.log("进来了吗")
- 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,
- way:_this.nameForm.way,
- drug_name_id:_this.nameForm.drug_name_id,
- drug_id:_this.nameForm.drug_id,
- isEdit: 0,
- id: 0,
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: _this.groupSelectRow.parent_id,
- groupno: _this.groupForm.groupno,
- frequency_type: _this.nameForm.frequency_type,
- day_count: _this.nameForm.day_count.toString(),
- week_days: this.weeks.filter(function(s) {
- return s && s.trim();
- }).join(","),
- push_start_time: _this.nameForm.push_start_time,
-
- };
- } else {
- 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,
- way:_this.nameForm.way,
- drug_name_id:_this.nameForm.drug_name_id,
- drug_id:_this.nameForm.drug_id,
- isEdit: 0,
- id: 0,
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: _this.groupSelectRow.parent_id,
- groupno: _this.groupForm.groupno,
- frequency_type: 0,
- day_count: "0",
- week_days: "",
- push_start_time:_this.nameForm.push_start_time
-
- };
- }
- let mode = "";
-
- if (_this.groupForm.advice_type == 1) {
-
- mode = "1-3";
- if (
- _this.groupForm.doctor != _this.$store.getters.xt_user.user.id
- ) {
- mode = "1-4";
- }
- } else if (_this.groupForm.advice_type == 3) {
- mode = "2-1";
- if (
- _this.groupForm.doctor != _this.$store.getters.xt_user.user.id
- ) {
- mode = "3-1";
- }
- }
- console.log("编辑",submitForm)
- EditNewDoctorAdvice(
- 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].frequency_type = advice.frequency_type;
- _this.adviceTableData[index].day_count = advice.day_count;
- _this.adviceTableData[index].week_day = advice.week_day;
- _this.adviceTableData[index].way = advice.way
- _this.adviceTableData[index].drug_id = advice.drug_id
- _this.adviceTableData[index].drug_name_id = advice.drug_name_id
- _this.adviceTableData[index].push_start_time = advice.push_start_time
- 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].way = _this.nameForm.way
- _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].push_start_time = _this.nameForm.push_start_time
- _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].frequency_type =_this.nameForm.frequency_type;
- _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.groupForm.adviceNames[index].day_count = _this.nameForm.day_count;
- _this.groupForm.adviceNames[index].week_day = _this.weeks.join(",");
- _this.groupForm.adviceNames[index].push_start_time = _this.nameForm.push_start_time;
- console.log(_this.weeks);
- _this.$set(
- _this.groupForm.adviceNames,
- index,
- _this.groupForm.adviceNames[index]
- );
- break;
- }
- }
- }
- }
- });
- // this.weeks = []
- } 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,
- way:_this.nameForm.way,
- drug_id:_this.nameForm.drug_id,
- drug_name_id:_this.nameForm.drug_name_id,
- isEdit: 0,
- id: 0,
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: _this.groupSelectRow.id,
- groupno: _this.groupForm.groupno,
- push_start_time:_this.groupForm.push_start_time
- };
-
- let mode = "";
- if (_this.groupForm.advice_type == 1) {
- mode = "1-2";
- } else {
- mode = "1-1";
- }
- console.log("submitFort",submitForm)
- CreateNewDoctorAdvice(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
- });
- if (
- _this.adviceType == _this.groupForm.advice_type ||
- _this.adviceType == 0
- ) {
- 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.nameForm.week_days = this.weeks
- .filter(function(s) {
- return s && s.trim();
- })
- .join(",");
- _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,
- template_id:"D" + new Date().getTime() + this.getRandValue(),
- frequency_type: _this.nameForm.frequency_type,
- day_count: _this.nameForm.day_count.toString(),
- week_days: _this.nameForm.week_days,
- drug_id:_this.nameForm.drug_id,
- way:_this.nameForm.way,
- drug_name_id:_this.nameForm.drug_name_id,
- push_start_time:_this.nameForm.push_start_time,
- isEdit: 0,
- id: 0,
- children: [],
- parent_row: 0
- }
- ],
- advice_doctor: "",
- remark: _this.groupForm.remark,
- parent_id: 0
- };
- console.log(_this.groupForm.advice_type);
-
- let mode = "";
- if (_this.groupForm.advice_type == 1) {
- mode = "1-2";
- } else {
- mode = "1-1";
- }
- console.log("触发了吗",_this.patientID,_this.submitGroupForm)
- CreateNewGroupAdvice(_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
- });
- this.weeks = [];
- if (
- _this.adviceType == _this.groupForm.advice_type ||
- _this.adviceType == 0
- ) {
- // 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,
-
- frequency_type: groups[index].frequency_type,
- day_count: groups[index].day_count,
- week_day: groups[index].week_day,
- drug_name_id:0,
- way:0,
- drug_id:0,
- 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,
- 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;
- }
- });
- },
- getRandValue() {
- var charactors = "1234567890";
-
- var value = "",
- i;
-
- for (let j = 1; j <= 4; j++) {
- i = parseInt(10 * Math.random());
-
- value = value + charactors.charAt(i);
- }
- return value;
- },
- 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,
- push_start_time:"",
- };
- 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,
- single_dose_unit: this.groupSelectRow.single_dose_unit,
- drug_spec: this.groupSelectRow.drug_spec,
- drug_spec_unit: this.groupSelectRow.drug_spec_unit,
- prescribing_number: 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,
-
- day_count: this.groupSelectRow.day_count,
- week_days: this.groupSelectRow.week_day,
- frequency_type: this.groupSelectRow.frequency_type,
- drug_id:0,
- drug_name_id:0,
- push_start_time:this.groupSelectRow.push_start_time,
- way:0,
- };
-
- if (!this.isChild) {
- this.weeks = this.groupSelectRow.week_day.split(",");
- }
- this.getAdviceConfig(1)
- 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: "",
- template_id: "",
- way:0,
- drug_id:0,
- drug_name_id:0,
- isEdit: 0,
- index: 0,
- id: 0,
- children: [],
- parent_row: 0,
- day_count: "",
- week_days: "",
- frequency_type: 0,
- push_start_time:"",
- };
- this.nameFormTitle = "新增医嘱内容";
- }
- this.nameFormVisible = true;
- },
-
- changeAdvice(selection) {
- this.selectedTemplate = selection;
- },
- 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;
- }
- }
- }
- }
-
- 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,
- 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,
- day_count: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].day_count,
- week_days: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].week_days,
- frequency_type: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
- index
- ].frequency_type
- };
- 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,
- 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() {
- console.log("9999888")
- 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,
- day_count: adviceTemplate.DoctorAdviceTemplate[index].day_count,
- frequency_type:adviceTemplate.DoctorAdviceTemplate[index].frequency_type,
- week_days: adviceTemplate.DoctorAdviceTemplate[index].week_days,
- template_id: "T" + adviceTemplate.DoctorAdviceTemplate[index].id,
- way:adviceTemplate.DoctorAdviceTemplate[index].way,
- drug_id:adviceTemplate.DoctorAdviceTemplate[index].drug_id,
- drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
- 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,
- way:children[key].way,
- drug_id:children[key].drug_id,
- drug_name_id:children[key].drug_name_id,
- 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,
- day_count: this.allSelectedTemplate[index].day_count.toString(),
- frequency_type: this.allSelectedTemplate[index].frequency_type,
- week_days: this.allSelectedTemplate[index].week_days,
- template_id: this.allSelectedTemplate[index].template_id,
- way:this.allSelectedTemplate[index].way,
- drug_id:this.allSelectedTemplate[index].drug_id,
- 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,
- way:children[key].way,
- drug_id:children[key].drug_id,
- 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);
- }
- }
- this.submitGroupForm.adviceNames.unshift(item);
- }
-
- console.log(this.groupForm.advice_type);
-
- let mode = "";
- if (this.groupForm.advice_type == 1) {
- mode = "1-2";
- } else {
- mode = "1-1";
- }
-
- CreateNewGroupAdvice(
- 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,
-
- day_count: groups[index].day_count,
- frequency_type: groups[index].frequency_type,
- week_day: groups[index].week_day,
- template_id: groups[index].template_id,
- way:groups[index].way,
- drug_id:groups[index].drug_id,
- drug_name_id:groups[index].drug_name_id,
- 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,
- isEdit: 0,
- index: 0,
- id: childMap[item.id][key].id,
- drug_id:childMap[item.id][key].drug_id,
- way:childMap[item.id][key].way,
- drug_name_id:childMap[item.id][key].drug_name_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);
- console.log(this.groupForm);
- }
- 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,
- way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
- drug_id:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
- drug_name_id:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
- 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,
- way:children[key].way,
- drug_id:children[key].drug_id,
- 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);
- }
-
- _this.submitGroupForm.adviceNames.push(item);
- }
-
- let mode = "";
- console.log(this.groupForm.advice_type);
- if (this.groupForm.advice_type == 1) {
- mode = "1-2";
- } else {
- mode = "1-1";
- }
-
- CreateNewGroupAdvice(
- _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
- });
- if (
- _this.adviceType == _this.groupForm.advice_type ||
- _this.adviceType == 0
- ) {
- // 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 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]);
- // }
-
- 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,
- 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,
- 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);
- }
-
- if (this.groupForm.advice_type == 1) {
- this.getAdviceConfig(1);
- } else if (this.groupForm.advice_type == 3) {
- this.getAdviceConfig(0);
- }
-
- this.templateFormVisible = true;
- },
- 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;
- }
- }
- }
- }
- },
- 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.groupEditFormVisible = true;
- this.groupSelectRow = null;
- if (typeof this.$refs.advicenametable !== "undefined") {
- this.$refs.advicenametable.setCurrentRow(null);
- }
- },
- 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;
- }
- }
- },
- getAdviceConfig(type) {
- console.log("type",type)
- getAdviceConfig(type).then(response => {
- if (response.data.state == 1) {
- this.deliveryWayOptions =response.data.data.drugways === null? []: response.data.data.drugways;
- console.log("给药途径",this.deliveryWayOptions)
- this.executionFrequencyOptions = response.data.data.efs === null ? [] : response.data.data.efs;
- this.adviceTemplates = response.data.data.advice_templates === null? []: response.data.data.advice_templates;
-
- var templateLen = this.adviceTemplates.length;
- for (let index = 0; index < templateLen; index++) {
- if (!this.adviceTemplates[index].DoctorAdviceTemplate) {
- continue;
- }
-
- var DoctorAdviceTemplate = this.adviceTemplates[index].DoctorAdviceTemplate;
- for (let i = 0; i < DoctorAdviceTemplate.length; i++) {
- DoctorAdviceTemplate[i].selection = false;
- }
-
- var item = this.adviceTemplates[index];
- item.DoctorAdviceTemplate = [];
- var datMap = {};
- for (const key in DoctorAdviceTemplate) {
- if (DoctorAdviceTemplate[key].parent_id == 0) {
- datMap[DoctorAdviceTemplate[key].id] =
- DoctorAdviceTemplate[key];
- }
- }
-
- for (const key in DoctorAdviceTemplate) {
- if (DoctorAdviceTemplate[key].parent_id in datMap) {
- if ("children" in datMap[DoctorAdviceTemplate[key].parent_id]) {
- datMap[DoctorAdviceTemplate[key].parent_id].children.push(
- DoctorAdviceTemplate[key]
- );
- } else {
- datMap[DoctorAdviceTemplate[key].parent_id].children = [];
- datMap[DoctorAdviceTemplate[key].parent_id].children.push(
- DoctorAdviceTemplate[key]
- );
- }
- }
- }
- for (const key in datMap) {
- item.DoctorAdviceTemplate.push(datMap[key]);
- }
-
- this.$set(
- this.adviceTemplateMaps,
- this.adviceTemplates[index].id,
- item
- );
- console.log(this.adviceTemplates);
- }
- }
- });
- },
-
- rand(min, max) {
- return Math.floor(Math.random() * (max - min)) + min;
- },
- //
- getSelfMedicalList(){
- const params = {
- patient_id:this.patientID
- }
- 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.nameForm.single_dose_unit = this.drugSpec[i].min_unit
- this.nameForm.prescribing_number_unit = this.drugSpec[i].min_unit
- this.nameForm.drug_spec_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
- }
- }
- }
- },
- handleSelect1(){
-
- },
- handleSelect(){
-
- },
-
- querySearch(queryString, cb) {
- console.log('queryString',queryString)
- 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);
- },
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- },
- watch: {
- rowKey: function() {
- this.editRowKey = this.rowKey;
- },
- "selectedTemp.list": function() {
- this.calcselectedTemp();
- }
- },
- created(){
-
- //获取自备药
- this.getSelfMedicalList()
- }
- };
- </script>
-
- <style>
- #user-edit-advice-name-table .expanded {
- 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>
|