12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984 |
- <template>
- <div>
- <el-dialog v-el-drag-dialog :title="titleStr" :visible.sync="data.bSwitch" width="1200px" top="5vh">
- <el-form ref="ruleForm" :disabled="titleStr === '详情'" :model="ruleForm" :rules="rules" label-width="80px" class="demo-ruleForm">
- <el-row :gutter="16">
- <el-col :span="8">
- <el-form-item label="病历类型" prop="case_type">
- <el-select v-model="ruleForm.case_type" placeholder="请选择" style="width: 100%;">
- <el-option
- v-for="item in caseTypeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质控项目" prop="object">
- <el-cascader
- v-model="ruleForm.object"
- :options="objects"
- :props="{
- expandTrigger: 'hover',
- value: 'field_name',
- label: 'field_name',
- children: 'child',
- checkStrictly: true // 添加此属性允许选择任意一级
- }"
- clearable
- filterable
- :show-all-levels="false"
- placeholder="请选择"
- style="width: 100%;"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质控科室">
- <el-select
- v-model="ruleForm.department"
- multiple
- collapse-tags
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="item in departments"
- :key="item.id"
- :label="item.dep_name"
- :value="item.dep_id"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="单项否决">
- <el-select v-model="ruleForm.is_not" filterable clearable placeholder="请选择" style="width: 100%;">
- <el-option label="是" :value="1" />
- <el-option label="否" :value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质控状态" prop="status">
- <el-select v-model="ruleForm.status" filterable clearable placeholder="请选择" style="width: 100%;">
- <el-option label="开启" :value="1" />
- <el-option label="禁用" :value="2" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质控类型" prop="type">
- <el-select v-model="ruleForm.type" placeholder="请选择" style="width: 100%;">
- <el-option
- v-for="item in qualityTypeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质控场景" prop="changjing">
- <el-select
- v-model="ruleForm.changjing"
- multiple
- collapse-tags
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="item in sceneOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="风险等级" prop="error_level">
- <el-select v-model="ruleForm.error_level" filterable clearable placeholder="请选择" style="width: 100%;">
- <el-option label="必改" :value="1" />
- <el-option label="建议" :value="2" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="扣分分值" prop="score">
- <el-input-number
- v-model="ruleForm.score"
- :precision="1"
- :step="0.5"
- step-strictly
- :max="100"
- :min="0"
- controls-position="right"
- placeholder="请输入"
- style="width: 100%;"
- />
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="规则描述" prop="description">
- <el-input v-model="ruleForm.description" type="textarea" :autosize="{ minRows: 3 }" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="16">
- <el-col :span="24">
- <el-form-item label="质控规则">
- <el-col :span="5">
- <el-form-item label="规则模板" prop="rule_type">
- <el-select v-model="ruleForm.rule_type" filterable placeholder="请选择" style="width: 100%;">
- <el-option label="普通规则" value="普通规则" />
- <!-- <el-option label="时效性规则" value="时效性规则" />
- <el-option label="完整性规则" value="完整性规则" />
- <el-option label="知识库规则" value="知识库规则" />
- <el-option label="大模型规则" value="大模型规则" /> -->
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24" style="margin-bottom: 20px;">
- <el-button type="primary" plain icon="el-icon-plus" @click="onAddQZTJ">前置条件</el-button>
- <el-button type="primary" plain icon="el-icon-plus" @click="onAddZKLJ">质控逻辑</el-button>
- <el-button type="primary" plain icon="el-icon-plus" @click="onAddZKYJ">质控依据</el-button>
- <el-button type="primary" plain icon="el-icon-plus" @click="onAddZKyujing">质控预警</el-button>
- </el-col>
- <!-- 前置条件 -->
- <el-col v-if="ruleForm.qztj.length" :span="24">
- <el-card v-for="(item, index) of ruleForm.qztj" :key="'qztj' + index" class="box-card" shadow="never">
- <div slot="header" class="clearfix box-card_header span">
- <span class="text">前置条件{{ index + 1 }}</span>
- <span class="ml40">
- <el-radio v-model="item.condition_type" :label="1">过滤</el-radio>
- <el-radio v-model="item.condition_type" :label="2">免审</el-radio>
- </span>
- <i
- class="el-icon-delete"
- style="float: right; margin-top: 13px; cursor: pointer;"
- @click="onDeleteQZTJ(index)"
- />
- </div>
- <div>
- <el-row
- v-for="(sItem, sIndex) of item.condition_content"
- :key="'tj' + sIndex"
- :gutter="12"
- class="mb12"
- >
- <el-col :span="2">
- <div class="text-right">条件{{ sIndex + 1 }}</div>
- </el-col>
- <el-col :span="6">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'qztj')">
- <el-input
- :value="getDisplayName(sItem.param1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="3">
- <el-select
- v-model="sItem.condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="(items, bindex) in selectFormula"
- :key="bindex"
- :label="items.formula"
- :value="items.formula"
- />
- </el-select>
- </el-col>
- <el-col v-if="sItem.condition === '时效'" :span="9">
- <el-row :gutter="8">
- <el-col :span="6">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.sx_1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%;"
- />
- <el-button
- size="small"
- style="width: 70px; position: absolute; right: 0; top: 0; opacity: 0;"
- @click="openCategoryDialog(index, sIndex, 'sx_1')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-right">至</div>
- </el-col>
- <el-col :span="6">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.sx_2)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%;"
- />
- <el-button
- size="small"
- style="width: 70px; position: absolute; right: 0; top: 0; opacity: 0;"
- @click="openCategoryDialog(index, sIndex, 'sx_2')"
- />
- </div>
- </el-col>
- <el-col v-if="sItem.sx_2" :span="0.5">
- <div class="text-right">+</div>
- </el-col>
- <el-col v-if="sItem.sx_2" :span="5">
- <el-input v-model="sItem.sx_3" clearable placeholder="请输入" style="width: 100%;" />
- </el-col>
- <el-col :span="3" style="margin-left: 5px;">
- <div class="text-right">小时</div>
- </el-col>
- </el-row>
- </el-col>
- <el-col v-else-if="sItem.condition === '范围'" :span="6">
- <el-row :gutter="8">
- <el-col :span="10">
- <el-input v-model="sItem.fanwei_1" clearable placeholder="请输入" />
- </el-col>
- <el-col :span="2">
- <div class="text-right">至</div>
- </el-col>
- <el-col :span="10">
- <el-input v-model="sItem.fanwei_2" clearable placeholder="请输入" />
- </el-col>
- </el-row>
- </el-col>
- <el-col v-else-if="['等于', '不等于', '包含', '不包含', '大于', '小于', '大于等于', '小于等于'].includes(sItem.condition)" :span="6">
- <div class="input-with-category">
- <template v-if="sItem.hasChildOptions">
- <!-- 当有三级数据时显示只读输入框和选择按钮 -->
- <el-input
- v-if="sItem.hasThirdLevel"
- :value="sItem.param2"
- placeholder="请选择"
- size="small"
- readonly
- style="width: calc(100% - 90px)"
- />
- <!-- 当没有三级数据时显示多选下拉框 -->
- <el-select
- v-else
- v-model="sItem.param2"
- multiple
- collapse-tags
- filterable
- clearable
- placeholder="请选择"
- size="small"
- style="width: calc(100% - 90px)"
- @change="(value) => handleInput(value, index, sIndex, 'qztj')"
- >
- <el-option
- v-for="option in sItem.childOptions"
- :key="option.field"
- :label="option.field_name"
- :value="option.field_name"
- />
- </el-select>
- </template>
- <template v-else>
- <el-input
- v-model="sItem.param2"
- placeholder="请输入"
- size="small"
- style="width: calc(100% - 90px)"
- @input="(value) => handleInput(value, index, sIndex, 'qztj')"
- />
- </template>
- <!-- 当有三级数据时显示选择按钮 -->
- <el-button
- v-if="sItem.hasThirdLevel"
- size="small"
- style="width: 90px"
- class="category-select"
- @click="openChildOptionsDialog(index, sIndex)"
- >
- <i class="el-icon-s-operation" style="margin-right: 5px" />
- 选择
- </el-button>
- <!-- 当没有三级数据时显示类型选择 -->
- <el-select
- v-else
- v-model="sItem.categoryType"
- size="small"
- placeholder="文本"
- style="width: 90px"
- class="category-select"
- :disabled="sItem.categoryTypeDisabled"
- >
- <i slot="prefix" class="el-icon-s-operation" />
- <el-option
- v-for="sitem in categories"
- :key="sitem.value"
- :label="sitem.label"
- :value="sitem.value"
- />
- </el-select>
- </div>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="4">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.subtract_param)"
- placeholder="请选择"
- size="small"
- style="width: calc(100% - 70px)"
- readonly
- @click="openCategoryDialog(index, sIndex, 'subtract')"
- />
- <el-button
- size="small"
- style="width: 70px"
- class="category-select"
- @click="openCategoryDialog(index, sIndex, 'subtract')"
- >
- <i class="el-icon-s-operation" style="margin-right: 5px" />
- 选择
- </el-button>
- </div>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="3">
- <el-select
- v-model="sItem.subtract_condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option label="大于" value="gt" />
- <el-option label="小于" value="lt" />
- <el-option label="等于" value="eq" />
- </el-select>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="3">
- <div class="input-with-category">
- <el-input
- v-model="sItem.subtract_value"
- placeholder="请输入"
- size="small"
- style="width: calc(100% - 70px)"
- />
- <el-select
- v-model="sItem.subtract_value_type"
- size="small"
- placeholder="类型"
- style="width: 70px"
- class="category-select"
- >
- <el-option label="小时" value="hour" />
- <el-option label="分钟" value="minute" />
- <el-option label="数值" value="number" />
- </el-select>
- </div>
- </el-col>
- <el-col v-else-if="sItem.condition === '重复率'" :span="9">
- <el-row :gutter="8">
- <el-col :span="10">
- <!-- 第二参数选择 -->
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.param2_object)"
- placeholder="请选择比较对象"
- size="small"
- readonly
- style="width: 100%;"
- />
- <el-button
- size="small"
- style="width: 90px; position: absolute; right: 0; top: 0; opacity: 0;"
- @click="openCategoryDialog(index, sIndex, 'param2_object')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">≥</div>
- </el-col>
- <el-col :span="8">
- <!-- 重复率值输入 -->
- <el-input-number
- v-model="sItem.subtract_value"
- :precision="1"
- :step="0.1"
- :max="100"
- :min="0"
- controls-position="right"
- placeholder="重复率"
- style="width: 100%;"
- />
- </el-col>
- <el-col :span="2">
- <div class="text-left" style="line-height: 36px; padding-left: 5px;">%</div>
- </el-col>
- </el-row>
- </el-col>
- <el-col :span="2">
- <div class="button-group">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="onAddTJ(index, sIndex)"
- />
- <el-button
- v-if="item.condition_content.length !== 1"
- size="mini"
- type="primary"
- plain
- icon="el-icon-minus"
- @click="onDeleteTJ(index, sIndex)"
- />
- </div>
- </el-col>
- </el-row>
- </div>
- </el-card>
- </el-col>
- <!-- 质控逻辑 -->
- <el-col :span="24">
- <el-divider />
- <el-card v-for="(item, index) of ruleForm.rule" :key="'rule' + index" class="box-card" shadow="never">
- <div slot="header" class="clearfix box-card_header span">
- <span class="text">质控逻辑</span>
- <span class="ml40">
- <span>流向</span>
- <el-radio v-model="item.detail_status" :label="1" class="ml40">正确</el-radio>
- <el-radio v-model="item.detail_status" :label="2">错误</el-radio>
- </span>
- </div>
- <div>
- <el-row
- v-for="(sItem, sIndex) of item.condition_content"
- :key="'tj' + sIndex"
- :gutter="12"
- class="mb12"
- >
- <el-col :span="2">
- <div class="text-right">逻辑{{ sIndex + 1 }}</div>
- </el-col>
- <el-col v-if="!(sItem.condition === '病程记录关联' || sItem.condition === '时效')" :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'rule')">
- <el-input
- :value="getDisplayName(sItem.param1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col v-if="!(sItem.condition === '病程记录关联' || sItem.condition === '时效')" :span="4">
- <el-select
- v-model="sItem.condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="(items, bindex) in selectFormula"
- :key="bindex"
- :label="items.formula"
- :value="items.formula"
- />
- </el-select>
- </el-col>
- <el-col v-if="sItem.condition === '时效'" :span="22" class="progress-note">
- <el-row :gutter="24">
- <el-col v-if="sItem.condition === '时效'" :span="5">
- <el-select
- v-model="sItem.condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="(items, bindex) in selectFormula"
- :key="bindex"
- :label="items.formula"
- :value="items.formula"
- />
- </el-select>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'sx_param1')">
- <el-input
- :value="getDisplayName(sItem.sx_param1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">等于</div>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition">
- <el-input
- v-model="sItem.sx_param2"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'sx_param2')"
- />
- </div>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'sx_param3')">
- <el-input
- :value="getDisplayName(sItem.sx_param3)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">在</div>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'sx_param4_index')">
- <el-input
- :value="getDisplayName(sItem.sx_param4_index)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">包含</div>
- </el-col>
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.sx_param4_condition1"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'sx_param4_condition1')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">不包含</div>
- </el-col>
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.sx_param4_condition2"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'sx_param4_condition2')"
- />
- </div>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'sx_param4_kssj')">
- <el-input
- :value="getDisplayName(sItem.sx_param4_kssj)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">至</div>
- </el-col>
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'sx_param4_jssj')">
- <el-input
- :value="getDisplayName(sItem.sx_param4_jssj)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="1">
- <div class="text-center">+</div>
- </el-col>
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.sx_param4_sjjg"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center">小时内</div>
- </el-col>
- <el-col v-if="sItem.condition === '时效'" :span="2">
- <div class="button-group">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="onAddGZ(index, sIndex)"
- />
- <el-button
- v-if="item.condition_content.length !== 1"
- size="mini"
- type="primary"
- plain
- icon="el-icon-minus"
- @click="onDeleteGZ(index, sIndex)"
- />
- </div>
- </el-col>
- <!-- <el-col :span="6">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.sx_2)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%;"
- />
- <el-button
- size="small"
- style="width: 90px; position: absolute; right: 0; top: 0; opacity: 0;"
- @click="openCategoryDialog(index, sIndex, 'sx_2')"
- />
- </div>
- </el-col>
- <el-col v-if="sItem.sx_2" :span="0.5">
- <div class="text-right">+</div>
- </el-col>
- <el-col v-if="sItem.sx_2" :span="5">
- <el-input v-model="sItem.sx_3" clearable placeholder="请输入" style="width: 100%;" />
- </el-col>
- <el-col :span="3">
- <div class="text-right">小时</div>
- </el-col> -->
- </el-row>
- </el-col>
- <el-col v-else-if="sItem.condition === '范围'" :span="6">
- <el-row :gutter="8">
- <el-col :span="10">
- <el-input v-model="sItem.fanwei_1" clearable placeholder="请输入" />
- </el-col>
- <el-col :span="2">
- <div class="text-right">至</div>
- </el-col>
- <el-col :span="10">
- <el-input v-model="sItem.fanwei_2" clearable placeholder="请输入" />
- </el-col>
- </el-row>
- </el-col>
- <el-col v-else-if="['等于', '不等于', '包含', '不包含', '大于', '小于', '大于等于', '小于等于'].includes(sItem.condition)" :span="6">
- <div class="input-with-category">
- <template v-if="sItem.hasChildOptions">
- <!-- 当有三级数据时显示只读输入框和选择按钮 -->
- <el-input
- v-if="sItem.hasThirdLevel"
- :value="sItem.param2"
- placeholder="请选择"
- size="small"
- readonly
- style="width: calc(100% - 90px)"
- />
- <!-- 当没有三级数据时显示多选下拉框 -->
- <el-select
- v-else
- v-model="sItem.param2"
- multiple
- collapse-tags
- filterable
- clearable
- placeholder="请选择"
- size="small"
- style="width: calc(100% - 90px)"
- @change="(value) => handleInput(value, index, sIndex, 'rule')"
- >
- <el-option
- v-for="option in sItem.childOptions"
- :key="option.field"
- :label="option.field_name"
- :value="option.field_name"
- />
- </el-select>
- </template>
- <template v-else>
- <el-input
- v-model="sItem.param2"
- placeholder="请输入"
- size="small"
- style="width: calc(100% - 90px)"
- @input="(value) => sItem.categoryType === '字典' && handleInput(value, index, sIndex, 'rule')"
- />
- </template>
- <!-- 当有三级数据时显示选择按钮 -->
- <el-button
- v-if="sItem.hasThirdLevel"
- size="small"
- style="width: 90px"
- class="category-select"
- @click="openChildOptionsDialog(index, sIndex)"
- >
- <i class="el-icon-s-operation" style="margin-right: 5px" />
- 选择
- </el-button>
- <!-- 当没有三级数据时显示类型选择 -->
- <el-select
- v-else
- v-model="sItem.categoryType"
- size="small"
- placeholder="文本"
- style="width: 90px"
- class="category-select"
- :disabled="sItem.categoryTypeDisabled"
- >
- <i slot="prefix" class="el-icon-s-operation" />
- <el-option
- v-for="sitem in categories"
- :key="sitem.value"
- :label="sitem.label"
- :value="sitem.value"
- />
- </el-select>
- </div>
- </el-col>
- <el-col v-if="['包含', '不包含'].includes(sItem.condition)" :span="1">
- <div class="text-center" style="line-height: 36px;">删除</div>
- </el-col>
- <el-col v-if="['包含', '不包含'].includes(sItem.condition)" :span="4">
- <!-- 第二参数选择 -->
- <div class="rule-condition">
- <el-input
- v-model="sItem.delete_field"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- />
- </div>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="4">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.subtract_param)"
- placeholder="请选择"
- size="small"
- style="width: calc(100% - 90px)"
- readonly
- @click="openCategoryDialog(index, sIndex, 'subtract')"
- />
- <el-button
- size="small"
- style="width: 90px"
- class="category-select"
- @click="openCategoryDialog(index, sIndex, 'subtract')"
- >
- <i class="el-icon-s-operation" style="margin-right: 5px" />
- 选择
- </el-button>
- </div>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="3">
- <el-select
- v-model="sItem.subtract_condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option label="大于" value="gt" />
- <el-option label="小于" value="lt" />
- <el-option label="等于" value="eq" />
- </el-select>
- </el-col>
- <el-col v-if="sItem.condition === '减'" :span="3">
- <div class="input-with-category">
- <el-input
- v-model="sItem.subtract_value"
- placeholder="请输入"
- size="small"
- style="width: calc(100% - 70px)"
- />
- <el-select
- v-model="sItem.subtract_value_type"
- size="small"
- placeholder="类型"
- style="width: 70px"
- class="category-select"
- >
- <el-option label="小时" value="hour" />
- <el-option label="分钟" value="minute" />
- <el-option label="数值" value="number" />
- </el-select>
- </div>
- </el-col>
- <el-col v-else-if="sItem.condition === '重复率'" :span="9">
- <el-row :gutter="8">
- <el-col :span="10">
- <!-- 第二参数选择 -->
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.param2_object)"
- placeholder="请选择比较对象"
- size="small"
- readonly
- style="width: 100%;"
- />
- <el-button
- size="small"
- style="width: 90px; position: absolute; right: 0; top: 0; opacity: 0;"
- @click="openCategoryDialog(index, sIndex, 'param2_object')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">≥</div>
- </el-col>
- <el-col :span="8">
- <!-- 重复率值输入 -->
- <el-input-number
- v-model="sItem.subtract_value"
- :precision="1"
- :step="0.1"
- :max="100"
- :min="0"
- controls-position="right"
- placeholder="重复率"
- style="width: 100%;"
- />
- </el-col>
- <el-col :span="2">
- <div class="text-left" style="line-height: 36px; padding-left: 5px;">%</div>
- </el-col>
- </el-row>
- </el-col>
- <el-col v-else-if="sItem.condition === '病程记录关联'" :span="22" class="progress-note">
- <el-row :gutter="24">
- <!-- 参数1 -->
- <el-col v-if="sItem.condition === '病程记录关联'" :span="5">
- <el-select
- v-model="sItem.condition"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option
- v-for="(items, bindex) in selectFormula"
- :key="bindex"
- :label="items.formula"
- :value="items.formula"
- />
- </el-select>
- </el-col>
- <!-- 参数2 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param1_BLBH"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param1_BLBH')"
- />
- </div>
- </el-col>
- <!-- 参数3 -->
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param1')">
- <el-input
- :value="getDisplayName(sItem.pn_param1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <!-- 参数4 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param2"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param2')"
- />
- </div>
- </el-col>
- <!-- 参数5 -->
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param3')">
- <el-input
- :value="getDisplayName(sItem.pn_param3)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="1">
- <div class="text-center" style="line-height: 36px;">在</div>
- </el-col>
- <!-- 参数6 -->
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param4_index')">
- <el-input
- :value="getDisplayName(sItem.pn_param4_index)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">包含</div>
- </el-col>
- <!-- 参数7 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param4_condition1"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param4_condition1')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">不包含</div>
- </el-col>
- <!-- 参数8 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param4_condition2"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param4_condition2')"
- />
- </div>
- </el-col>
- <!-- 参数9 -->
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param4_kssj')">
- <el-input
- :value="getDisplayName(sItem.pn_param4_kssj)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="1">
- <div class="text-center" style="line-height: 36px;">至</div>
- </el-col>
- <!-- 参数10 -->
- <el-col :span="5">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param4_jssj')">
- <el-input
- :value="getDisplayName(sItem.pn_param4_jssj)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="1">
- <div class="text-center" style="line-height: 36px;">+</div>
- </el-col>
- <!-- 参数11 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param4_sjjg"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">小时内</div>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <!-- 参数12 -->
- <el-col :span="5">
- <el-select
- v-model="sItem.pn_param5"
- filterable
- clearable
- placeholder="请选择"
- style="width: 100%;"
- >
- <el-option label="关联" value="gl" />
- <el-option label="不关联" value="bgl" />
- </el-select>
- </el-col>
- <!-- 参数13 -->
- <el-col :span="4">
- <div class="rule-condition" @click="openCategoryDialog(index, sIndex, 'pn_param6')">
- <el-input
- :value="getDisplayName(sItem.pn_param6)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">包含</div>
- </el-col>
- <!-- 参数14 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param6_ct"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param6_ct')"
- />
- </div>
- </el-col>
- <el-col :span="2">
- <div class="text-center" style="line-height: 36px;">不含</div>
- </el-col>
- <!-- 参数15 -->
- <el-col :span="4">
- <div class="rule-condition">
- <el-input
- v-model="sItem.pn_param6_oct"
- placeholder="请输入"
- size="small"
- style="width: 100%;"
- @input="(value) => handleInput(value, index, sIndex, 'rule_other', 'pn_param6_oct')"
- />
- </div>
- </el-col>
- <el-col v-if="sItem.condition === '病程记录关联'" :span="2">
- <div class="button-group">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="onAddGZ(index, sIndex)"
- />
- <el-button
- v-if="item.condition_content.length !== 1"
- size="mini"
- type="primary"
- plain
- icon="el-icon-minus"
- @click="onDeleteGZ(index, sIndex)"
- />
- </div>
- </el-col>
- </el-row>
- </el-col>
- <el-col v-if="!(sItem.condition === '病程记录关联' || sItem.condition === '时效')" :span="2">
- <div class="button-group">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="onAddGZ(index, sIndex)"
- />
- <el-button
- v-if="item.condition_content.length !== 1"
- size="mini"
- type="primary"
- plain
- icon="el-icon-minus"
- @click="onDeleteGZ(index, sIndex)"
- />
- </div>
- </el-col>
- </el-row>
- <div class="span">
- <span>规则之间的逻辑</span>
- <el-radio v-model="item.condition_relation" :label="1" class="ml40">且(满足所有条件)</el-radio>
- <el-radio v-model="item.condition_relation" :label="2">或(满足任意一条件)</el-radio>
- </div>
- </div>
- </el-card>
- </el-col>
- <!-- 质控依据 -->
- <el-col v-if="ruleForm.rule[0].custom_basis.length" :span="24">
- <el-card v-for="(item, index) of ruleForm.rule" :key="'rule' + index" class="box-card" shadow="never">
- <div slot="header" class="clearfix box-card_header span">
- <span class="text">质控依据</span>
- <i
- class="el-icon-delete"
- style="float: right; margin-top: 13px; cursor: pointer;"
- @click="onDeleteZKYJ(index)"
- />
- </div>
- <div>
- <el-row v-for="(sItem, sIndex) of item.custom_basis" :key="'tj' + sIndex" :gutter="12" class="mb12">
- <el-col :span="2">
- <div class="text-right">条件{{ sIndex + 1 }}</div>
- </el-col>
- <el-col :span="6">
- <div class="rule-condition">
- <el-input
- v-model="sItem.input1"
- placeholder="请输入"
- size="small"
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="6">
- <div class="rule-condition">
- <el-input
- :value="getDisplayName(sItem.param1)"
- placeholder="请选择"
- size="small"
- style="width: calc(100% - 90px)"
- readonly
- @click="openCategoryDialog(index, sIndex, 'custom_basis')"
- />
- <el-button
- size="small"
- style="width: 90px"
- class="category-select"
- @click="openCategoryDialog(index, sIndex, 'custom_basis')"
- >
- <i class="el-icon-s-operation" style="margin-right: 5px" />
- 选择
- </el-button>
- </div>
- </el-col>
- <el-col :span="6">
- <el-input v-model="sItem.input2" clearable placeholder="请输入" style="width: 100%;" />
- </el-col>
- <el-col :span="4">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="onAddTJZKYJ(index, sIndex)"
- />
- <el-button
- v-if="item.custom_basis.length !== 1"
- size="mini"
- type="primary"
- plain
- icon="el-icon-minus"
- @click="onDeleteTJZKYJ(index, sIndex)"
- />
- </el-col>
- </el-row>
- </div>
- </el-card>
- </el-col>
- <!-- 质控预警 -->
- <el-col v-if="Object.keys(ruleForm.rule[0].custom_msg).length != 0" :span="24">
- <el-card v-for="(item, index) of ruleForm.rule" :key="'rule' + index" class="box-card" shadow="never">
- <div slot="header" class="clearfix box-card_header span">
- <span class="text">质控预警</span>
- <i
- class="el-icon-delete"
- style="float: right; margin-top: 13px; cursor: pointer;"
- @click="onDeleteZKyujing(index)"
- />
- </div>
- <div>
- <el-row :gutter="12" class="mb12">
- <el-col :span="2">
- <div class="text-right">事件</div>
- </el-col>
- <el-col :span="7">
- <div class="rule-condition" @click="openCategoryDialog(index, 0, 'custom_msg')">
- <el-input
- :value="getDisplayName(item.custom_msg.param1)"
- placeholder="请选择"
- size="small"
- readonly
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :span="1"> + </el-col>
- <el-col :span="2"><el-input
- v-model="item.custom_msg.aftertime"
- clearable
- placeholder="请输入"
- style="width: 100%;"
- /></el-col>
- <el-col :span="1">分</el-col>
- <el-col :span="1">前</el-col>
- <el-col :span="2"><el-input
- v-model="item.pre_warning_time"
- clearable
- placeholder="请输入"
- style="width: 100%;"
- /></el-col>
- <el-col :span="2">分提醒</el-col>
- </el-row>
- <el-row :gutter="12" class="mb12">
- <el-col :span="2">
- <div class="text-right">预警提示</div>
- </el-col>
- <el-col :span="6">
- <el-input v-model="item.custom_msg.input1" clearable placeholder="请输入" style="width: 100%;" />
- </el-col>
- <el-col :span="4">
- <el-input
- v-model="item.custom_msg.input3"
- clearable
- disabled
- placeholder="请输入"
- style="width: 100%;"
- />
- </el-col>
- <el-col :span="6">
- <el-input v-model="item.custom_msg.input2" clearable placeholder="请输入" style="width: 100%;" />
- </el-col>
- <el-col :span="4" />
- </el-row>
- </div>
- </el-card>
- </el-col>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <span v-if="titleStr !== '详情'" slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm('ruleForm')">提 交</el-button>
- <el-button @click="onTest">测试规则</el-button>
- </span>
- </el-dialog>
- <!-- 新增选择弹窗 -->
- <el-dialog title="选择类目" :visible.sync="categoryDialogVisible" width="600px" append-to-body>
- <el-tabs
- v-model="activeCategory"
- type="border-card"
- class="tab"
- :tab-position="'left'"
- style="height:max-content"
- @tab-click="handleCategoryClick"
- >
- <el-tab-pane
- v-for="(item) in (objects)"
- :key="item.field_name"
- :label="item.field_name"
- :name="item.field_name"
- >
- <el-row slot="label" type="flex" align="middle">{{ item.field_name }}</el-row>
- <div class="grid-container">
- <el-tag
- v-for="(tag) in item.child"
- :key="tag.field"
- size="large"
- type="info"
- @click="handleSubCategorySelect(tag)"
- >
- {{ tag.field_name }}
- </el-tag>
- </div>
- </el-tab-pane>
- </el-tabs>
- </el-dialog>
- <!-- 修改知识库弹窗 -->
- <el-dialog title="知识库" :visible.sync="knowledgeDialogVisible" width="800px" append-to-body>
- <div class="knowledge-content">
- <!-- 搜索框 -->
- <el-input
- v-model="searchKeyword"
- placeholder="请输入内容"
- prefix-icon="el-icon-search"
- style="margin-bottom: 15px;"
- />
- <!-- 知识库列表 -->
- <el-table
- :data="knowledgeList.filter(data => !searchKeyword || data.name.toLowerCase().includes(searchKeyword.toLowerCase()))"
- style="width: 100%"
- >
- <el-table-column prop="id" label="序号" width="80" />
- <el-table-column prop="name" label="知识库名称" />
- <el-table-column label="操作" width="180">
- <template slot-scope="scope">
- <el-button type="text" @click="handleKnowledgeView(scope.row)">
- 查看
- </el-button>
- <el-button type="text" @click="handleKnowledgeSelect(scope.row)">
- 引用
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-dialog>
- <!-- 添加知识库详情弹窗 -->
- <el-dialog title="知识库详情" :visible.sync="knowledgeDetailVisible" width="600px" append-to-body>
- <div class="knowledge-detail">
- <div class="detail-item">
- <span class="label">名称:</span>
- <el-input v-model="editKnowledge.name" placeholder="请输入名称" />
- </div>
- <div class="detail-item">
- <span class="label">ID:</span>
- <span class="id-value">{{ currentKnowledge.id }}</span>
- </div>
- <div class="detail-item">
- <span class="label">用途:</span>
- <div class="tags-input">
- <el-button
- v-for="(item, index) in bzmcArray"
- :key="'bzmc_' + index"
- type="primary"
- plain
- class="tag-button"
- >
- {{ item }}
- <i class="el-icon-close" @click.stop="handleBzmcClose(index)" />
- </el-button>
- <el-input
- v-if="inputVisible.bzmc"
- ref="bzmcInput"
- v-model="editKnowledge.bzmc"
- class="tag-input"
- @keyup.enter.native="handleInputConfirm('bzmc')"
- @blur="handleInputConfirm('bzmc')"
- />
- <el-button v-else type="primary" plain @click="showInput('bzmc')">+ 添加</el-button>
- </div>
- </div>
- <div class="detail-item">
- <span class="label">关键词:</span>
- <div class="tags-input">
- <el-button
- v-for="(keyword, index) in keywordsArray"
- :key="'keyword_' + index"
- type="primary"
- plain
- class="tag-button"
- >
- {{ keyword }}
- <i class="el-icon-close" @click.stop="handleKeywordClose(index)" />
- </el-button>
- <el-input
- v-if="inputVisible.keyword"
- ref="keywordInput"
- v-model="editKnowledge.keyword"
- class="tag-input"
- @keyup.enter.native="handleInputConfirm('keyword')"
- @blur="handleInputConfirm('keyword')"
- />
- <el-button v-else type="primary" plain @click="showInput('keyword')">+ 添加</el-button>
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="knowledgeDetailVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveKnowledge">保 存</el-button>
- </span>
- </el-dialog>
- <!-- 添加新的对话框 -->
- <el-dialog
- title="选择子选项"
- :visible.sync="childOptionsDialogVisible"
- width="30%"
- >
- <div class="child-options-list">
- <el-button
- v-for="option in currentChildOptions"
- :key="option.field"
- size="small"
- @click="handleChildOptionSelect(option)"
- >
- {{ option.field_name }}
- </el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { add_rule } from '@/api/rule/config'
- import { get_all_word_map } from '@/api/dict'
- import { get_rule_detail, getSelectFormula } from '@/api/rule/config'
- import { edit_word_map } from '@/api/dict'
- import { get_rule_setting_other } from '@/api/rule/config'
- import { get_dict_by_type } from '@/api/rule/config'
- export default {
- props: {
- data: {
- type: Object,
- default() {
- return {
- bSwitch: false,
- row: {}
- }
- }
- },
- objects: {
- type: Array,
- default() {
- return []
- }
- },
- departments: {
- type: Array,
- default() {
- return []
- }
- }
- },
- data() {
- return {
- qcData: [],
- ruleForm: {
- case_type: '',
- changjing: [],
- department: [],
- object: [],
- type: '',
- is_not: '',
- description: '',
- score: undefined,
- error_level: '',
- status: '',
- rule_type: '普通规则',
- selectFormula: [],
- compareFormula: [],
- rule: [
- // 质控逻辑只有一条
- {
- is_pre_condition: 0,
- condition_type: 1,
- condition_relation: 2,
- detail_status: 1,
- condition_content: [
- {
- param1: '',
- param2: '',
- delete_field: '',
- condition: '包含',
- categoryType: '文本',
- sx_1: '',
- sx_2: '',
- sx_3: '',
- subtract_param: '',
- subtract_condition: '',
- subtract_value: '',
- subtract_value_type: 'number',
- hasChildOptions: false,
- childOptions: [],
- // 病程记录关联
- pn_param1_BLBH: '',
- pn_param1: [],
- pn_param2: '',
- pn_param3: [],
- pn_param4_index: [],
- pn_param4_condition1: '',
- pn_param4_condition2: '',
- pn_param4_kssj: [],
- pn_param4_jssj: [],
- pn_param4_sjjg: '',
- pn_param5: '',
- pn_param6: [],
- pn_param6_ct: '',
- pn_param6_oct: '',
- // 时效
- sx_param1: [],
- sx_param2: '',
- sx_param3: [],
- sx_param4_index: [],
- sx_param4_kssj: [],
- sx_param4_jssj: [],
- sx_param4_condition1: '',
- sx_param4_condition2: '',
- sx_param4_sjjg: ''
- }
- ],
- custom_basis: [], // 质控依据
- pre_warning_time: '',
- custom_msg: {}
- }
- ],
- qztj: []
- },
- rules: {
- description: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- score: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- case_type: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- changjing: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- department: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- object: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- type: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- is_not: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- error_level: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- status: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- rule_type: [
- { required: true, message: '请选择', trigger: 'blur' }
- ]
- },
- categoryDialogVisible: false,
- searchKeyword: '',
- selectedCategoryValue: '',
- currentRuleIndex: null,
- currentConditionIndex: null,
- categories: [],
- categoryType: 'text', // 默认选中文本类型
- activeCategory: '',
- currentSubCategories: [],
- selectedCategory: null,
- currentSource: '',
- currentInputSource: '', // 添加输入来源标识
- currentFieldsName: '',
- knowledgeDialogVisible: false,
- knowledgeList: [],
- currentInputIndex: null,
- currentRuleIndexForKnowledge: null,
- knowledgeDetailVisible: false,
- currentKnowledge: {
- id: '',
- name: '',
- BZMC: '', // 改为字符串类型
- keywords: []
- },
- editKnowledge: {
- name: '',
- bzmc: '',
- keyword: ''
- },
- inputVisible: {
- bzmc: false,
- keyword: false
- },
- caseTypeOptions: [], // 病历类型选项
- qualityTypeOptions: [], // 质控类型选项
- sceneOptions: [], // 质控场景选项
- childOptionsDialogVisible: false,
- currentChildOptions: []
- }
- },
- computed: {
- titleStr() {
- return this.data.row.id ? this.data.actionType === 'DETAIL' ? '详情' : '编辑' : '新增'
- },
- filteredCategories() {
- if (!this.searchKeyword) return this.categories
- return this.categories.filter(item =>
- item.label.toLowerCase().includes(this.searchKeyword.toLowerCase())
- )
- },
- bzmcArray() {
- return this.currentKnowledge.BZMC ? this.currentKnowledge.BZMC.split(',') : []
- },
- // 获取格式化后的关键词字符串
- formattedKeywords() {
- return Array.isArray(this.currentKnowledge.keywords)
- ? this.currentKnowledge.keywords.join(',')
- : this.currentKnowledge.keywords || ''
- },
- // 处理关键词数组
- keywordsArray() {
- return this.currentKnowledge.keywords
- ? (typeof this.currentKnowledge.keywords === 'string'
- ? this.currentKnowledge.keywords.split(',')
- : this.currentKnowledge.keywords)
- : []
- }
- },
- created() {
- this.getQcData()
- this.getSelectFormula()
- this.getCategories()
- if (this.data.row.id) {
- this.getDetail(this.data.row.id)
- }
- this.getDropdownData()
- },
- methods: {
- onTest() {
- this.$message.info('功能待开放...')
- },
- // 获取详情
- getDetail(id) {
- get_rule_detail({ id }).then(res => {
- const { p } = res
- const {
- case_type,
- changjing,
- department,
- object,
- type,
- is_not,
- description,
- score,
- error_level,
- status
- } = p.rule
- // 直接使用字符串数组,不需要转换为数字
- this.ruleForm.department = department || []
- this.ruleForm.case_type = case_type
- this.ruleForm.changjing = changjing.split(',')
- this.ruleForm.is_not = is_not
- this.ruleForm.status = status
- this.ruleForm.type = type
- this.ruleForm.error_level = error_level
- this.ruleForm.score = score
- this.ruleForm.description = description
- this.ruleForm.object = object.split(',')
- // 获取规则列表并处理 param2
- const ruleList = this.getQcRule(p.rule_list)
- ruleList.forEach(rule => {
- rule.condition_content.forEach(item => {
- if (item.condition === '病程记录关联') {
- // 病程记录关联
- item.pn_param1_BLBH = item.param1[2]
- item.pn_param1 = [item.param1[0], item.param1[1]]
- item.pn_param2 = item.param2
- item.pn_param3 = item.param3
- item.pn_param4_index = item.param4[0].index && (item.param4[0].index).split('.') || []
- item.pn_param4_condition1 = item.param4[0].condition1
- item.pn_param4_condition2 = item.param4[0].condition2
- item.pn_param4_kssj = item.param4[0].kssj && (item.param4[0].kssj).split('.') || []
- item.pn_param4_jssj = item.param4[0].jssj && (item.param4[0].jssj).split('.') || []
- item.pn_param4_sjjg = item.param4[0].sjjg
- item.pn_param5 = item.param5
- item.pn_param6 = item.param6[0] && (item.param6[0]).split('.') || []
- item.pn_param6_ct = item.param6[1]
- item.pn_param6_oct = item.param6[2]
- }
- if (item.condition === '时效') {
- // 时效
- item.sx_param1 = [item.param1[0], item.param1[1]]
- item.sx_param2 = item.param2
- item.sx_param3 = [item.param3[0], item.param3[1]]
- item.sx_param4_index = item.param4[0].index && (item.param4[0].index).split('.') || []
- item.sx_param4_condition1 = item.param4[0].condition1
- item.sx_param4_condition2 = item.param4[0].condition2
- item.sx_param4_kssj = item.param4[0].kssj && (item.param4[0].kssj).split('.') || []
- item.sx_param4_jssj = item.param4[0].jssj && (item.param4[0].jssj).split('.') || []
- item.sx_param4_sjjg = item.param4[0].sjjg
- }
- // 如果是字典类型且 param2 是字符串,转换为数组
- if (item.hasChildOptions && typeof item.param2 === 'string' && item.param2) {
- item.param2 = item.param2.split(',')
- }
- // 处理重复率条件的param2
- if (item.condition === '重复率' && item.param2) {
- // 将形如 "bllb294_295_2023.BLTD" 的字符串解析为对象数组
- const parts = item.param2.split('.')
- if (parts.length === 2) {
- item.param2_object = [parts[0], parts[1]]
- }
- }
- })
- })
- this.ruleForm.rule = ruleList
- // 获取前置条件并处理 param2
- const preRuleList = this.getPreRule(p.rule_list)
- preRuleList.forEach(rule => {
- rule.condition_content.forEach(item => {
- // 如果是字典类型且 param2 是字符串,转换为数组
- if (item.hasChildOptions && typeof item.param2 === 'string' && item.param2) {
- item.param2 = item.param2.split(',')
- }
- // 处理重复率条件的param2
- if (item.condition === '重复率' && item.param2) {
- // 将形如 "bllb294_295_2023.BLTD" 的字符串解析为对象数组
- const parts = item.param2.split('.')
- if (parts.length === 2) {
- item.param2_object = [parts[0], parts[1]]
- }
- }
- })
- })
- this.ruleForm.qztj = preRuleList
- })
- },
- // 找到前置条件
- getPreRule(list) {
- return list.filter(item => item.is_pre_condition)
- },
- // 找到质控逻辑
- getQcRule(list) {
- const rule = list.filter(item => !item.is_pre_condition)
- return rule
- },
- getSelectFormula() {
- getSelectFormula({ lx: 0 }).then(res => {
- const { p } = res
- console.log('select formula:', p)
- this.selectFormula = p
- })
- },
- // 搜索质控字典
- getQcData() {
- get_all_word_map({ status: 1 }).then(res => {
- const { p } = res
- this.qcData = Array.isArray(p) ? p : []
- })
- },
- querySearch(queryString, cb) {
- var qcData = this.qcData
- var results = queryString ? qcData.filter(this.createFilter(queryString)) : qcData
- // 调用 callback 返回建议列表的数据
- cb(results)
- },
- createFilter(queryString) {
- return (restaurant) => {
- return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
- }
- },
- handleSelect(item) {
- console.log(item)
- },
- // 添加前置条件大框
- onAddQZTJ() {
- this.ruleForm.qztj.push({
- is_pre_condition: 1,
- condition_type: 1,
- condition_relation: 2,
- detail_status: 1,
- condition_content: [
- {
- param1: '',
- param2: '',
- param2_object: null, // 添加这个字段存储对象选择
- condition: '包含',
- categoryType: '文本',
- sx_1: '',
- sx_2: '',
- sx_3: '',
- subtract_param: '',
- subtract_condition: '',
- subtract_value: '',
- subtract_value_type: 'number',
- hasChildOptions: false,
- childOptions: []
- }
- ]
- })
- },
- // 删除前置条件大框
- onDeleteQZTJ(index) {
- this.ruleForm.qztj.splice(index, 1)
- },
- // 新增前置条件大框中_条件
- onAddTJ(index, sIndex) {
- this.ruleForm.qztj[index].condition_content.push({
- param1: '',
- param2: '',
- param2_object: null, // 添加这个字段存储对象选择
- condition: '包含',
- categoryType: 'text',
- sx_1: '',
- sx_2: '',
- sx_3: '',
- subtract_param: '',
- subtract_condition: '',
- subtract_value: '',
- subtract_value_type: 'number',
- hasChildOptions: false,
- childOptions: []
- })
- },
- // 删除前置条件大框中_条件
- onDeleteTJ(index, sIndex) {
- this.ruleForm.qztj[index].condition_content.splice(sIndex, 1)
- },
- // 新增质控逻辑大框中_逻辑
- onAddGZ(index, sIndex) {
- this.ruleForm.rule[index].condition_content.push({
- param1: '',
- param2: '',
- delete_field: '',
- param2_object: null, // 添加这个字段存储对象选择
- condition: '包含',
- subtract_param: '',
- subtract_condition: '',
- subtract_value: '',
- subtract_value_type: 'number',
- hasChildOptions: false,
- childOptions: [],
- // 病程记录关联
- pn_param1_BLBH: '',
- pn_param1: [],
- pn_param2: '',
- pn_param3: [],
- pn_param4_index: [],
- pn_param4_condition1: '',
- pn_param4_condition2: '',
- pn_param4_kssj: [],
- pn_param4_jssj: [],
- pn_param4_sjjg: '',
- pn_param5: '',
- pn_param6: [],
- pn_param6_ct: '',
- pn_param6_oct: '',
- // 时效
- sx_param1: [],
- sx_param2: '',
- sx_param3: [],
- sx_param4_index: [],
- sx_param4_kssj: [],
- sx_param4_jssj: [],
- sx_param4_condition1: '',
- sx_param4_condition2: '',
- sx_param4_sjjg: ''
- })
- },
- // 删除质控逻辑大框中_逻辑
- onDeleteGZ(index, sIndex) {
- this.ruleForm.rule[index].condition_content.splice(sIndex, 1)
- },
- // 添加质控依据
- onAddZKYJ() {
- this.ruleForm.rule[0].custom_basis = this.ruleForm.rule[0].custom_basis ? this.ruleForm.rule[0].custom_basis : []
- this.ruleForm.rule[0].custom_basis.push({
- param1: '',
- input1: '',
- input2: ''
- })
- },
- // 删除质控依据大框
- onDeleteZKYJ(index) {
- this.ruleForm.rule[0].custom_basis = []
- },
- // 新增质控依据大框中_条件
- onAddTJZKYJ(index, sIndex) {
- this.ruleForm.rule[index].custom_basis.push({
- param1: '',
- input1: '',
- input2: ''
- })
- },
- // 删除质控依据大框中_条件
- onDeleteTJZKYJ(index, sIndex) {
- this.ruleForm.rule[index].custom_basis.splice(sIndex, 1)
- },
- // 添加质控预警
- onAddZKyujing() {
- this.ruleForm.rule[0].custom_msg = {
- aftertime: '',
- param1: '',
- input1: '',
- input2: ''
- }
- },
- // 删除质控预警大框
- onDeleteZKyujing(index) {
- this.ruleForm.rule[0].custom_msg = {}
- },
- hasEmptyValues(obj) {
- return Object.entries(obj).some(([key, value]) => {
- // 如果是数组(多选的情况),检查数组长度
- if (Array.isArray(value)) {
- return value.length === 0
- }
- // 其他情况保持原有的空值判断
- return !value
- })
- },
- // 验证前置条件
- judgeQZTJ() {
- const { qztj } = this.ruleForm
- let result = true
- const e_index = []
- console.log('>>>>>>>>>>', qztj)
- if (qztj.length) {
- for (let i = 0; i < qztj.length; i++) {
- qztj[i].condition_content.forEach(item => {
- // 检查必填项
- // const isEmpty = !item.param1 ||
- // (Array.isArray(item.param2) ? item.param2.length === 0 : !item.param2) ||
- // !item.condition
- // 检查必填项
- const isEmpty = !item.param1 || !item.condition
- if (isEmpty) {
- e_index.push(i + 1)
- }
- })
- }
- if (e_index.length) {
- this.$message.error(`请完善前置条件${e_index.join()}`)
- result = false
- }
- }
- return result
- },
- // 验证质控逻辑
- judgeRule() {
- const { rule } = this.ruleForm
- let result = true
- // 质控逻辑只有一条
- rule[0].condition_content.map(item => {
- console.log(item)
- if (this.hasEmptyValues(item)) {
- this.$message.error(`请完善质控逻辑`)
- result = false
- }
- })
- return result
- },
- submitForm(formName) {
- this.$refs[formName].validate(async(valid) => {
- if (valid) {
- if (this.judgeQZTJ()) {
- const processConditionContent = (content) => {
- const contentArr = []
- content.forEach(item => {
- const element = { ...item }
- if (element.condition === '病程记录关联') {
- const elementParams = {
- param1: [
- Array.isArray(element.pn_param1) && !!(element.pn_param1.length) ? element.pn_param1[0] : '',
- Array.isArray(element.pn_param1) && !!(element.pn_param1.length) ? element.pn_param1[1] : '',
- element.pn_param1_BLBH
- ],
- param2: element.pn_param2,
- condition: element.condition,
- param3: [
- Array.isArray(element.pn_param3) && !!(element.pn_param3.length) ? element.pn_param3[0] : '',
- Array.isArray(element.pn_param3) && !!(element.pn_param3.length) ? element.pn_param3[1] : ''
- ],
- param4: [
- {
- kssj: element.pn_param4_kssj.join('.'),
- jssj: element.pn_param4_jssj.join('.'),
- sjjg: element.pn_param4_sjjg,
- index: element.pn_param4_index.join('.'),
- condition1: element.pn_param4_condition1,
- condition2: element.pn_param4_condition2
- }
- ],
- param5: element.pn_param5,
- param6: [
- element.pn_param6.join('.'),
- element.pn_param6_ct,
- element.pn_param6_oct
- ]
- }
- contentArr.push(elementParams)
- } else if (element.condition === '时效') {
- const elementParams = {
- param1: [
- Array.isArray(element.sx_param1) && !!(element.sx_param1.length) ? element.sx_param1[0] : '',
- Array.isArray(element.sx_param1) && !!(element.sx_param1.length) ? element.sx_param1[1] : ''
- ],
- param2: element.sx_param2,
- condition: element.condition,
- param3: [
- Array.isArray(element.sx_param3) && !!(element.sx_param3.length) ? element.sx_param3[0] : '',
- Array.isArray(element.sx_param3) && !!(element.sx_param3.length) ? element.sx_param3[1] : ''
- ],
- param4: [
- {
- kssj: element.sx_param4_kssj.join('.'),
- jssj: element.sx_param4_jssj.join('.'),
- sjjg: element.sx_param4_sjjg,
- index: element.sx_param4_index.join('.'),
- condition1: element.sx_param4_condition1,
- condition2: element.sx_param4_condition2
- }
- ]
- }
- contentArr.push(elementParams)
- } else {
- // 处理多选值
- if (Array.isArray(element.param2)) {
- element.param2 = element.param2.join(',')
- }
- if (element.condition === '减' && element.subtract_param) {
- // 组合减法条件的完整表达式
- const subtractValue = this.getDisplayName(element.subtract_param)
- if (subtractValue) {
- // 获取父级字段名
- const [parentField] = element.subtract_param
- // 构造 param2 格式: parentField.field
- element.param2 = `${parentField}.${element.subtract_param[1]}`
- }
- }
- // 对重复率条件的特殊处理
- if (element.condition === '重复率') {
- // 确保param2格式正确
- if (element.param2_object && Array.isArray(element.param2_object)) {
- const [field1, field2] = element.param2_object
- element.param2 = `${field1}.${field2}`
- }
- // 确保subtract_value是数字格式
- if (element.subtract_value !== undefined) {
- element.subtract_value = Number(element.subtract_value)
- }
- }
- contentArr.push(element)
- }
- })
- return contentArr
- }
- // 处理前置条件和质控逻辑中的减法条件
- this.ruleForm.qztj.forEach(item => {
- processConditionContent(item.condition_content)
- })
- console.log('=============this.ruleForm', this.ruleForm.rule)
- const rules = []
- this.ruleForm.rule.forEach(item => {
- rules.push({
- ...item,
- condition_content: processConditionContent(item.condition_content)
- })
- })
- // 继续原有的提交逻辑
- const params = {
- case_type: this.ruleForm.case_type,
- changjing: this.ruleForm.changjing,
- department: this.ruleForm.department,
- object: this.ruleForm.object,
- type: this.ruleForm.type,
- is_not: this.ruleForm.is_not,
- description: this.ruleForm.description,
- score: this.ruleForm.score,
- error_level: this.ruleForm.error_level,
- status: this.ruleForm.status,
- rule_type: this.ruleForm.rule_type,
- rule: [...rules, ...this.ruleForm.qztj]
- }
- console.log('>>>>>>>>>>>>>>>>>>>>', params)
- if (this.data.row.id) {
- params.id = this.data.row.id
- }
- add_rule(params).then(res => {
- this.data.bSwitch = false
- this.$emit('refresh')
- this.$message.success(res.m || '操作成功')
- })
- }
- } else {
- return false
- }
- })
- },
- openCategoryDialog(index, sIndex, source) {
- this.currentRuleIndex = index
- this.currentConditionIndex = sIndex
- this.currentSource = source
- // 判断来源类型
- if (source === 'qztj') {
- this.currentInputSource = 'qztj'
- } else if (source === 'rule') {
- this.currentInputSource = 'rule'
- } else if (source === 'sx_1' || source === 'sx_2') {
- // 需要判断是在前置条件还是质控逻辑中调用的
- const parentElement = document.activeElement.closest('.box-card')
- if (parentElement && parentElement.querySelector('.box-card_header span')?.textContent.includes('前置条件')) {
- this.currentInputSource = 'qztj'
- } else {
- this.currentInputSource = 'rule'
- }
- this.currentSource = source // 保持原有的 source 值
- }
- // 设置默认显示
- if (this.objects.length > 0) {
- this.activeCategory = this.objects[0].field_name
- this.currentSubCategories = this.objects[0].child || []
- }
- this.categoryDialogVisible = true
- this.selectedCategory = null
- },
- handleSearch(value) {
- // 搜索功能已通过 computed 属性实现
- },
- confirmCategory() {
- if (this.selectedCategory) {
- // 更新对应条件的类目
- this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex].category = this.selectedCategory
- // 可能还需要更新显示的文本
- const selectedItem = this.categories.find(item => item.value === this.selectedCategory)
- this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex].param2 =
- selectedItem ? selectedItem.label : ''
- }
- this.categoryDialogVisible = false
- },
- // 点击左侧类目
- handleCategoryClick(item) {
- console.log('>>>>>>>>>>>>>>>>>>>>>', item)
- this.activeCategory = item.name
- this.currentSubCategories = item.child || []
- },
- // 选择右侧子类目
- handleSubCategorySelect(subItem) {
- if (this.currentRuleIndex !== null && this.currentConditionIndex !== null) {
- const parentObj = this.objects.find(obj => obj.field_name === this.activeCategory)
- const parentField = parentObj ? parentObj.field : ''
- if (this.currentSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.param1 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- condition.categoryTypeDisabled = false
- // 检查子数据类型
- if (subItem.type === 2 && subItem.child && subItem.child.length > 0) {
- const dictData = subItem.child.find(item => item.type === 4)
- if (dictData) {
- condition.hasChildOptions = true
- condition.categoryType = '选择'
- condition.categoryTypeDisabled = true // 重置禁用标志
- // type=4 的情况,获取字典数据
- get_dict_by_type({
- table: dictData.field,
- field: dictData.field_name
- }).then(res => {
- if (res?.p) {
- // 转换数据格式
- condition.childOptions = res.p.map(item => ({
- field: item.dep_name,
- field_name: item.dep_name
- }))
- }
- })
- } else if (subItem.child.some(item => item.type === 3)) {
- // type=3 的情况,直接使用 child 数据
- condition.hasChildOptions = true
- condition.childOptions = subItem.child
- condition.categoryType = '选择' // 设置为选择类型
- condition.categoryTypeDisabled = true // 添加禁用标志
- } else {
- // 没有子数据时重置标志
- condition.categoryTypeDisabled = false
- condition.hasChildOptions = false
- }
- }
- }
- } else if (this.currentSource === 'rule') {
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.param1 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- condition.categoryTypeDisabled = false
- if (subItem.type === 2 && subItem.child && subItem.child.length > 0) {
- const dictData = subItem.child.find(item => item.type === 4)
- if (dictData) {
- condition.hasChildOptions = true
- condition.categoryType = '选择'
- condition.categoryTypeDisabled = true // 重置禁用标志
- get_dict_by_type({
- table: dictData.field,
- field: dictData.field_name
- }).then(res => {
- if (res?.p) {
- condition.childOptions = res.p.map(item => ({
- field: item.dep_name,
- field_name: item.dep_name
- }))
- }
- })
- } else if (subItem.child.some(item => item.type === 3)) {
- // type=3 的情况,直接使用 child 数据
- condition.hasChildOptions = true
- condition.childOptions = subItem.child
- condition.categoryType = '选择' // 设置为选择类型
- condition.categoryTypeDisabled = true // 添加禁用标志
- } else {
- // 没有子数据时重置标志
- condition.categoryTypeDisabled = false
- condition.hasChildOptions = false
- }
- }
- }
- } else if (this.currentSource === 'sx_1') {
- if (this.currentInputSource === 'qztj') {
- // 前置条件的时效
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.sx_1 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- }
- } else {
- // 质控逻辑的时效
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.sx_1 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- }
- }
- } else if (this.currentSource === 'sx_2') {
- if (this.currentInputSource === 'qztj') {
- // 前置条件的时效
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.sx_2 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- this.$set(condition, 'sx_3', '') // 确保 sx_3 是响应式的
- }
- } else {
- // 质控逻辑的时效
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.sx_2 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- this.$set(condition, 'sx_3', '') // 确保 sx_3 是响应式的
- }
- }
- } else if (this.currentSource === 'rule') {
- // 质控逻辑
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.param1 = [parentField, subItem.field]
- condition.field_name = subItem.field_name
- // 检查是否有 type=4 的子数据
- if (subItem.type === 2 && subItem.child && subItem.child.length > 0) {
- const dictData = subItem.child.find(item => item.type === 4)
- if (dictData) {
- condition.hasChildOptions = true
- // type=4 的情况,获取字典数据
- get_dict_by_type({
- table: dictData.field,
- field: dictData.field_name
- }).then(res => {
- if (res?.p) {
- // 转换数据格式
- condition.childOptions = res.p.map(item => ({
- field: item.dep_name,
- field_name: item.dep_name
- }))
- }
- })
- } else if (subItem.child.some(item => item.type === 3)) {
- // type=3 的情况,直接使用 child 数据
- condition.hasChildOptions = true
- condition.childOptions = subItem.child
- }
- }
- }
- } else if (this.currentSource === 'custom_basis') {
- // 质控依据
- const basis = this.ruleForm.rule[this.currentRuleIndex].custom_basis[this.currentConditionIndex]
- if (basis) {
- basis.param1 = [parentField, subItem.field]
- basis.field_name = subItem.field_name
- }
- } else if (this.currentSource === 'custom_msg') {
- // 预警
- const msg = this.ruleForm.rule[this.currentRuleIndex].custom_msg
- if (msg) {
- msg.param1 = [parentField, subItem.field]
- msg.field_name = subItem.field_name
- }
- } else if (this.currentSource === 'subtract') {
- // 处理减法时的第二个类目选择
- if (this.currentInputSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.subtract_param = [parentField, subItem.field]
- }
- } else if (this.currentInputSource === 'rule') {
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.subtract_param = [parentField, subItem.field]
- }
- }
- } else if (this.currentSource === 'param2_object') {
- // 判断是在前置条件还是质控逻辑中
- if (this.currentInputSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- // 存储完整的对象选择,而不只是字段名
- condition.param2_object = [parentField, subItem.field]
- // 同时更新param2为字符串表示形式,用于提交
- condition.param2 = `${parentField}.${subItem.field}`
- }
- } else {
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition.param2_object = [parentField, subItem.field]
- condition.param2 = `${parentField}.${subItem.field}`
- }
- }
- } else if (this.currentSource === 'pn_param1' || this.currentSource === 'pn_param3' || this.currentSource === 'pn_param6' || this.currentSource === 'pn_param4_index' || this.currentSource === 'pn_param4_kssj' || this.currentSource === 'pn_param4_jssj') {
- // 判断是在前置条件还是质控逻辑中
- if (this.currentInputSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- // 存储完整的对象选择,而不只是字段名
- condition.param2_object = [parentField, subItem.field]
- // 同时更新param2为字符串表示形式,用于提交
- condition.param2 = `${parentField}.${subItem.field}`
- }
- } else {
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition[this.currentSource] = [parentField, subItem.field]
- }
- }
- } else if (this.currentSource === 'sx_param1' || this.currentSource === 'sx_param3' || this.currentSource === 'sx_param4_index' || this.currentSource === 'sx_param4_kssj' || this.currentSource === 'sx_param4_jssj') {
- // 判断是在前置条件还是质控逻辑中
- if (this.currentInputSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- // 存储完整的对象选择,而不只是字段名
- condition.param2_object = [parentField, subItem.field]
- // 同时更新param2为字符串表示形式,用于提交
- condition.param2 = `${parentField}.${subItem.field}`
- }
- } else {
- const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
- if (condition) {
- condition[this.currentSource] = [parentField, subItem.field]
- }
- }
- }
- }
- this.categoryDialogVisible = false
- },
- getDisplayName(param1) {
- if (!Array.isArray(param1)) return ''
- const [parentField, childField] = param1
- const parentObj = this.objects.find(obj => obj.field === parentField)
- if (!parentObj) return ''
- const childObj = parentObj.child.find(child => child.field === childField)
- return childObj ? childObj.field_name : ''
- },
- handleInput(value, ruleIndex, index, source = 'custom_basis', fieldsName) {
- if (value && value.endsWith('@')) {
- this.currentInputIndex = index
- this.currentRuleIndexForKnowledge = ruleIndex
- this.currentInputSource = source
- this.knowledgeDialogVisible = true
- this.currentFieldsName = fieldsName
- this.getKnowledgeList()
- }
- },
- handleKnowledgeSelect(item) {
- if (this.currentInputIndex !== null && this.currentRuleIndexForKnowledge !== null) {
- if (this.currentInputSource === 'rule') {
- // 质控逻辑
- const condition = this.ruleForm.rule[this.currentRuleIndexForKnowledge].condition_content[this.currentInputIndex]
- if (condition) {
- // 直接替换整个值,不保留@
- condition.param2 = condition.param2.replace(/@.*$/, item.name)
- }
- } else if (this.currentInputSource === 'qztj') {
- const condition = this.ruleForm.qztj[this.currentRuleIndexForKnowledge].condition_content[this.currentInputIndex]
- if (condition) {
- condition.param2 = condition.param2.replace(/@.*$/, item.name)
- }
- } else if (this.currentInputSource === 'rule_other') {
- const condition = this.ruleForm.rule[this.currentRuleIndexForKnowledge].condition_content[this.currentInputIndex]
- if (condition) {
- // condition[this.currentFieldsName] = condition[this.currentFieldsName].replace(/@.*$/, item.name)
- condition[this.currentFieldsName] = `@${item.name}`
- }
- } else {
- const basis = this.ruleForm.rule[this.currentRuleIndexForKnowledge].custom_basis[this.currentInputIndex]
- if (basis) {
- // 直接替换整个值,不保留@
- basis.input2 = basis.input2.replace(/@.*$/, item.name)
- }
- }
- }
- this.knowledgeDialogVisible = false
- },
- // 获取知识库列表
- async getKnowledgeList() {
- try {
- const res = await get_all_word_map({ status: 1 })
- if (res && res.p) {
- this.knowledgeList = Array.isArray(res.p) ? res.p : []
- }
- } catch (error) {
- console.error('获取知识库列表失败:', error)
- this.$message.error('获取知识库列表失败')
- }
- },
- // 添加质控逻辑
- onAddZKLJ() {
- // 检查是否已存在质控逻辑
- if (this.ruleForm.rule && this.ruleForm.rule.length > 0) {
- this.$message.warning('质控逻辑已存在')
- return
- }
- this.ruleForm.rule = [{
- is_pre_condition: 0,
- condition_type: 1,
- condition_relation: 2,
- detail_status: 1,
- condition_content: [
- {
- param1: '',
- param2: '',
- param2_object: null, // 添加这个字段存储对象选择
- condition: '包含',
- categoryType: 'text',
- sx_1: '',
- sx_2: '',
- sx_3: '',
- subtract_param: '',
- subtract_condition: '',
- subtract_value: '',
- subtract_value_type: 'number',
- hasChildOptions: false,
- childOptions: []
- }
- ],
- custom_basis: [],
- pre_warning_time: '',
- custom_msg: {}
- }]
- },
- // 查看知识库详情
- handleKnowledgeView(row) {
- this.currentKnowledge = {
- ...row,
- keywords: row.keywords || '',
- BZMC: row.BZMC || ''
- }
- this.editKnowledge.name = row.name
- this.knowledgeDetailVisible = true
- },
- // 获取比较公式数据
- getCompareFormula() {
- getSelectFormula({ lx: 1 }).then(res => {
- const { p } = res
- console.log('compare formula:', p)
- this.compareFormula = p
- })
- },
- // 获取类型数据
- getCategories() {
- getSelectFormula({ lx: 1 }).then(res => {
- const { p } = res
- console.log('categories:', p)
- // 转换数据格式
- this.categories = p.map(item => ({
- label: item.formula,
- value: item.formula // 或者使用 id,取决于后端需要的格式
- }))
- })
- },
- // 获取完整的请求参数
- getFullParams(extraParams = {}) {
- return {
- id: this.currentKnowledge.id,
- name: this.currentKnowledge.name,
- BZMC: this.currentKnowledge.BZMC || '',
- keywords: this.formattedKeywords,
- ...extraParams
- }
- },
- // 显示输入框
- showInput(type) {
- this.inputVisible[type] = true
- this.$nextTick(() => {
- this.$refs[`${type}Input`].focus()
- })
- },
- // 处理输入确认
- handleInputConfirm(type) {
- if (type === 'bzmc') {
- if (this.editKnowledge.bzmc) {
- this.addBzmc()
- }
- } else if (type === 'keyword') {
- if (this.editKnowledge.keyword) {
- this.addKeyword()
- }
- }
- this.inputVisible[type] = false
- },
- // 添加用途
- addBzmc() {
- if (!this.editKnowledge.bzmc) return
- const newBzmc = this.currentKnowledge.BZMC
- ? `${this.currentKnowledge.BZMC},${this.editKnowledge.bzmc}`
- : this.editKnowledge.bzmc
- const params = this.getFullParams({ BZMC: newBzmc })
- edit_word_map(params).then(res => {
- this.$message.success('添加成功')
- this.editKnowledge.bzmc = ''
- this.getKnowledgeDetail(this.currentKnowledge.id)
- })
- },
- // 添加关键词
- addKeyword() {
- if (!this.editKnowledge.keyword) return
- const newKeywords = this.formattedKeywords
- ? `${this.formattedKeywords},${this.editKnowledge.keyword}`
- : this.editKnowledge.keyword
- const params = this.getFullParams({ keywords: newKeywords })
- edit_word_map(params).then(res => {
- this.$message.success('添加成功')
- this.editKnowledge.keyword = ''
- this.getKnowledgeDetail(this.currentKnowledge.id)
- })
- },
- // 处理用途的删除
- handleBzmcClose(index) {
- const bzmc = this.bzmcArray
- bzmc.splice(index, 1)
- const params = this.getFullParams({ BZMC: bzmc.join(',') })
- edit_word_map(params).then(res => {
- this.$message.success('删除成功')
- this.getKnowledgeDetail(this.currentKnowledge.id)
- })
- },
- // 处理关键词的删除
- handleKeywordClose(index) {
- const keywords = this.formattedKeywords.split(',')
- keywords.splice(index, 1)
- const params = this.getFullParams({ keywords: keywords.join(',') })
- edit_word_map(params).then(res => {
- this.$message.success('删除成功')
- this.getKnowledgeDetail(this.currentKnowledge.id)
- })
- },
- // 保存名称
- saveKnowledge() {
- const params = this.getFullParams({ name: this.editKnowledge.name })
- edit_word_map(params).then(res => {
- this.$message.success('保存成功')
- this.knowledgeDetailVisible = false
- // 刷新知识库列表
- this.getKnowledgeList()
- })
- },
- // 获取知识库详情
- getKnowledgeDetail(id) {
- get_all_word_map({ id }).then(res => {
- const { p } = res
- if (Array.isArray(p) && p.length > 0) {
- // 找到对应 id 的数据
- const detail = p.find(item => item.id === id)
- if (detail) {
- this.currentKnowledge = {
- ...detail,
- // 确保 keywords 和 BZMC 有值
- keywords: detail.keywords || '',
- BZMC: detail.BZMC || ''
- }
- // 同步更新编辑框的名称
- this.editKnowledge.name = detail.name
- }
- }
- })
- },
- // 获取下拉数据
- async getDropdownData() {
- try {
- // 获取病历类型
- const caseTypeRes = await get_rule_setting_other({ type: 1 })
- if (caseTypeRes?.p) {
- this.caseTypeOptions = caseTypeRes.p.map(item => ({
- value: item.name, // 使用 name 作为 value
- label: item.name // 使用 name 作为 label
- }))
- }
- // 获取质控类型
- const qualityTypeRes = await get_rule_setting_other({ type: 2 })
- if (qualityTypeRes?.p) {
- this.qualityTypeOptions = qualityTypeRes.p.map(item => ({
- value: item.name,
- label: item.name
- }))
- }
- // 获取质控场景
- const sceneRes = await get_rule_setting_other({ type: 3 })
- if (sceneRes?.p) {
- this.sceneOptions = sceneRes.p.map(item => ({
- value: item.name,
- label: item.name
- }))
- }
- } catch (error) {
- console.error('获取下拉数据失败:', error)
- this.$message.error('获取下拉数据失败')
- }
- },
- openChildOptionsDialog(index, sIndex) {
- const currentItem = this.ruleForm[this.currentInputSource][index].condition_content[sIndex]
- if (currentItem.param1 && Array.isArray(currentItem.param1)) {
- const [parentField, field] = currentItem.param1
- const category = this.objects.find(item => item.field === parentField)
- const subCategory = category?.child?.find(item => item.field === field)
- if (subCategory?.child && subCategory.child.length > 0) {
- this.currentChildOptions = subCategory.child
- this.currentRuleIndex = index
- this.currentConditionIndex = sIndex
- // this.currentInputSource = source
- this.childOptionsDialogVisible = true
- }
- }
- },
- handleChildOptionSelect(option) {
- const condition = this.ruleForm[this.currentInputSource][this.currentRuleIndex].condition_content[this.currentConditionIndex]
- condition.param2 = option.field_name
- this.childOptionsDialogVisible = false
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-col-15 {
- .el-form-item__label {
- width: 160px !important;
- }
- }
- .box-card {
- margin-bottom: 16px;
- }
- ::v-deep .el-card__header {
- padding: 0;
- .box-card_header {
- background: #F7F7F8;
- padding: 0 20px;
- line-height: 40px;
- }
- }
- ::v-deep .el-card__body {
- padding: 20px 12px;
- }
- .text-right {
- text-align: right;
- }
- .ml40 {
- margin-left: 40px;
- }
- .mb12 {
- margin-bottom: 12px;
- }
- .span {
- padding-top: 40px;
- .text {
- color: #909399;
- }
- }
- .input-with-category {
- display: flex;
- align-items: stretch;
- gap: 0;
- ::v-deep .el-input__inner {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- .category-select {
- ::v-deep .el-input__inner {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- margin-left: -1px;
- padding-left: 25px;
- /* 为图标留出空间 */
- }
- ::v-deep .el-input__prefix {
- left: 5px;
- color: #909399;
- }
- }
- }
- .category-content {
- height: 400px;
- .category-menu {
- height: 100%;
- border-right: 1px solid #e6e6e6;
- }
- .sub-category-list {
- padding: 10px;
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- .el-button {
- margin: 5px;
- }
- }
- }
- .rule-condition {
- position: relative;
- display: flex;
- align-items: center;
- cursor: pointer; // 添加手型光标
- .el-input {
- cursor: pointer;
- ::v-deep .el-input__inner {
- cursor: pointer;
- }
- }
- }
- .knowledge-content {
- max-height: 500px;
- overflow-y: auto;
- }
- .knowledge-detail {
- padding: 20px;
- .detail-item {
- margin-bottom: 20px;
- display: flex;
- align-items: center;
- .label {
- width: 70px;
- line-height: 32px;
- }
- .id-value {
- line-height: 32px;
- padding: 0 15px;
- }
- .el-input {
- flex: 1;
- }
- }
- .tags-input {
- flex: 1;
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 8px;
- .tag-button {
- margin: 0 8px 8px 0;
- padding: 5px 10px;
- height: 28px;
- line-height: 1;
- font-weight: normal;
- position: relative;
- .el-icon-close {
- margin-left: 5px;
- &:hover {
- color: #409eff;
- }
- }
- }
- .tag-input {
- width: 120px;
- margin-right: 8px;
- }
- .el-button {
- margin: 0 8px 8px 0;
- padding: 5px 10px;
- height: 28px;
- line-height: 1;
- font-weight: normal;
- &.is-plain {
- background: #ecf5ff;
- border-color: #d9ecff;
- color: #409eff;
- &:hover {
- background: #ecf5ff;
- border-color: #409eff;
- color: #409eff;
- }
- }
- }
- }
- }
- .button-group {
- display: flex;
- gap: 5px;
- .el-button {
- padding: 7px 8px;
- }
- }
- .knowledge-detail .detail-item {
- margin-bottom: 20px;
- }
- .knowledge-detail .label {
- display: inline-block;
- width: 80px;
- vertical-align: top;
- }
- .input-with-tags {
- display: flex;
- flex-direction: column;
- width: calc(100% - 80px);
- margin-left: 80px;
- margin-top: -20px;
- }
- .tags-container {
- margin-bottom: 10px;
- }
- .tags-container .el-tag {
- margin-right: 10px;
- margin-bottom: 10px;
- }
- .input-container {
- width: 100%;
- }
- .rule-condition {
- .category-select {
- position: absolute;
- right: 0;
- top: 0;
- }
- }
- .child-options-list {
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- padding: 10px;
- }
- .progress-note {
- .el-row {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- }
- .el-col {
- margin-bottom: 10px;
- }
- }
- .grid-container {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 10px;
- .el-tag {
- text-align: center;
- }
- }
- ::v-deep .el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable {
- padding: 0;
- .el-tabs__nav-prev {
- display: none;
- height: 0px;
- }
- .el-tabs__nav-next {
- display: none;
- height: 0;
- }
- }
- </style>
|