|
@@ -9372,3 +9372,294 @@ func (this *DialysisAPIController) CheckMobileInformation() {
|
9372
|
9372
|
}
|
9373
|
9373
|
|
9374
|
9374
|
}
|
|
9375
|
+
|
|
9376
|
+func (c *DialysisAPIController) GetControlMonitorList() {
|
|
9377
|
+
|
|
9378
|
+ partition, _ := c.GetInt64("partition")
|
|
9379
|
+ monitorDate := c.GetString("date")
|
|
9380
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
9381
|
+ pat_type, _ := c.GetInt64("pat_type")
|
|
9382
|
+ timeLayout := "2006-01-02"
|
|
9383
|
+ loc, _ := time.LoadLocation("Local")
|
|
9384
|
+
|
|
9385
|
+ var theStartTime int64
|
|
9386
|
+ if len(monitorDate) > 0 {
|
|
9387
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", monitorDate+" 00:00:00", loc)
|
|
9388
|
+ if err != nil {
|
|
9389
|
+ theStartTime = 0
|
|
9390
|
+ }
|
|
9391
|
+ theStartTime = theTime.Unix()
|
|
9392
|
+ }
|
|
9393
|
+ adminInfo := c.GetMobileAdminUserInfo()
|
|
9394
|
+ orgID := adminInfo.Org.Id
|
|
9395
|
+ monitor, err := service.GetNewMonitorRecord(orgID, theStartTime, partition, patient_id)
|
|
9396
|
+
|
|
9397
|
+ if err != nil {
|
|
9398
|
+ c.ErrorLog("获取排班信息失败:%v", err)
|
|
9399
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
9400
|
+ } else {
|
|
9401
|
+ if len(monitor) > 0 {
|
|
9402
|
+ //获取所有床位
|
|
9403
|
+ numberList, _ := service.GetAllDeviceNumberByList(orgID)
|
|
9404
|
+ //获取所有分区
|
|
9405
|
+ zoneList, _ := service.GetAllZoneByList(orgID)
|
|
9406
|
+ //获取透析处方
|
|
9407
|
+ prescriptions, _ := service.GetAllPrescriptionByListSix(orgID, theStartTime)
|
|
9408
|
+ //获取透前评估
|
|
9409
|
+ assessmentBefores, _ := service.GetAllAssessmentBeforesByListOne(orgID, theStartTime)
|
|
9410
|
+ //获取上机
|
|
9411
|
+ dialysisOrders, _ := service.GetAllDialysisOrdersByListNight(orgID, theStartTime, pat_type)
|
|
9412
|
+ //获取透后
|
|
9413
|
+ AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListSix(orgID, theStartTime)
|
|
9414
|
+
|
|
9415
|
+ //获取透后监测
|
|
9416
|
+ monitorlist, _ := service.GetNewAllMonitorList(orgID, theStartTime, pat_type)
|
|
9417
|
+
|
|
9418
|
+ //获取所有的患者
|
|
9419
|
+ patients, _ := service.GetAllPatientListByListOne(orgID)
|
|
9420
|
+
|
|
9421
|
+ //获取所有透析模式
|
|
9422
|
+ treatments, _ := service.GetAllTreatModeByList(orgID)
|
|
9423
|
+
|
|
9424
|
+ //获取所有医嘱
|
|
9425
|
+ adviceList, _ := service.GetAdviceList(orgID, theStartTime, pat_type)
|
|
9426
|
+
|
|
9427
|
+ //获取双人核对
|
|
9428
|
+ checkList, _ := service.GetDobuleCheck(orgID, theStartTime)
|
|
9429
|
+
|
|
9430
|
+ //治疗小结
|
|
9431
|
+ summaryList, _ := service.GetTreatmentSummaryForList(orgID, theStartTime)
|
|
9432
|
+
|
|
9433
|
+ //待消毒
|
|
9434
|
+ informationList, _ := service.GetDialysisInformationList(orgID, theStartTime)
|
|
9435
|
+
|
|
9436
|
+ for key, item := range monitor {
|
|
9437
|
+ // 获取床位信息
|
|
9438
|
+ for _, it := range numberList {
|
|
9439
|
+ if item.BedId == it.ID {
|
|
9440
|
+ monitor[key].DeviceNumber = it
|
|
9441
|
+ break
|
|
9442
|
+ }
|
|
9443
|
+ }
|
|
9444
|
+
|
|
9445
|
+ //获取分区信息
|
|
9446
|
+ for _, it := range zoneList {
|
|
9447
|
+ if item.PartitionId == it.ID {
|
|
9448
|
+ monitor[key].DeviceZone = it
|
|
9449
|
+ }
|
|
9450
|
+ }
|
|
9451
|
+
|
|
9452
|
+ for _, prescription := range prescriptions {
|
|
9453
|
+ if item.PatientId == prescription.PatientId {
|
|
9454
|
+ monitor[key].Prescription = prescription
|
|
9455
|
+ break
|
|
9456
|
+ }
|
|
9457
|
+ }
|
|
9458
|
+
|
|
9459
|
+ for _, it := range checkList {
|
|
9460
|
+ if item.PatientId == it.PatientId {
|
|
9461
|
+ monitor[key].DoubleCheck = it
|
|
9462
|
+ break
|
|
9463
|
+ }
|
|
9464
|
+ }
|
|
9465
|
+
|
|
9466
|
+ for _, it := range summaryList {
|
|
9467
|
+ if item.PatientId == it.PatientId {
|
|
9468
|
+ monitor[key].TreatmentSummaryForList = it
|
|
9469
|
+ break
|
|
9470
|
+ }
|
|
9471
|
+ }
|
|
9472
|
+
|
|
9473
|
+ // 透前评估
|
|
9474
|
+ for _, assessmentBefore := range assessmentBefores {
|
|
9475
|
+ if item.PatientId == assessmentBefore.PatientId {
|
|
9476
|
+ monitor[key].AssessmentBeforeDislysis = assessmentBefore
|
|
9477
|
+ break
|
|
9478
|
+ }
|
|
9479
|
+ }
|
|
9480
|
+
|
|
9481
|
+ // 透析上下机
|
|
9482
|
+ for _, dialysisOrder := range dialysisOrders {
|
|
9483
|
+ if item.PatientId == dialysisOrder.PatientId {
|
|
9484
|
+ monitor[key].DialysisOrder = dialysisOrder
|
|
9485
|
+ break
|
|
9486
|
+ }
|
|
9487
|
+ }
|
|
9488
|
+
|
|
9489
|
+ // 治疗小节
|
|
9490
|
+ for _, afterDislysis := range AssessmentAfterDislysis {
|
|
9491
|
+ if item.PatientId == afterDislysis.PatientId {
|
|
9492
|
+ monitor[key].AssessmentAfterDislysis = afterDislysis
|
|
9493
|
+ break
|
|
9494
|
+ }
|
|
9495
|
+ }
|
|
9496
|
+
|
|
9497
|
+ for _, it := range monitorlist {
|
|
9498
|
+ if item.PatientId == it.PatientId {
|
|
9499
|
+ monitor[key].MonitoringRecord = append(monitor[key].MonitoringRecord, it)
|
|
9500
|
+ }
|
|
9501
|
+ }
|
|
9502
|
+
|
|
9503
|
+ for _, it := range adviceList {
|
|
9504
|
+ if item.PatientId == it.PatientId {
|
|
9505
|
+ monitor[key].AdviceList = append(monitor[key].AdviceList, it)
|
|
9506
|
+ }
|
|
9507
|
+ }
|
|
9508
|
+
|
|
9509
|
+ for _, patient := range patients {
|
|
9510
|
+ if item.PatientId == patient.ID {
|
|
9511
|
+ monitor[key].MonitorPatients = patient
|
|
9512
|
+ break
|
|
9513
|
+ }
|
|
9514
|
+ }
|
|
9515
|
+
|
|
9516
|
+ for _, treatment := range treatments {
|
|
9517
|
+ if item.ModeId == treatment.ID {
|
|
9518
|
+ monitor[key].TreatmentMode = treatment
|
|
9519
|
+ break
|
|
9520
|
+ }
|
|
9521
|
+ }
|
|
9522
|
+
|
|
9523
|
+ for _, infor := range informationList {
|
|
9524
|
+ if item.PatientId == infor.PatientId {
|
|
9525
|
+ monitor[key].NewDeviceInformation = infor
|
|
9526
|
+ break
|
|
9527
|
+ }
|
|
9528
|
+ }
|
|
9529
|
+ }
|
|
9530
|
+ }
|
|
9531
|
+
|
|
9532
|
+ }
|
|
9533
|
+
|
|
9534
|
+ patients, err := service.GetAllpatientFourty(orgID)
|
|
9535
|
+
|
|
9536
|
+ var mds []*models.NewMonitorDialysisScheduleList
|
|
9537
|
+
|
|
9538
|
+ if pat_type == 0 {
|
|
9539
|
+ for _, item := range monitor {
|
|
9540
|
+ mds = append(mds, item)
|
|
9541
|
+ }
|
|
9542
|
+ }
|
|
9543
|
+
|
|
9544
|
+ //待医嘱核对
|
|
9545
|
+ if pat_type == 1 {
|
|
9546
|
+ for _, item := range monitor {
|
|
9547
|
+ if len(item.AdviceList) > 0 {
|
|
9548
|
+ mds = append(mds, item)
|
|
9549
|
+ }
|
|
9550
|
+ }
|
|
9551
|
+ }
|
|
9552
|
+ //待开小结
|
|
9553
|
+ if pat_type == 2 {
|
|
9554
|
+ for _, item := range monitor {
|
|
9555
|
+ if item.TreatmentSummaryForList == nil {
|
|
9556
|
+
|
|
9557
|
+ mds = append(mds, item)
|
|
9558
|
+
|
|
9559
|
+ }
|
|
9560
|
+
|
|
9561
|
+ }
|
|
9562
|
+ }
|
|
9563
|
+ //待下机
|
|
9564
|
+ if pat_type == 3 {
|
|
9565
|
+ for _, item := range monitor {
|
|
9566
|
+ if item.DialysisOrder != nil {
|
|
9567
|
+ if item.DialysisOrder.ID > 0 {
|
|
9568
|
+ mds = append(mds, item)
|
|
9569
|
+ }
|
|
9570
|
+ }
|
|
9571
|
+
|
|
9572
|
+ }
|
|
9573
|
+ }
|
|
9574
|
+
|
|
9575
|
+ //待消毒
|
|
9576
|
+ if pat_type == 4 {
|
|
9577
|
+ for _, item := range monitor {
|
|
9578
|
+ if item.NewDeviceInformation == nil {
|
|
9579
|
+ mds = append(mds, item)
|
|
9580
|
+ }
|
|
9581
|
+
|
|
9582
|
+ }
|
|
9583
|
+ }
|
|
9584
|
+ //待双人核对
|
|
9585
|
+ if pat_type == 5 {
|
|
9586
|
+ for _, item := range monitor {
|
|
9587
|
+ if item.DoubleCheck == nil {
|
|
9588
|
+
|
|
9589
|
+ mds = append(mds, item)
|
|
9590
|
+
|
|
9591
|
+ }
|
|
9592
|
+
|
|
9593
|
+ }
|
|
9594
|
+ }
|
|
9595
|
+
|
|
9596
|
+ //医嘱未执行
|
|
9597
|
+ if pat_type == 6 {
|
|
9598
|
+ for _, item := range monitor {
|
|
9599
|
+ if len(item.AdviceList) > 0 {
|
|
9600
|
+ mds = append(mds, item)
|
|
9601
|
+ }
|
|
9602
|
+ }
|
|
9603
|
+ }
|
|
9604
|
+ //患者未签名
|
|
9605
|
+ if pat_type == 7 {
|
|
9606
|
+ for _, item := range monitor {
|
|
9607
|
+ if item.DialysisOrder != nil {
|
|
9608
|
+ if item.DialysisOrder.ID > 0 {
|
|
9609
|
+ mds = append(mds, item)
|
|
9610
|
+ }
|
|
9611
|
+ }
|
|
9612
|
+
|
|
9613
|
+ }
|
|
9614
|
+ }
|
|
9615
|
+ //目标超滤于实际超滤不同
|
|
9616
|
+ if pat_type == 8 {
|
|
9617
|
+ for _, item := range monitor {
|
|
9618
|
+ if item.Prescription != nil && item.AssessmentAfterDislysis != nil {
|
|
9619
|
+ if item.Prescription.TargetUltrafiltration != item.AssessmentAfterDislysis.ActualUltrafiltration {
|
|
9620
|
+ mds = append(mds, item)
|
|
9621
|
+ }
|
|
9622
|
+ }
|
|
9623
|
+
|
|
9624
|
+ }
|
|
9625
|
+ }
|
|
9626
|
+ //血压少于5次
|
|
9627
|
+ if pat_type == 9 {
|
|
9628
|
+ for _, item := range monitor {
|
|
9629
|
+ if len(item.MonitoringRecord) < 5 {
|
|
9630
|
+ mds = append(mds, item)
|
|
9631
|
+ }
|
|
9632
|
+ }
|
|
9633
|
+ }
|
|
9634
|
+
|
|
9635
|
+ if pat_type == 10 {
|
|
9636
|
+ for _, item := range monitor {
|
|
9637
|
+ if len(item.MonitoringRecord) == 0 {
|
|
9638
|
+ mds = append(mds, item)
|
|
9639
|
+ }
|
|
9640
|
+ }
|
|
9641
|
+ }
|
|
9642
|
+
|
|
9643
|
+ if pat_type == 11 {
|
|
9644
|
+ for _, item := range monitor {
|
|
9645
|
+ if len(item.MonitoringRecord) > 0 {
|
|
9646
|
+ mds = append(mds, item)
|
|
9647
|
+ }
|
|
9648
|
+ }
|
|
9649
|
+ }
|
|
9650
|
+ if pat_type == 12 {
|
|
9651
|
+ for _, item := range monitor {
|
|
9652
|
+ if len(item.MonitoringRecord) > 0 {
|
|
9653
|
+ mds = append(mds, item)
|
|
9654
|
+ }
|
|
9655
|
+ }
|
|
9656
|
+ }
|
|
9657
|
+ if err == nil {
|
|
9658
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
9659
|
+ "monitor": mds,
|
|
9660
|
+ "patients": patients,
|
|
9661
|
+ })
|
|
9662
|
+ } else {
|
|
9663
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
9664
|
+ }
|
|
9665
|
+}
|