Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

TimePersonal.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="page_timePersonal">
  3. <div class="cell clearfix">
  4. <el-form :inline="true" :model="listQuery">
  5. <el-form-item label>
  6. <!-- <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:150px"></el-input>
  7. <el-button type="primary" @click="onSearch" icon="el-icon-search">搜索</el-button> -->
  8. <el-autocomplete
  9. class="checkSearch"
  10. popper-class="my-autocomplete"
  11. v-model.trim="listQuery.search"
  12. :fetch-suggestions="querySearchAsync"
  13. :trigger-on-focus="false"
  14. placeholder="输入病人透析号/姓名"
  15. @select="handleSelect"
  16. >
  17. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  18. <template slot-scope="{ item }">
  19. <div class="name">{{ item.name }}</div>
  20. </template>
  21. </el-autocomplete>
  22. </el-form-item>
  23. </el-form>
  24. <label class="title">
  25. <span class="name">日期查询</span> :
  26. </label>
  27. <el-date-picker
  28. v-model="listQuery.start_time"
  29. prefix-icon="el-icon-date"
  30. @change="changeTime"
  31. :editable="false"
  32. style="width: 196px;"
  33. type="date"
  34. placeholder="选择日期时间"
  35. align="right"
  36. format="yyyy-MM-dd"
  37. value-format="yyyy-MM-dd"
  38. :picker-options="pickerOptions"
  39. ></el-date-picker>
  40. <span class>-</span>
  41. <el-date-picker
  42. v-model="listQuery.end_time"
  43. prefix-icon="el-icon-date"
  44. @change="changeEndTime"
  45. :editable="false"
  46. style="width: 196px;"
  47. type="date"
  48. placeholder="选择日期时间"
  49. align="right"
  50. format="yyyy-MM-dd"
  51. value-format="yyyy-MM-dd"
  52. :picker-options="pickerOptions"
  53. ></el-date-picker>
  54. </div>
  55. <el-container>
  56. <div style="width:150px">
  57. <div class="tableTitle">患者列表</div>
  58. <el-table :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
  59. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  60. highlight-current-row
  61. @current-change="handleChange">
  62. <el-table-column prop="dialysis_no" label="透析号" width="80">
  63. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  64. </el-table-column>
  65. <el-table-column prop="name" label="姓名" width="80">
  66. <template slot-scope="scope">{{ scope.row.name }}</template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <div style="padding-left:10px;flex:1">
  71. <div class="tableTitle">统计表</div>
  72. <el-table :data="DialysisData" style="width: 100%" border :row-style="{ color: '#303133' }"
  73. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  74. >
  75. <el-table-column prop="name" label="姓名" width="140">
  76. <!-- <template slot-scope="scope">{{ scope.row.name }}</template> -->
  77. </el-table-column>
  78. <el-table-column label="年龄" width="140">
  79. <template slot-scope="scope">{{ getAge(scope.row.id_card_no) }}</template>
  80. </el-table-column>
  81. <el-table-column prop="dialysis_no" label="透析号" width="140">
  82. <!-- <template slot-scope="scope">{{ scope.row.dialysis_no }}</template> -->
  83. </el-table-column>
  84. <el-table-column prop="mode_id" label="透析模式">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.mode_id.join("、") }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="address" label="透析总次数" width="140">
  90. <template slot-scope="scope">
  91. <span>{{ getDialysisCount(scope.row.patient_id)}}</span>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <el-pagination
  96. align="right"
  97. @size-change="handleSizeChange"
  98. @current-change="handleCurrentChange"
  99. :current-page="listQuery.page"
  100. :page-sizes="[20, 40, 60, 80, 100]"
  101. :page-size="10"
  102. background
  103. style="margin-top:20px;"
  104. layout="total, sizes, prev, pager, next, jumper"
  105. :total="total"
  106. ></el-pagination>
  107. </div>
  108. </el-container>
  109. </div>
  110. </template>
  111. <script>
  112. import { PostSearch} from '@/api/patient'
  113. import { getCurrentOrgPatients,getDialysisList,getDialysisDetailById,getPrescriptionByName } from "@/api/common/common";
  114. import { uParseTime } from "@/utils/tools";
  115. export default {
  116. data() {
  117. return {
  118. listQuery: {
  119. start_time: "",
  120. end_time: "",
  121. page: 1,
  122. limit: 20
  123. },
  124. DialysisCount:[],
  125. total:0,
  126. options: [],
  127. value: "请选项",
  128. tableData: [],
  129. DialysisData: [],
  130. patientsData:[],
  131. prescriptionList:[],
  132. limit:1000,
  133. page:1,
  134. pickerOptions: {
  135. disabledDate(time) {
  136. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  137. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  138. }
  139. },
  140. patient_id:0,
  141. };
  142. },
  143. methods: {
  144. changeTime(val) {
  145. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  146. if (time > 0) {
  147. this.$message.error("结束时间不能小于开始时间");
  148. this.listQuery.start_time = "";
  149. } else {
  150. this.getDialysisList()
  151. }
  152. },
  153. changeEndTime(val) {
  154. var time =
  155. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  156. if (time < 0) {
  157. this.$message.error("结束时间不能小于开始时间");
  158. this.listQuery.end_time = "";
  159. } else {
  160. this.getDialysisList()
  161. }
  162. },
  163. getTimestamp(time) {
  164. // 把时间日期转成时间戳
  165. return new Date(time).getTime() / 1000;
  166. },
  167. getCurrentOrgPatients(){
  168. getCurrentOrgPatients().then(response=>{
  169. if(response.data.state == 1){
  170. var patients = response.data.data.patients
  171. this.patientsData = patients
  172. }
  173. })
  174. },
  175. getTime(time) {
  176. return uParseTime(time, "{y}-{m}-{d}");
  177. },
  178. handleSizeChange(limit) {
  179. this.listQuery.limit = limit;
  180. this.getDialysisList();
  181. },
  182. handleCurrentChange(page) {
  183. this.listQuery.page = page;
  184. this.getDialysisList();
  185. },
  186. getDialysisList(){
  187. getDialysisList(this.listQuery.start_time,this.listQuery.end_time,this.listQuery.page,this.listQuery.limit).then(response=>{
  188. if(response.data.state === 1){
  189. var list = response.data.data.list
  190. console.log("list",list)
  191. var totallist = response.data.data.totallist
  192. console.log("totallist",totallist)
  193. this.total = totallist
  194. var prescriptionList = response.data.data.prescriptionList
  195. console.log("prescriptionList",prescriptionList)
  196. this.getModeId(prescriptionList)
  197. var count = response.data.data.count
  198. console.log("count",count)
  199. this.DialysisCount = count
  200. // for(let i=0;i<count.length;i++){
  201. // for(let j=0;j<prescriptionList.length;j++){
  202. // if(count[i].patient_id == prescriptionList[j].patient_id){
  203. // prescriptionList[j].count = count[i].Count
  204. // }
  205. // }
  206. // }
  207. // console.log("prescriptionList",prescriptionList)
  208. let dataInfo = {}
  209. list.forEach((item, index) => {
  210. let { patient_id } = item
  211. if (!dataInfo[patient_id]) {
  212. dataInfo[patient_id] = {
  213. patient_id,
  214. name:item.name,
  215. id_card_no:item.id_card_no,
  216. dialysis_no:item.dialysis_no,
  217. total_dialysis:item.total_dialysis,
  218. user_sys_before_count:item.user_sys_before_count,
  219. mode_id: []
  220. }
  221. }
  222. })
  223. let list = Object.values(dataInfo)
  224. console.log("arr",list)
  225. list.map(item => {
  226. for (let i = 0; i < prescriptionList.length; i++) {
  227. if (item.patient_id === prescriptionList[i].patient_id) {
  228. item.mode_id.push(prescriptionList[i].mode_id)
  229. }
  230. }
  231. })
  232. // console.log("list---",list)
  233. this.DialysisData = list
  234. }
  235. })
  236. },
  237. getAge(UUserCard) {
  238. if (UUserCard != null && UUserCard != '') {
  239. //获取年龄
  240. var myDate = new Date();
  241. var month = myDate.getMonth() + 1;
  242. var day = myDate.getDate();
  243. var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
  244. if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
  245. age++;
  246. }
  247. return age;
  248. }
  249. },
  250. getDialysisCount(id){
  251. var count = 0
  252. for(let i=0;i<this.DialysisCount.length;i++){
  253. if(id == this.DialysisCount[i].patient_id){
  254. count = this.DialysisCount[i].Count
  255. }
  256. }
  257. return count
  258. },
  259. onSearch(){
  260. if(this.listQuery.search == "" || this.listQuery.search == null){
  261. this.getDialysisList()
  262. return false
  263. }else{
  264. getPrescriptionByName(this.patient_id,this.listQuery.start_time,this.listQuery.end_time,this.limit,this.page).then(response=>{
  265. if(response.data.state === 1){
  266. var patients = response.data.data.patient
  267. this.getModeId(patients)
  268. //console.log("patient",patients)
  269. var hash = {};
  270. var i = 0;
  271. var res = [];
  272. patients.forEach(function(item) {
  273. var patient_id = item.patient_id;
  274. hash[patient_id] ? res[hash[patient_id] - 1].mode_id.push(item.mode_id) : hash[patient_id] = ++i && res.push({
  275. mode_id: [item.mode_id],
  276. patient_id: patient_id,
  277. dialysis_no: item.dialysis_no,
  278. name:item.name,
  279. id_card_no:item.id_card_no,
  280. total_dialysis:item.total_dialysis,
  281. user_sys_before_count:item.user_sys_before_count,
  282. })
  283. });
  284. this.DialysisData = res
  285. var total = response.data.data.total
  286. this.total = res.length
  287. // console.log("total",total)
  288. }
  289. })
  290. }
  291. },
  292. unique(arr) {
  293. const res = new Map();
  294. return arr.filter((arr) => !res.has(arr.mode_id) && res.set(arr.mode_id, 1));
  295. },
  296. handleChange(val){
  297. getDialysisDetailById(val.id,this.listQuery.start_time,this.listQuery.end_time,this.limit,this.page).then(response=>{
  298. if(response.data.state === 1){
  299. var patients = response.data.data.patients
  300. this.getModeId(patients)
  301. // console.log("patients",patients)
  302. var hash = {};
  303. var i = 0;
  304. var res = [];
  305. patients.forEach(function(item) {
  306. var patient_id = item.patient_id;
  307. hash[patient_id] ? res[hash[patient_id] - 1].mode_id.push(item.mode_id) : hash[patient_id] = ++i && res.push({
  308. mode_id: [item.mode_id],
  309. patient_id: patient_id,
  310. dialysis_no: item.dialysis_no,
  311. name:item.name,
  312. id_card_no:item.id_card_no,
  313. total_dialysis:item.total_dialysis,
  314. user_sys_before_count:item.user_sys_before_count,
  315. })
  316. });
  317. this.DialysisData = res
  318. // console.log(res)
  319. var total = response.data.data.total
  320. this.total = res.length
  321. // console.log("total",total)
  322. }
  323. })
  324. },
  325. getModeId(patients){
  326. for(let i=0;i<patients.length;i++){
  327. if(patients[i].mode_id == 1){
  328. patients[i].mode_id = "HD"
  329. }else if(patients[i].mode_id == 2){
  330. patients[i].mode_id = "HDF"
  331. }else if(patients[i].mode_id == 3){
  332. patients[i].mode_id = "HD+HP"
  333. }else if(patients[i].mode_id == 4){
  334. patients[i].mode_id = "HP"
  335. }else if(patients[i].mode_id == 5){
  336. patients[i].mode_id = "HF"
  337. }else if(patients[i].mode_id == 6){
  338. patients[i].mode_id = "SCUF"
  339. }else if(patients[i].mode_id == 7){
  340. patients[i].mode_id = "IUF"
  341. }else if(patients[i].mode_id == 8){
  342. patients[i].mode_id = "HFHD"
  343. }else if(patients[i].mode_id == 9){
  344. patients[i].mode_id = "HFHD+HP"
  345. }else if(patients[i].mode_id == 10){
  346. patients[i].mode_id = "PHF"
  347. }else if(patients[i].mode_id == 11){
  348. patients[i].mode_id = "HFR"
  349. }else if(patients[i].mode_id == 12){
  350. patients[i].mode_id = "HDF+HP"
  351. }else if(patients[i].mode_id == 13){
  352. patients[i].mode_id = "CRRT"
  353. }else if(patients[i].mode_id == 14){
  354. patients[i].mode_id = "腹水回输"
  355. }else if(patients[i].mode_id == 15){
  356. patients[i].mode_id = "HD前置换"
  357. }else if(patients[i].mode_id == 16){
  358. patients[i].mode_id = "HD后置换"
  359. }else if(patients[i].mode_id == 17){
  360. patients[i].mode_id = "HDF前置换"
  361. }else if(patients[i].mode_id == 18){
  362. patients[i].mode_id = "HDF后置换"
  363. }else if(patients[i].mode_id == 19){
  364. patients[i].mode_id = "IUF+HD"
  365. }
  366. }
  367. },
  368. querySearchAsync(keyword, cb) {
  369. let key = ''
  370. if (keyword != undefined) {
  371. key = keyword
  372. }
  373. let searchArray = []
  374. PostSearch(key).then(response => {
  375. if (response.data.state == 1) {
  376. searchArray = response.data.data.patient
  377. console.log("searchArray",searchArray)
  378. cb(searchArray)
  379. } else {
  380. cb([])
  381. }
  382. })
  383. },
  384. handleSelect(val) {
  385. console.log("val",val)
  386. this.listQuery.search = val.name
  387. this.patient_id = val.id
  388. this.onSearch()
  389. },
  390. },
  391. created(){
  392. var nowDate = new Date();
  393. var nowYear = nowDate.getFullYear();
  394. var nowMonth = nowDate.getMonth() + 1;
  395. var nowDay = nowDate.getDate();
  396. this.listQuery.end_time =
  397. nowYear +
  398. "-" +
  399. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  400. "-" +
  401. (nowDay < 10 ? "0" + nowDay : nowDay);
  402. nowDate.setMonth(nowDate.getMonth() - 3);
  403. nowYear = nowDate.getFullYear();
  404. nowMonth = nowDate.getMonth() + 1;
  405. nowDay = nowDate.getDate();
  406. this.listQuery.start_time =
  407. nowYear +
  408. "-" +
  409. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  410. "-" +
  411. (nowDay < 10 ? "0" + nowDay : nowDay);
  412. //获取该机构下的所有患者
  413. this.getCurrentOrgPatients()
  414. //统计列表
  415. this.getDialysisList()
  416. }
  417. };
  418. </script>
  419. <style lang="scss" scoped>
  420. .tableTitle {
  421. font-size: 16px;
  422. color: #000;
  423. font-weight: bold;
  424. margin-bottom: 10px;
  425. }
  426. </style>
  427. <style lang="scss">
  428. .page_timePersonal {
  429. .cell {
  430. text-align: center;
  431. }
  432. }
  433. </style>