inspection.vue 62KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743
  1. <template>
  2. <div class="patient-container">
  3. <patient-sidebar :id="patientID" defaultActive="1-3"></patient-sidebar>
  4. <div
  5. class="patient-app-container app-container"
  6. v-loading="pageLoading"
  7. element-loading-text="拼命加载中"
  8. >
  9. <el-row :gutter="20">
  10. <el-col :span="7">
  11. <el-table
  12. :header-cell-style="{
  13. backgroundColor: 'rgb(245, 247, 250)',
  14. color: '#606266'
  15. }"
  16. :row-style="{ color: '#303133' }"
  17. :data="projects"
  18. border
  19. style="width: 100%"
  20. highlight-current-row
  21. @current-change="handleCurrentChange"
  22. ref="singleTable"
  23. >
  24. <el-table-column label="检验检查项目" align="center">
  25. <el-table-column
  26. prop="project_name"
  27. label="检验项目"
  28. align="center"
  29. >
  30. </el-table-column>
  31. <el-table-column
  32. prop="count"
  33. label="次数"
  34. width="80"
  35. align="center"
  36. >
  37. </el-table-column>
  38. </el-table-column>
  39. </el-table>
  40. </el-col>
  41. <el-col :span="17" v-loading="itemLoading">
  42. <div class="filter-container" style="float:right">
  43. <el-button
  44. size="small"
  45. class="filter-item"
  46. type="primary"
  47. @click="setRemindDialog()"
  48. v-if="project && project.project_id != 14"
  49. icon="el-icon-circle-plus-outline"
  50. :disabled="project ? false : true"
  51. >设置提醒弹窗
  52. </el-button>
  53. <el-button
  54. size="small"
  55. class="filter-item"
  56. type="primary"
  57. @click="setRemind()"
  58. v-if="project && project.project_id != 14"
  59. icon="el-icon-circle-plus-outline"
  60. :disabled="project ? false : true"
  61. >设置提醒周期
  62. </el-button>
  63. <el-button
  64. size="small"
  65. class="filter-item"
  66. type="primary"
  67. @click="openPic()"
  68. icon="el-icon-circle-plus-outline"
  69. :disabled="project ? false : true"
  70. >上传图片
  71. </el-button>
  72. <el-button
  73. size="small"
  74. class="filter-item"
  75. type="primary"
  76. @click="openNew()"
  77. icon="el-icon-circle-plus-outline"
  78. :disabled="project ? false : true"
  79. >新增
  80. </el-button
  81. >
  82. <el-button
  83. size="small"
  84. class="filter-item"
  85. type="primary"
  86. icon="el-icon-edit-outline"
  87. @click="openEdit()"
  88. :disabled="itemDate ? false : true"
  89. >修改
  90. </el-button
  91. >
  92. <el-button
  93. size="small"
  94. class="filter-item"
  95. type="danger"
  96. icon="el-icon-delete"
  97. @click="deleteInspection()"
  98. :disabled="itemDate ? false : true"
  99. >删除
  100. </el-button
  101. >
  102. <el-button size="small" class="filter-item" type="primary" icon="el-icon-printer" @click="Printcheck" >
  103. 打印
  104. </el-button>
  105. </div>
  106. <div class="filter-container">
  107. <el-button class="filter-item" type="text" style="color:#000"
  108. >{{ itemName }}
  109. <span v-if="itemDate"
  110. >(检查日期:{{ itemDate }})</span
  111. ></el-button
  112. >
  113. </div>
  114. <div v-if="!isPic">
  115. <el-table
  116. :header-cell-style="{
  117. backgroundColor: 'rgb(245, 247, 250)',
  118. color: '#606266'
  119. }"
  120. :row-style="{ color: '#303133' }"
  121. :data="items"
  122. border=""
  123. style="width: 100%"
  124. id="user-inspection-order"
  125. >
  126. <el-table-column
  127. prop="item_name"
  128. label="检验项目"
  129. align="center"
  130. min-width="180"
  131. >
  132. <template slot-scope="scope">
  133. <span v-if="scope.row.item_name!=''"> {{ scope.row.item_name }} {{ scope.row.item_name_addition }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. prop="name"
  138. label="结果"
  139. align="center"
  140. min-width="80"
  141. >
  142. <template slot-scope="scope">
  143. <div v-if="items[0].value.indexOf('http') < 0">
  144. <span v-if="scope.row.range_type == 2">
  145. <span v-if="scope.row.value=='阳性'" style="color: red"> {{ scope.row.value }}</span>
  146. <span v-else> {{ scope.row.value }}</span>
  147. </span>
  148. <span v-if="scope.row.range_type == 1">
  149. <span v-if="parseFloat(scope.row.value) < parseFloat(getrange(scope.row.range_min)) ">
  150. {{ scope.row.value }} <span style="color: blue;" v-if="scope.row.value>0">↓</span>
  151. </span>
  152. <span v-else-if="parseFloat(getrange(scope.row.range_min))<= parseFloat( scope.row.value) && parseFloat(scope.row.value)<= parseFloat(getrange(scope.row.range_max)) ">
  153. {{ scope.row.value }}
  154. </span>
  155. <span v-else-if="parseFloat(scope.row.value) >parseFloat(getrange(scope.row.range_max)) ">
  156. {{ scope.row.value }} <span style="color: red;" v-if="scope.row.value>0">↑</span>
  157. </span>
  158. <span v-else-if ="scope.row.range_max ==''||scope.row.range_min ==''">
  159. {{ scope.row.value }}
  160. </span>
  161. <span v-else>{{ scope.row.value }}</span>
  162. </span>
  163. <!-- <span v-if="scope.row.value =='阳性'" style="color:red">{{ scope.row.value }}</span> -->
  164. <!-- <span v-else>{{ scope.row.value }}</span> -->
  165. <!-- <span v-if="scope.row.range_type == 1">
  166. {{ scope.row.value_direction }}
  167. </span> -->
  168. </div>
  169. <div v-else>
  170. <img :src="scope.row.value">
  171. </div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. prop="address"
  176. label="参考值"
  177. align="center"
  178. min-width="120"
  179. >
  180. <template slot-scope="scope">
  181. <div v-if="items[0].value.indexOf('http') < 0">
  182. <span v-if="scope.row.range_type == 1"
  183. >{{ scope.row.range_min }}~{{ scope.row.range_max }}</span
  184. >
  185. <span v-else>{{ scope.row.range_value }}</span>
  186. </div>
  187. </template>
  188. </el-table-column>
  189. <el-table-column
  190. prop="111"
  191. label="单位"
  192. align="center"
  193. min-width="80"
  194. >
  195. <template slot-scope="scope">
  196. <div v-if="items[0].value.indexOf('http') < 0">
  197. <span>{{ scope.row.unit }}</span>
  198. </div>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. </div>
  203. <div v-else>
  204. <el-row>
  205. <template v-for="(item, index) in items">
  206. <el-col :span="7" :key="index">
  207. <div style=" margin: 5px;">
  208. <el-row :gutter="20">
  209. <el-col :span="8" style="width: 100%;">
  210. <div style="width: 100%;height: 150px;" >
  211. <div @click="imgClicks(item.value)">
  212. <el-tooltip
  213. class="item"
  214. effect="dark"
  215. :hide-after="2000"
  216. content="点击查看大图"
  217. placement="top-start"
  218. >
  219. <img style="width: 300px;height: 150px;" :src="item.value" alt="">
  220. </el-tooltip>
  221. </div>
  222. </div>
  223. </el-col>
  224. </el-row>
  225. <el-row>
  226. <div style="word-break: break-all;word-wrap: break-word; text-align:center">{{item.item_name}}</div>
  227. </el-row>
  228. </div>
  229. </el-col>
  230. </template>
  231. </el-row>
  232. </div>
  233. <el-pagination
  234. align="right"
  235. @current-change="handleCurrentChangePage"
  236. :current-page="queryParams.page"
  237. :page-size="1"
  238. background
  239. style="margin-top:20px;"
  240. layout="total, prev, pager, next, jumper"
  241. :total="total"
  242. >
  243. </el-pagination>
  244. <div style="display: none">
  245. <div id="print_content">
  246. <div style="text-align: center;border-bottom: 1px solid black;">
  247. <h1>检验报告</h1>
  248. </div>
  249. <div style="display: flex;margin: 10px 0;">
  250. <div style="flex: 1;">姓名:{{ patient.name }}</div>
  251. <div style="flex: 1;">性别:{{ patient.gender ==1 ? '男' : '女' }}</div>
  252. <div style="flex: 1;">年龄:{{ patient.age }}
  253. <!-- <span v-if="getAge(patient)>200">
  254. {{ patient.age }}
  255. </span>
  256. <span v-else>
  257. {{ getAge(patient) }}
  258. </span> -->
  259. </div>
  260. </div>
  261. <table class="checktable" border="1" style="border-collapse: collapse;width: 100%;border-left: 0;border-right: 0;">
  262. <thead>
  263. <tr style="padding: 5px 0;border-top:1px solid black ;border-bottom:1px solid black ;">
  264. <th width="150">项目</th>
  265. <th width="80">结果</th>
  266. <th width="50">提示</th>
  267. <th width="100">单位</th>
  268. <th width="100">参考区间</th>
  269. </tr>
  270. </thead>
  271. <tbody>
  272. <tr v-for="(item,index) in items" :key="index">
  273. <td width="150">{{ item.item_name }} {{ item.item_name_addition }}</td>
  274. <td width="80">
  275. <div>
  276. <span v-if="item.range_type == 2">
  277. <span v-if="item.value=='阳性'" style="color: red"> {{ item.value }}</span>
  278. <span v-else> {{ item.value }}</span>
  279. </span>
  280. <span v-if="item.range_type == 1">
  281. <span v-if="parseFloat(item.value) < parseFloat(getrange(item.range_min)) ">
  282. {{ item.value }}
  283. </span>
  284. <span v-if="parseFloat(getrange(item.range_min))<= parseFloat( item.value) && parseFloat(item.value)<= parseFloat(getrange(item.range_max)) ">
  285. {{ item.value }}
  286. </span>
  287. <span v-if="parseFloat(item.value) >parseFloat(getrange(item.range_max)) ">
  288. {{ item.value }}
  289. </span>
  290. <span v-if ="item.range_max ==''||item.range_min ==''">
  291. {{ item.value }}
  292. </span>
  293. </span>
  294. </div>
  295. </td>
  296. <td width="50">
  297. <span v-if="item.range_type == 1">
  298. <span v-if="parseFloat(item.value) < parseFloat(getrange(item.range_min)) ">
  299. <span v-if="item.value>0">↓</span>
  300. </span>
  301. <span v-if="parseFloat(item.value) >parseFloat(getrange(item.range_max)) ">
  302. <span v-if="item.value>0">↑</span>
  303. </span>
  304. </span>
  305. </td>
  306. <td width="100">{{ item.unit }}</td>
  307. <td width="100">{{ item.range_min }}~{{ item.range_max }}</td>
  308. </tr>
  309. </tbody>
  310. </table>
  311. </div>
  312. </div>
  313. </el-col>
  314. </el-row>
  315. </div>
  316. <el-dialog
  317. :title="formTitle"
  318. :visible.sync="dialogRemindFormVisible"
  319. width="1000px"
  320. id="user-inspection-form"
  321. >
  322. <el-form :model="form" ref="form" label-position="top">
  323. <el-row>
  324. <el-col :span="24">
  325. <el-form-item label="周期提醒: ">
  326. <el-radio-group v-model="temp_remind_cycle">
  327. <el-radio :label="1">一月一次</el-radio>
  328. <el-radio :label="2">两月一次</el-radio>
  329. <el-radio :label="3">三月一次</el-radio>
  330. <el-radio :label="4">半年一次</el-radio>
  331. <el-radio :label="5">一年一次</el-radio>
  332. </el-radio-group>
  333. </el-form-item>
  334. </el-col>
  335. <!-- <el-col :span="24">-->
  336. <!-- <p style="margin-top:20px;">是否弹窗提醒:-->
  337. <!-- <el-switch v-model="is_open"></el-switch>-->
  338. <!-- </p>-->
  339. <!-- </el-col>-->
  340. </el-row>
  341. </el-form>
  342. <div slot="footer" class="dialog-footer">
  343. <el-button @click="dialogRemindFormVisible = false">取 消</el-button>
  344. <el-button
  345. type="primary"
  346. @click="submitNewRemind()"
  347. >保 存
  348. </el-button
  349. >
  350. </div>
  351. </el-dialog>
  352. <el-dialog
  353. :visible.sync="dialogRemindDialogFormVisible"
  354. width="1000px"
  355. id="user-inspection-form"
  356. >
  357. <el-col :span="24">
  358. <p style="margin-top:20px;">是否弹窗提醒:
  359. <el-switch v-model="is_open"></el-switch>
  360. </p>
  361. </el-col>
  362. <div slot="footer" class="dialog-footer">
  363. <el-button @click="dialogRemindDialogFormVisible = false">取 消</el-button>
  364. <el-button
  365. type="primary"
  366. @click="submitRemindDialog()"
  367. >保 存
  368. </el-button
  369. >
  370. </div>
  371. </el-dialog>
  372. <!-- 新增 -->
  373. <el-dialog
  374. :title="formTitle"
  375. :visible.sync="dialogFormVisible"
  376. width="1000px"
  377. id="user-inspection-form"
  378. v-loading="formLoading"
  379. >
  380. <el-form :model="form" ref="form" label-position="top">
  381. <el-row>
  382. <el-col :span="24" v-if="form.formItem[0].project_id == 14">
  383. <el-form-item label="传染病周期提醒: ">
  384. <el-radio-group v-model="form.remind_cycle">
  385. <el-radio :label="1">一月一次</el-radio>
  386. <el-radio :label="2">两月一次</el-radio>
  387. <el-radio :label="3">三月一次</el-radio>
  388. <el-radio :label="4">半年一次</el-radio>
  389. <el-radio :label="5">一年一次</el-radio>
  390. </el-radio-group>
  391. </el-form-item>
  392. </el-col>
  393. <el-col :span="7">
  394. <el-form-item
  395. label="检验日期"
  396. prop="inspect_date"
  397. :rules="[
  398. { required: true, message: '请输入检验日期', trigger: 'blur' }
  399. ]"
  400. >
  401. <el-date-picker
  402. style="width:95%"
  403. v-model="form.inspect_date"
  404. type="datetime"
  405. value-format="yyyy-MM-dd HH:mm"
  406. format="yyyy-MM-dd HH:mm"
  407. placeholder="选择日期"
  408. >
  409. </el-date-picker>
  410. </el-form-item>
  411. </el-col>
  412. <el-col :span="1">&nbsp;</el-col>
  413. <template v-for="(item, index) in form.formItem">
  414. <el-col :span="7" :key="index">
  415. <el-form-item
  416. :label="item.item_name"
  417. v-if="item.range_type == 1"
  418. :key="item.item_id"
  419. :prop="'formItem.' + index + '.value'"
  420. >
  421. <el-input
  422. placeholder="请填入"
  423. v-model="item.value"
  424. style="width:95%"
  425. @input='changeInput(item)'
  426. >
  427. <template slot="append">{{ item.unit }}</template>
  428. </el-input>
  429. </el-form-item>
  430. <el-form-item
  431. :label="item.item_name"
  432. v-else
  433. :key="item.item_id"
  434. :prop="'formItem.' + index + '.value'"
  435. >
  436. <el-select
  437. v-model="item.value"
  438. placeholder="请选择"
  439. style="width:95%"
  440. >
  441. <el-option
  442. v-for="(optionItem, oidex) in item.select_options"
  443. :key="oidex"
  444. :label="optionItem"
  445. :value="optionItem"
  446. >
  447. </el-option>
  448. </el-select>
  449. </el-form-item>
  450. </el-col>
  451. <el-col :span="1" :key="'form-col' + index">&nbsp;</el-col>
  452. </template>
  453. </el-row>
  454. </el-form>
  455. <div slot="footer" class="dialog-footer">
  456. <el-button @click="dialogFormVisible = false">取 消</el-button>
  457. <el-button
  458. type="primary"
  459. v-if="form.method == 'add'"
  460. @click="submitNew('form')"
  461. >保 存
  462. </el-button
  463. >
  464. <el-button type="primary" v-else @click="submitEdit('form')"
  465. >保 存
  466. </el-button
  467. >
  468. </div>
  469. </el-dialog>
  470. <!-- 上传图片弹窗 -->
  471. <el-dialog
  472. :title="formTitle"
  473. :visible.sync="dialogPicFormVisible"
  474. width="1000px"
  475. id="user-inspection-form"
  476. >
  477. <el-form :model="form" ref="form" label-position="top">
  478. <el-row>
  479. <el-col :span="7">
  480. <el-form-item
  481. label="检验日期"
  482. prop="inspect_date"
  483. :rules="[
  484. { required: true, message: '请输入检验日期', trigger: 'blur' }
  485. ]"
  486. >
  487. <el-date-picker
  488. style="width:95%"
  489. v-model="form.inspect_date"
  490. type="datetime"
  491. value-format="yyyy-MM-dd HH:mm"
  492. format="yyyy-MM-dd HH:mm"
  493. placeholder="选择日期"
  494. >
  495. </el-date-picker>
  496. </el-form-item>
  497. </el-col>
  498. </el-row>
  499. <el-row>
  500. <template v-for="(item, index) in form.imgs">
  501. <el-col :span="5" >
  502. <div>
  503. <el-row>
  504. <img width="100px" :src="item.img_url" alt="">
  505. </el-row>
  506. <el-row>
  507. <el-input v-model="item.desc" style="width: 100px"></el-input>
  508. </el-row>
  509. <el-row>
  510. <el-button
  511. type="danger"
  512. @click="deletePic(item,index)"
  513. >删除
  514. </el-button>
  515. </el-row>
  516. </div>
  517. </el-col>
  518. <el-col :span="1" :key="'form-col' + index">&nbsp;</el-col>
  519. </template>
  520. </el-row>
  521. </el-form>
  522. <div slot="footer" class="dialog-footer">
  523. <el-upload
  524. :data="uploadData"
  525. :multiple="true"
  526. action="https://upload.qiniup.com"
  527. :show-file-list="false"
  528. :on-error="handleAvatarError"
  529. :on-success="handleAvatarSuccess"
  530. :before-upload="beforeAvatarUpload">
  531. <el-button type="primary">选择文件</el-button>
  532. </el-upload>
  533. <el-button @click="dialogPicFormVisible = false">取 消</el-button>
  534. <el-button
  535. type="primary"
  536. v-if="this.form.pic_method== 'add'"
  537. @click="submitPicNew()"
  538. >保 存
  539. </el-button>
  540. <el-button
  541. type="primary"
  542. v-if="this.form.pic_method == 'edit'"
  543. @click="submitEditPicNew()"
  544. >修 改
  545. </el-button>
  546. </div>
  547. </el-dialog>
  548. <el-image-viewer
  549. v-if="showViewer"
  550. :on-close="closeViewer"
  551. :url-list="imgs"
  552. ></el-image-viewer>
  553. </div>
  554. </template>
  555. <script>
  556. import PatientSidebar from './components/PatientSidebar'
  557. import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
  558. import { getToken } from '@/api/qiniu'
  559. import print from "print-js";
  560. import {
  561. CreatePatientInspection,
  562. CreatePatientPICInspection,
  563. editPatientPICInspection,
  564. DeletePatientInspection,
  565. EditPatientInspection,
  566. fetchInspectionReference,
  567. fetchPatientInspections,
  568. setRemind,
  569. setRemindDialog
  570. } from '@/api/inspection'
  571. import { getFileExtension, uParseTime } from '@/utils/tools'
  572. export default {
  573. name: 'Inspection',
  574. components: { PatientSidebar, ElImageViewer},
  575. data() {
  576. return {
  577. temp_remind_cycle:"",
  578. is_open:false,
  579. record_id:0,
  580. showViewer:false,
  581. imgs:[],
  582. total: 0,
  583. qiniuDomain: 'https://images.shengws.com/',
  584. isPic:false,
  585. uploadData: { token: '', key: '' },
  586. pageLoading: true,
  587. itemLoading: false,
  588. formLoading: false,
  589. itemDate: '',
  590. patientID: 0,
  591. panelClass: 'patient-app-container',
  592. patientInfo: {
  593. id: 0
  594. },
  595. itemName: '请选择项目',
  596. formTitle: '',
  597. dialogRemindFormVisible:false,
  598. dialogRemindDialogFormVisible:false,
  599. dialogPicFormVisible: false,
  600. dialogFormVisible: false,
  601. patient_info: null,
  602. form: {
  603. remind_cycle: '',
  604. method: 'add',
  605. pic_method:'add',
  606. project_id: 0,
  607. inspect_date: '',
  608. old_inspect_date: '',
  609. formItem: [{ id: 0, value: '' }],
  610. imgs: [],
  611. delete_imgs:[],
  612. },
  613. formItem: [],
  614. items: [],
  615. inspections: [],
  616. inspectionsMap: {},
  617. projects: [],
  618. project: null,
  619. queryParams: {
  620. patient: 0,
  621. project_id: 0,
  622. page: 1
  623. },
  624. org_id:0,
  625. patient:{},
  626. }
  627. },
  628. methods: {
  629. imgClicks(val){
  630. console.log('asdasgg',val);
  631. this.imgs = []
  632. this.imgs.push(val)
  633. this.showViewer = true
  634. },
  635. closeViewer(){
  636. this.showViewer = false
  637. },
  638. beforeAvatarUpload(file) {
  639. // const isJPG = file.type === "image/jpeg";
  640. var fileType = file.type
  641. const isJPG = fileType.indexOf('image') > -1
  642. const isLt2M = file.size / 1024 / 1024 < 5
  643. if (!isJPG) {
  644. this.$message.error('只能上传图片')
  645. return false
  646. }
  647. if (!isLt2M) {
  648. this.$message.error('上传头像图片大小不能超过 5MB!')
  649. return false
  650. }
  651. var date = new Date()
  652. var ext = getFileExtension(file.name)
  653. var key =
  654. date.getFullYear() +
  655. '/' +
  656. (date.getMonth() + 1) +
  657. '/' +
  658. date.getDate() +
  659. '/' +
  660. date.getHours() +
  661. '/' +
  662. date.getMinutes() +
  663. '/' +
  664. date.getSeconds() +
  665. '/' +
  666. '_s_' +
  667. file.uid +
  668. '.' +
  669. ext
  670. this.loading = this.$loading({
  671. lock: true,
  672. text: '上传中...',
  673. spinner: 'el-icon-loading',
  674. background: 'rgba(0, 0, 0, 0.7)'
  675. })
  676. const _self = this
  677. return new Promise((resolve, reject) => {
  678. getToken()
  679. .then(response => {
  680. const token = response.data.data.uptoken
  681. _self._data.uploadData.token = token
  682. _self._data.uploadData.key = key
  683. resolve(true)
  684. })
  685. .catch(err => {
  686. console.log(err)
  687. reject(false)
  688. this.loading.close()
  689. })
  690. })
  691. },
  692. handleAvatarError(err, file, fileList) {
  693. this.$message.error(err)
  694. this.loading.close()
  695. return false
  696. },
  697. handleAvatarSuccess(res, file) {
  698. console.log("RESPOWOWOWOWO",res)
  699. console.log("wowowowow",file)
  700. this.form.imgs.push({
  701. img_url: this.qiniuDomain + res.url + '?imageView2/2/w/2000/h/2000/q/90',
  702. desc: '',
  703. id: 0
  704. })
  705. this.loading.close()
  706. },
  707. changeInput(item) {
  708. if (item.item_name == '血清铁' || item.item_name == '总铁结合力') {
  709. let index1 = ''
  710. let index2 = ''
  711. this.form.formItem.map((it, index) => {
  712. if (this.form.formItem[index].item_name == '血清铁') {
  713. index1 = index
  714. }
  715. if (this.form.formItem[index].item_name == '总铁结合力') {
  716. index2 = index
  717. }
  718. if (it.item_name == '转铁蛋白饱和度(计算)') {
  719. it.value = (parseFloat(this.form.formItem[index1].value) / parseFloat(this.form.formItem[index2].value)) * 100
  720. }
  721. })
  722. }
  723. },
  724. deleteInspection() {
  725. if (this.project == null || this.itemDate == '') {
  726. this.$message.error('请先选择删除删除的记录')
  727. return false
  728. }
  729. this.$confirm('确认删除此记录?', '删除', {
  730. confirmButtonText: '确定',
  731. cancelButtonText: '取消',
  732. type: 'warning'
  733. })
  734. .then(() => {
  735. var params = {
  736. patient: this.patientID,
  737. date: this.itemDate,
  738. project_id: this.project.project_id
  739. }
  740. console.log('params',params);
  741. DeletePatientInspection(params).then(response => {
  742. if (response.data.state == 0) {
  743. this.$message.error(response.data.msg)
  744. return false
  745. } else {
  746. this.$notify({
  747. title: '成功',
  748. message: '删除成功',
  749. type: 'success',
  750. duration: 2000
  751. })
  752. for (var index in this.projects) {
  753. if (this.projects[index].project_id == params.project_id) {
  754. this.projects[index].count--
  755. break
  756. }
  757. }
  758. this.total -= 1
  759. this.itemDate = ''
  760. this.items = []
  761. if (this.total > 0) {
  762. this.queryParams.page = 1
  763. this.fetchPatientInspections(this.queryParams)
  764. }
  765. }
  766. })
  767. })
  768. .catch(() => {
  769. })
  770. },
  771. // 打印
  772. Printcheck(){
  773. if (this.project == null || this.itemDate == '') {
  774. this.$message.error('请先选择打印的记录')
  775. return false
  776. }else{
  777. const style='@media print{.checktable tr td,th{border: 0 !important;padding: 5px 0;text-align: center;}}'
  778. printJS({
  779. printable: "print_content",
  780. type: "html",
  781. documentTitle: " ",
  782. style: style,
  783. scanStyles: false,
  784. });
  785. }
  786. },
  787. submitRemindDialog(){
  788. var temp_is_open = 0
  789. if(this.is_open){
  790. temp_is_open = 1
  791. }else{
  792. temp_is_open = 0
  793. }
  794. setRemindDialog(this.record_id,temp_is_open).then(response => {
  795. if (response.data.state == 0) {
  796. this.$message.error(response.data.msg)
  797. return false
  798. } else {
  799. this.record_id = response.data.data.config.id
  800. if(response.data.data.config.is_open == 1){
  801. this.is_open = true
  802. }else{
  803. this.is_open = false
  804. }
  805. this.$notify({
  806. title: '成功',
  807. message: '设置成功',
  808. type: 'success',
  809. duration: 2000
  810. })
  811. this.dialogRemindDialogFormVisible = false
  812. }
  813. })
  814. },
  815. submitNewRemind(){
  816. // console.log(this.is_open)
  817. var params = {
  818. patient: this.patientID,
  819. project_id: this.project.project_id,
  820. remind_cycle: this.temp_remind_cycle
  821. }
  822. setRemind(params).then(response => {
  823. if (response.data.state == 0) {
  824. this.$message.error(response.data.msg)
  825. return false
  826. } else {
  827. this.$notify({
  828. title: '成功',
  829. message: '设置成功',
  830. type: 'success',
  831. duration: 2000
  832. })
  833. this.dialogRemindFormVisible = false
  834. }
  835. })
  836. }, openEdit() {
  837. if (this.project == null) {
  838. this.$message.error('请先选择项目')
  839. return false
  840. }
  841. if(this.isPic){
  842. this.form.pic_method = 'edit'
  843. this.formTitle = '修改' + this.project.project_name
  844. this.form.project_id = this.project.project_id
  845. this.form.inspect_date = this.itemDate
  846. this.form.old_inspect_date = this.itemDate
  847. this.form.imgs = []
  848. this.form.delete_imgs = []
  849. for(var index in this.inspections){
  850. this.form.imgs.push({
  851. id: this.inspections[index].id,
  852. img_url: this.inspections[index].inspect_value,
  853. desc: this.inspections[index].item_name
  854. })
  855. }
  856. console.log(this.form.imgs)
  857. this.dialogPicFormVisible = true
  858. }else{
  859. console.log("22222")
  860. this.form.method = 'edit'
  861. this.formTitle = '修改' + this.project.project_name
  862. this.form.project_id = this.project.project_id
  863. this.form.inspect_date = this.itemDate
  864. this.form.old_inspect_date = this.itemDate
  865. if(this.form.project_id == 14) {
  866. this.form.remind_cycle = this.patient_info.remind_cycle
  867. }else{
  868. this.form.remind_cycle =""
  869. }
  870. console.log(this.form.remind_cycle)
  871. this.form.formItem = []
  872. console.log("hhhhhhhhhhhhh",this.project.inspection_reference)
  873. console.log("inspectionsMap",this.inspectionsMap)
  874. for (var index in this.project.inspection_reference) {
  875. if(this.org_id ==10138){
  876. this.form.formItem.push({
  877. id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
  878. project_id: this.project.inspection_reference[index].project_id,
  879. project_name: this.project.inspection_reference[index].project_name,
  880. item_id: this.project.inspection_reference[index].id,
  881. item: this.project.inspection_reference[index].item,
  882. item_name: this.project.inspection_reference[index].item_name,
  883. range_type: this.project.inspection_reference[index].range_type,
  884. value: this.project.inspection_reference[index].item_id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].item_id].inspect_value : '',
  885. select_options: this.project.inspection_reference[index].range_options.split(','),
  886. unit: this.project.inspection_reference[index].unit,
  887. item_id:parseInt(this.project.inspection_reference[index].item_id) ,
  888. })
  889. }else{
  890. this.form.formItem.push({
  891. id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
  892. project_id: this.project.inspection_reference[index].project_id,
  893. project_name: this.project.inspection_reference[index].project_name,
  894. item_id: this.project.inspection_reference[index].id,
  895. item: this.project.inspection_reference[index].item,
  896. item_name: this.project.inspection_reference[index].item_name,
  897. range_type: this.project.inspection_reference[index].range_type,
  898. value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
  899. select_options: this.project.inspection_reference[index].range_options.split(','),
  900. unit: this.project.inspection_reference[index].unit
  901. })
  902. }
  903. }
  904. console.log('11111',this.form.formItem)
  905. this.dialogFormVisible = true
  906. }
  907. },setRemindDialog(){
  908. this.dialogRemindDialogFormVisible = true
  909. },setRemind(){
  910. this.dialogRemindFormVisible = true
  911. // this.temp_remind_cycle = this.
  912. },
  913. openPic() {
  914. if (this.project == null) {
  915. this.$message.error('请先选择项目')
  916. return false
  917. }
  918. this.form.pic_method = 'add'
  919. this.formTitle = '新增' + this.project.project_name
  920. this.form.project_id = this.project.project_id
  921. this.form.imgs=[]
  922. this.form.delete_imgs=[]
  923. if(this.form.project_id == 14) {
  924. this.form.remind_cycle = this.patient_info.remind_cycle
  925. }
  926. var today = new Date()
  927. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  928. this.form.formItem = []
  929. for (var index in this.project.inspection_reference) {
  930. // var formItem = this.project.inspection_reference[index];
  931. // formItem["value"] = '';
  932. // if (formItem.range_type==2) {
  933. // formItem["select_options"] = formItem.range_options.split(",");
  934. // }
  935. this.form.formItem.push({
  936. id: 0,
  937. project_id: this.project.inspection_reference[index].project_id,
  938. project_name: this.project.inspection_reference[index].project_name,
  939. item_id: this.project.inspection_reference[index].id,
  940. item: this.project.inspection_reference[index].item,
  941. item_name: this.project.inspection_reference[index].item_name,
  942. range_type: this.project.inspection_reference[index].range_type,
  943. value: '',
  944. select_options: this.project.inspection_reference[index].range_options.split(','),
  945. unit: this.project.inspection_reference[index].unit
  946. })
  947. }
  948. console.log('form.formItem', this.form.formItem)
  949. this.dialogPicFormVisible = true
  950. },
  951. openNew() {
  952. console.log('this.project',this.project);
  953. if (this.project == null) {
  954. this.$message.error('请先选择项目')
  955. return false
  956. }
  957. this.form.method = 'add'
  958. this.formTitle = '新增' + this.project.project_name
  959. this.form.project_id = this.project.project_id
  960. if(this.form.project_id == 14) {
  961. this.form.remind_cycle = this.patient_info.remind_cycle
  962. }
  963. // this.form.remind_cycle = this.patient_info.remind_cycle
  964. var today = new Date()
  965. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  966. this.form.formItem = []
  967. console.log("hhhhhhhhhhhhhhhhhhhhhhhhhhhh",this.project.inspection_reference)
  968. for (var index in this.project.inspection_reference) {
  969. var item_id =0
  970. if(this.project.inspection_reference[index].item_id == 0){
  971. item_id = parseInt(this.project.inspection_reference[index].id)
  972. }
  973. if(this.project.inspection_reference[index].item_id > 0){
  974. item_id = parseInt(this.project.inspection_reference[index].item_id)
  975. }
  976. this.form.formItem.push({
  977. id: 0,
  978. project_id: this.project.inspection_reference[index].project_id,
  979. project_name: this.project.inspection_reference[index].project_name,
  980. item_id:item_id,
  981. item: this.project.inspection_reference[index].item,
  982. item_name: this.project.inspection_reference[index].item_name,
  983. range_type: this.project.inspection_reference[index].range_type,
  984. value: '',
  985. select_options: this.project.inspection_reference[
  986. index
  987. ].range_options.split(','),
  988. unit: this.project.inspection_reference[index].unit
  989. })
  990. }
  991. console.log('form.formItem', this.form.formItem)
  992. this.dialogFormVisible = true
  993. },
  994. submitEdit(formName) {
  995. this.$refs[formName].validate(valid => {
  996. if (valid) {
  997. this.formLoading = true
  998. if (this.form.formItem.length == 0) {
  999. this.$message.error('未填写项目')
  1000. return false
  1001. }
  1002. for (var index in this.form.formItem) {
  1003. this.form.formItem[index].value = '' + this.form.formItem[index].value
  1004. }
  1005. console.log('this.patientID, this.form,',this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id);
  1006. EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
  1007. if (response.data.state == 1) {
  1008. this.$notify({
  1009. title: '成功',
  1010. message: '修改成功',
  1011. type: 'success',
  1012. duration: 2000
  1013. })
  1014. this.patient_info.remind_cycle =
  1015. response.data.data.remind_cycle
  1016. this.itemDate = this.form.inspect_date
  1017. this.items = []
  1018. var inspections = response.data.data.inspections
  1019. this.inspections = response.data.data.inspections
  1020. if (inspections == null) {
  1021. this.inspections = []
  1022. return false
  1023. }
  1024. var inspectionsMap = {}
  1025. this.inspectionsMap = {}
  1026. for (var index in inspections) {
  1027. inspectionsMap[inspections[index].item_id] =
  1028. inspections[index]
  1029. this.inspectionsMap[inspections[index].item_id] =
  1030. inspections[index]
  1031. }
  1032. var items = this.project.inspection_reference
  1033. console.log('itmes', items)
  1034. for (var index in items) {
  1035. if (items[index].id in inspectionsMap) {
  1036. var item = {}
  1037. for (var key in items[index]) {
  1038. item[key] = items[index][key]
  1039. }
  1040. item.value = inspectionsMap[items[index].id].inspect_value
  1041. item.value_direction = ''
  1042. if (item.range_type == 1) {
  1043. var value = parseFloat(item.value)
  1044. var range_min = parseFloat(item.range_min)
  1045. var range_max = parseFloat(item.range_max)
  1046. if (value < range_min) {
  1047. item.value_direction = '↓'
  1048. } else if (value > range_max) {
  1049. item.value_direction = '↑'
  1050. }
  1051. }
  1052. this.items.push(item)
  1053. }
  1054. }
  1055. this.resetForm(formName)
  1056. this.dialogFormVisible = false
  1057. } else {
  1058. this.$message.error(response.data.msg)
  1059. return false
  1060. }
  1061. })
  1062. .catch(v => {
  1063. this.$message.error(v)
  1064. return false
  1065. })
  1066. this.formLoading = false
  1067. return false
  1068. } else {
  1069. return false
  1070. }
  1071. })
  1072. },
  1073. submitNew(formName) {
  1074. this.$refs[formName].validate(valid => {
  1075. if (valid) {
  1076. this.formLoading = true
  1077. if (this.form.formItem.length == 0) {
  1078. this.$message.error('未填写项目')
  1079. return false
  1080. }
  1081. for (var index in this.form.formItem) {this.form.formItem[index].value ='' + this.form.formItem[index].value}
  1082. console.log("this.form",this.form)
  1083. CreatePatientInspection(
  1084. this.patientID,
  1085. this.form,
  1086. this.form.remind_cycle
  1087. ).then(response => {
  1088. if (response.data.state == 1) {
  1089. this.$notify({
  1090. title: '成功',
  1091. message: '新增成功',
  1092. type: 'success',
  1093. duration: 2000
  1094. })
  1095. // this.form.remind_reycle = response.data.data.remind_reycc
  1096. this.patient_info.remind_cycle =
  1097. response.data.data.remind_cycle
  1098. console.log(this.patient_info.remind_cycle)
  1099. this.itemDate = this.form.inspect_date
  1100. this.items = []
  1101. for (var index in this.projects) {
  1102. if (this.projects[index].project_id == this.form.project_id) {
  1103. this.projects[index].count++
  1104. break
  1105. }
  1106. }
  1107. this.total += 1
  1108. var inspections = response.data.data.inspections
  1109. this.inspections = response.data.data.inspections
  1110. if (inspections == null) {
  1111. this.inspections = []
  1112. return false
  1113. }
  1114. var inspectionsMap = {}
  1115. this.inspectionsMap = {}
  1116. for (var index in inspections) {
  1117. inspectionsMap[inspections[index].item_id] =
  1118. inspections[index]
  1119. this.inspectionsMap[inspections[index].item_id] =
  1120. inspections[index]
  1121. }
  1122. var items = this.project.inspection_reference
  1123. for (var index in items) {
  1124. if (items[index].id in inspectionsMap) {
  1125. var item = {}
  1126. for (var key in items[index]) {
  1127. item[key] = items[index][key]
  1128. }
  1129. item.value = inspectionsMap[items[index].id].inspect_value
  1130. item.value_direction = ''
  1131. if (item.range_type == 1) {
  1132. var value = parseFloat(item.value)
  1133. var range_min = parseFloat(item.range_min)
  1134. var range_max = parseFloat(item.range_max)
  1135. if (value < range_min) {
  1136. item.value_direction = '↓'
  1137. } else if (value > range_max) {
  1138. item.value_direction = '↑'
  1139. }
  1140. }
  1141. this.items.push(item)
  1142. }
  1143. }
  1144. this.resetForm(formName)
  1145. this.dialogFormVisible = false
  1146. this.queryParams.patient = this.patientID
  1147. this.queryParams.project_id = this.project.project_id
  1148. this.queryParams.page = 1
  1149. this.total = 0
  1150. this.fetchPatientInspections(this.queryParams)
  1151. } else {
  1152. this.$message.error(response.data.msg)
  1153. return false
  1154. }
  1155. })
  1156. .catch(v => {
  1157. this.$message.error(v)
  1158. return false
  1159. })
  1160. this.formLoading = false
  1161. return false
  1162. } else {
  1163. return false
  1164. }
  1165. })
  1166. },
  1167. submitEditPicNew() {
  1168. if (this.form.imgs.length == 0) {
  1169. this.$message.error('未上传图片')
  1170. return false
  1171. }
  1172. this.formLoading = true
  1173. editPatientPICInspection(
  1174. this.patientID,
  1175. this.form
  1176. )
  1177. .then(response => {
  1178. if (response.data.state === 1) {
  1179. this.$notify({
  1180. title: '成功',
  1181. message: '修改成功',
  1182. type: 'success',
  1183. duration: 2000
  1184. })
  1185. this.itemDate = this.form.inspect_date
  1186. this.items = []
  1187. this.dialogPicFormVisible = false
  1188. this.queryParams.patient = this.patientID
  1189. this.queryParams.project_id = this.project.project_id
  1190. this.queryParams.page = 1
  1191. this.total = 0
  1192. this.fetchPatientInspections(this.queryParams)
  1193. } else {
  1194. this.$message.error(response.data.msg)
  1195. return false
  1196. }
  1197. })
  1198. .catch(v => {
  1199. this.$message.error(v)
  1200. return false
  1201. })
  1202. this.formLoading = false
  1203. },
  1204. deletePic(item,index){
  1205. if(item.id == 0){
  1206. this.form.imgs.splice(index,1)
  1207. }else{
  1208. for(let index in this.form.imgs){
  1209. if(item.id == this.form.imgs[index].id){
  1210. this.form.imgs.splice(index,1)
  1211. this.form.delete_imgs.push({
  1212. id:item.id,
  1213. })
  1214. }
  1215. }
  1216. }
  1217. },
  1218. // 上传确认保存
  1219. submitPicNew() {
  1220. this.formLoading = true
  1221. if (this.form.imgs.length == 0) {
  1222. this.$message.error('未上传图片')
  1223. return false
  1224. }
  1225. console.log("form",this.form)
  1226. CreatePatientPICInspection(
  1227. this.patientID,
  1228. this.form
  1229. ).then(response => {
  1230. if (response.data.state === 1) {
  1231. this.$notify({
  1232. title: '成功',
  1233. message: '新增成功',
  1234. type: 'success',
  1235. duration: 2000
  1236. })
  1237. this.itemDate = this.form.inspect_date
  1238. console.log('111111111',this.itemDate);
  1239. this.items = []
  1240. for (var index in this.projects) {
  1241. if (this.projects[index].project_id == this.form.project_id) {
  1242. this.projects[index].count++
  1243. break
  1244. }
  1245. }
  1246. this.total += 1
  1247. // var inspections = response.data.data.inspections
  1248. // this.inspections = response.data.data.inspections
  1249. // if (inspections == null) {
  1250. // this.inspections = []
  1251. // return false
  1252. // }
  1253. // var inspectionsMap = {}
  1254. // this.inspectionsMap = {}
  1255. //
  1256. // var items = this.project.inspection_reference
  1257. // for (var index in items) {
  1258. // if (items[index].id in inspectionsMap) {
  1259. // var item = {}
  1260. // for (var key in items[index]) {
  1261. // item[key] = items[index][key]
  1262. // }
  1263. // item.value = inspectionsMap[items[index].id].inspect_value
  1264. // item.value_direction = ''
  1265. // this.items.push(item)
  1266. // }
  1267. // }
  1268. this.dialogPicFormVisible = false
  1269. this.queryParams.patient = this.patientID
  1270. this.queryParams.project_id = this.project.project_id
  1271. this.queryParams.page = 1
  1272. this.total = 0
  1273. console.log('bbbbbvvvv',this.queryParams);
  1274. this.fetchPatientInspections(this.queryParams)
  1275. } else {
  1276. this.$message.error(response.data.msg)
  1277. return false
  1278. }
  1279. })
  1280. .catch(v => {
  1281. this.$message.error(v)
  1282. return false
  1283. })
  1284. this.formLoading = false
  1285. },
  1286. fetchInspectionReference() {
  1287. fetchInspectionReference(this.patientID)
  1288. .then(response => {
  1289. if (response.data.state == 1) {
  1290. var reference = response.data.data.reference
  1291. var patient_info = response.data.data.patient_info
  1292. this.projects = reference
  1293. this.patient_info = patient_info
  1294. this.pageLoading = false
  1295. // this.form.remind_cycle = this.patient_info.remind_cycle
  1296. } else {
  1297. this.$message.error(response.data.msg)
  1298. return false
  1299. }
  1300. })
  1301. .catch(v => {
  1302. })
  1303. },
  1304. setCurrent(row) {
  1305. this.$refs.singleTable.setCurrentRow(row)
  1306. },
  1307. resetForm(formName) {
  1308. this.$refs[formName].resetFields()
  1309. },
  1310. handleCurrentChange(row) {
  1311. console.log("row-2-23-23-",row)
  1312. this.itemDate = ''
  1313. this.form.method = 'add'
  1314. if (typeof row === 'undefined' || row == null) {
  1315. this.project = null
  1316. this.items = []
  1317. this.itemName = '请选择项目'
  1318. } else {
  1319. this.itemLoading = true
  1320. this.project = row
  1321. this.items = row.inspection_reference
  1322. this.itemName = row.project_name
  1323. this.queryParams.patient = this.patientID
  1324. this.queryParams.project_id = this.project.project_id
  1325. this.queryParams.page = 1
  1326. this.total = 0
  1327. console.log("wowowowowow",this.queryParams)
  1328. this.fetchPatientInspections(this.queryParams)
  1329. }
  1330. },
  1331. handleCurrentChangePage(val) {
  1332. this.itemLoading = true
  1333. this.queryParams.page = val
  1334. this.fetchPatientInspections(this.queryParams)
  1335. },
  1336. // 数据源
  1337. fetchPatientInspections(params) {
  1338. this.items = []
  1339. this.isPic = false
  1340. fetchPatientInspections(params)
  1341. .then(response => {
  1342. if (response.data.state == 1) {
  1343. var inspections = response.data.data.inspections
  1344. this.total = response.data.data.total
  1345. this.itemDate = response.data.data.date
  1346. let remind = response.data.data.remind
  1347. let config = response.data.data.config
  1348. this.record_id = config.id
  1349. if(config.id > 0){
  1350. if(config.is_open == 1){
  1351. this.is_open = true
  1352. }else{
  1353. this.is_open = false
  1354. }
  1355. }else{
  1356. this.is_open = false
  1357. }
  1358. if(remind.id > 0 && remind.remind_cycle > 0){
  1359. this.temp_remind_cycle = remind.remind_cycle
  1360. }else{
  1361. this.temp_remind_cycle = ""
  1362. }
  1363. this.inspections = response.data.data.inspections
  1364. console.log("this.inpections",response.data.data)
  1365. if (inspections == null) {
  1366. this.inspections = []
  1367. return false
  1368. }
  1369. var inspectionsMap = {}
  1370. this.inspectionsMap = {}
  1371. for (var index in inspections) {
  1372. inspectionsMap[inspections[index].item_id] = inspections[index]
  1373. this.inspectionsMap[inspections[index].item_id] = inspections[index]
  1374. }
  1375. console.log("inspectionsMap",this.inspectionsMap)
  1376. var items = this.project.inspection_reference
  1377. console.log("时间",items)
  1378. for(let index in items){
  1379. console.log("obj",items)
  1380. // console.log("inspectionsMap",inspectionsMap[items[index].item_id])
  1381. var item = {}
  1382. for (let key in items[index]) {
  1383. // console.log("key",key,items[index][key])
  1384. // console.log("item[key]",items[index])
  1385. item[key] = items[index][key]
  1386. }
  1387. console.log("item=-----------------12",item,inspectionsMap[items[index].id],inspectionsMap[parseInt(items[index].item_id)])
  1388. if (item.item_id > 0) {
  1389. if(inspectionsMap[parseInt(items[index].item_id)] == null){
  1390. console.log('执行1',item.project_name,inspectionsMap[items[index].id]);
  1391. if(this.org_id == 10121 || this.org_id ==10138 || this.org_id ==10278){
  1392. if(inspectionsMap[items[index].id] !=null){
  1393. item.value = inspectionsMap[items[index].id].inspect_value
  1394. item.item_name = inspectionsMap[items[index].id].item_name
  1395. }
  1396. }else{
  1397. if((this.org_id == 10702 || this.org_id==0) && inspectionsMap[items[index].id] !=null){
  1398. if(item.project_name == '血常规'|| item.project_name == '透后肾功能' ||
  1399. item.project_name == '肝功能' || item.project_name == '电解质' || item.project_name == '透前肾功能' ||
  1400. item.project_name == '传染病检查'
  1401. ){
  1402. item.value = inspectionsMap[items[index].id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1403. item.item_name = inspectionsMap[items[index].id].item_name
  1404. }else{
  1405. item.value = ''
  1406. item.item_name = ''
  1407. }
  1408. } else{
  1409. console.log('执行2',inspectionsMap[items[index].id]);
  1410. // item.value = inspectionsMap[items[index].id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1411. // item.item_name = inspectionsMap[items[index].id].item_name
  1412. item.value = ''
  1413. item.item_name = ''
  1414. }
  1415. }
  1416. } else {
  1417. if(inspectionsMap[parseInt(items[index].item_id)] != null){
  1418. console.log('执行3',inspectionsMap[items[index].item_id].inspect_value);
  1419. item.value = inspectionsMap[items[index].item_id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1420. item.item_name = inspectionsMap[items[index].item_id].item_name
  1421. }
  1422. }
  1423. if(this.org_id ==10191){
  1424. if(item.project_name == "乙肝定性(五项)" && inspectionsMap[items[index].id] !=null){
  1425. console.log("金阿迪发到付阿打发")
  1426. item.value = inspectionsMap[items[index].id].inspect_value
  1427. item.item_name = inspectionsMap[items[index].id].item_name
  1428. }
  1429. }
  1430. // if ((inspectionsMap[parseInt(items[index].item_id)]) == null) {
  1431. // if(this.org_id == 10121 || this.org_id ==10138 || this.org_id ==10278){
  1432. // item.value = inspectionsMap[items[index].id].inspect_value
  1433. // item.item_name = inspectionsMap[items[index].id].item_name
  1434. // }else{
  1435. // console.log('执行1',item.project_name,inspectionsMap[items[index].id]);
  1436. // if(this.org_id == 10702 || this.org_id==0){
  1437. // if(item.project_name == '血常规'|| item.project_name == '透后肾功能' ||
  1438. // item.project_name == '肝功能' || item.project_name == '电解质' || item.project_name == '透前肾功能' ||
  1439. // item.project_name == '传染病检查'
  1440. // ){
  1441. // item.value = inspectionsMap[items[index].id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1442. // item.item_name = inspectionsMap[items[index].id].item_name
  1443. // }else{
  1444. // item.value = ''
  1445. // item.item_name = ''
  1446. // }
  1447. // } else{
  1448. // console.log('执行2');
  1449. // item.value = ''
  1450. // item.item_name = ''
  1451. // }
  1452. // }
  1453. // } else {
  1454. // console.log('执行3',inspectionsMap[items[index].item_id].inspect_value);
  1455. // item.value = inspectionsMap[items[index].item_id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1456. // item.item_name = inspectionsMap[items[index].item_id].item_name
  1457. // }
  1458. // if(this.org_id ==10191){
  1459. // if(item.project_name == "乙肝定性(五项)"){
  1460. // console.log("金阿迪发到付阿打发")
  1461. // item.value = inspectionsMap[items[index].id].inspect_value
  1462. // item.item_name = inspectionsMap[items[index].id].item_name
  1463. // }
  1464. // }
  1465. } else {
  1466. if(typeof(inspectionsMap[parseInt(items[index].id)]) == null){
  1467. continue
  1468. }else{
  1469. console.log('执行4',inspectionsMap);
  1470. item.value = inspectionsMap[items[index].id].inspect_value
  1471. item.item_name = inspectionsMap[items[index].id].item_name
  1472. }
  1473. }
  1474. item.value_direction = ''
  1475. if (item.range_type == 1) {
  1476. console.log('执行5',item.value);
  1477. var value = parseFloat(item.value)
  1478. var range_min = parseFloat(item.range_min)
  1479. var range_max = parseFloat(item.range_max)
  1480. if (value < range_min) {
  1481. item.value_direction = '↓'
  1482. } else if (value > range_max) {
  1483. item.value_direction = '↑'
  1484. }
  1485. }
  1486. this.items.push(item)
  1487. console.log('fffff',this.items);
  1488. if(item.value.indexOf("http") !=-1){
  1489. this.isPic = true
  1490. }
  1491. if(this.isPic == true){
  1492. for(let x in this.items){
  1493. if(this.items[x].value ==''){
  1494. this.items.splice(x,1)
  1495. }
  1496. }
  1497. }
  1498. console.log("woowwoow",this.isPic)
  1499. console.log("isPicwowowow",this.items)
  1500. }
  1501. // for (var index in items) {
  1502. // console.log("obj",items[index].id)
  1503. // // console.log("inspectionsMap",inspectionsMap[items[index].item_id])
  1504. // var item = {}
  1505. // for (var key in items[index]) {
  1506. // // console.log("key",key,items[index][key])
  1507. // // console.log("item[key]",items[index])
  1508. // item[key] = items[index][key]
  1509. // }
  1510. // console.log("item=-----------------12",inspectionsMap[items[index].id],inspectionsMap[parseInt(items[index].item_id)])
  1511. // if (item.item_id > 0) {
  1512. // if (typeof(inspectionsMap[parseInt(items[index].item_id)]) == "undefined") {
  1513. // if(this.org_id == 10121 || this.org_id ==10138 || this.org_id ==10278){
  1514. // item.value = inspectionsMap[items[index].id].inspect_value
  1515. // item.item_name = inspectionsMap[items[index].id].item_name
  1516. // }else{
  1517. // console.log('执行1',item.project_name,inspectionsMap[items[index].id]);
  1518. // if(this.org_id == 10702 || this.org_id==0){
  1519. // if(item.project_name == '血常规'|| item.project_name == '透后肾功能' ||
  1520. // item.project_name == '肝功能' || item.project_name == '电解质' || item.project_name == '透前肾功能' ||
  1521. // item.project_name == '传染病检查'
  1522. // ){
  1523. // item.value = inspectionsMap[items[index].id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1524. // item.item_name = inspectionsMap[items[index].id].item_name
  1525. // }else{
  1526. // item.value = ''
  1527. // item.item_name = ''
  1528. // }
  1529. // } else{
  1530. // console.log('执行2');
  1531. // item.value = ''
  1532. // item.item_name = ''
  1533. // }
  1534. // }
  1535. // } else {
  1536. // console.log('执行3',inspectionsMap[items[index].item_id].inspect_value);
  1537. // item.value = inspectionsMap[items[index].item_id].inspect_value.replace(/&lt;/g, "<").replace(/&gt;/g, ">")
  1538. // item.item_name = inspectionsMap[items[index].item_id].item_name
  1539. // }
  1540. // if(this.org_id ==10191){
  1541. // if(item.project_name == "乙肝定性(五项)"){
  1542. // console.log("金阿迪发到付阿打发")
  1543. // item.value = inspectionsMap[items[index].id].inspect_value
  1544. // item.item_name = inspectionsMap[items[index].id].item_name
  1545. // }
  1546. // }
  1547. // } else {
  1548. // if(typeof(inspectionsMap[parseInt(items[index].id)]) == "undefined"){
  1549. // continue
  1550. // }
  1551. // console.log('执行4',inspectionsMap);
  1552. // item.value = inspectionsMap[items[index].id].inspect_value
  1553. // item.item_name = inspectionsMap[items[index].id].item_name
  1554. // }
  1555. // // item["inspect_desc"] = inspectionsMap[items[index].id].inspect_desc
  1556. // // item["inspect_type"] = inspectionsMap[items[index].id].inspect_type
  1557. // item.value_direction = ''
  1558. // if (item.range_type == 1) {
  1559. // console.log('执行5',item.value);
  1560. // var value = parseFloat(item.value)
  1561. // var range_min = parseFloat(item.range_min)
  1562. // var range_max = parseFloat(item.range_max)
  1563. // if (value < range_min) {
  1564. // item.value_direction = '↓'
  1565. // } else if (value > range_max) {
  1566. // item.value_direction = '↑'
  1567. // }
  1568. // }
  1569. // this.items.push(item)
  1570. // console.log('fffff',this.items);
  1571. // if(item.value.indexOf("http") !=-1){
  1572. // this.isPic = true
  1573. // }
  1574. // console.log("woowwoow",this.isPic)
  1575. // console.log("isPicwowowow",this.items)
  1576. // }
  1577. }
  1578. })
  1579. .catch(v => {
  1580. })
  1581. setTimeout(() => {
  1582. this.itemLoading = false
  1583. }, 1000)
  1584. },
  1585. getrange(val){
  1586. if(val !=''){
  1587. return (val.replace(/[^\d.]/g, ''))*1;
  1588. }else{
  1589. return ''
  1590. }
  1591. },
  1592. getAge: function(val) {
  1593. if (val.id_card_no == undefined) {
  1594. return false
  1595. }
  1596. var thisLen = val.id_card_no.length
  1597. var birth = ''
  1598. if (thisLen == 15) {
  1599. birth = '19' + val.id_card_no.substr(6, 6)
  1600. } else {
  1601. birth = val.id_card_no.substr(6, 8)
  1602. }
  1603. var birthtwo =
  1604. birth.substr(0, 4) +
  1605. '-' +
  1606. birth.substr(4, 2) +
  1607. '-' +
  1608. birth.substr(6, 2)
  1609. var age = jsGetAge(birthtwo, '-')
  1610. return age
  1611. }
  1612. },
  1613. created() {
  1614. const id = this.$route.query && this.$route.query.id
  1615. this.patient = this.$route.query.patient
  1616. console.log('this.patient',this.patient);
  1617. this.org_id = this.$store.getters.xt_user.org.id,
  1618. this.patientID = parseInt(id)
  1619. if (isNaN(this.patientID) || this.patientID <= 0) {
  1620. this.$notify.error({
  1621. title: '错误',
  1622. message: '无效的id'
  1623. })
  1624. this.$router.push('/patients/patients')
  1625. }
  1626. this.fetchInspectionReference()
  1627. }
  1628. }
  1629. </script>
  1630. <style>
  1631. #oictable ::-webkit-scrollbar {
  1632. height: 15px;
  1633. }
  1634. </style>
  1635. <style>
  1636. #user-inspection-order td {
  1637. border-bottom: 0px !important;
  1638. border-right: 0px !important;
  1639. }
  1640. #user-inspection-order th {
  1641. border-right: 0px !important;
  1642. }
  1643. #user-inspection-form .el-form-item__content {
  1644. line-height: 0 !important;
  1645. }
  1646. .el-table td,
  1647. .el-table th.is-leaf,
  1648. .el-table--border,
  1649. .el-table--group {
  1650. border-color: #d0d3da;
  1651. }
  1652. .el-table--border::after,
  1653. .el-table--group::after,
  1654. .el-table::before {
  1655. background-color: #d0d3da;
  1656. }
  1657. .checktable tr td,th{
  1658. border: 0 !important;
  1659. padding: 5px 0;
  1660. text-align: center;
  1661. }
  1662. </style>