28169 1 年間 前
コミット
e89468db18

+ 2 - 2
controllers/his_api_controller.go ファイルの表示

@@ -8420,7 +8420,7 @@ func (c *HisApiController) GetCompareData() {
8420 8420
 func (c *HisApiController) GetFaPiaoData() {
8421 8421
 	order_id, _ := c.GetInt64("order_id")
8422 8422
 	patient_id, _ := c.GetInt64("patient_id")
8423
-	number := c.GetString("number")
8423
+	//number := c.GetString("number")
8424 8424
 
8425 8425
 	adminUser := c.GetAdminUserInfo()
8426 8426
 	order, _ := service.GetHisOrderByID(order_id)
@@ -8430,7 +8430,7 @@ func (c *HisApiController) GetFaPiaoData() {
8430 8430
 
8431 8431
 	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
8432 8432
 
8433
-	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, number)
8433
+	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, order.MdtrtId)
8434 8434
 
8435 8435
 	his_hospital_record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8436 8436
 

+ 291 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go ファイルの表示

@@ -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
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go ファイルの表示

@@ -199,4 +199,6 @@ func MobileAPIControllersRegisterRouters() {
199 199
 
200 200
 	beego.Router("/m/api/checkmobileinformation", &DialysisAPIController{}, "Get:CheckMobileInformation")
201 201
 
202
+	beego.Router("/m/api/getcontrolmonitorlist", &DialysisAPIController{}, "Get:GetControlMonitorList")
203
+
202 204
 }

+ 9 - 9
controllers/patient_dataconfig_api_controller.go ファイルの表示

@@ -775,15 +775,15 @@ func (this *PatientDataConfigAPIController) CreateCourse() {
775 775
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
776 776
 
777 777
 	adminUserInfo := this.GetAdminUserInfo()
778
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
779
-	if getPatientErr != nil {
780
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
781
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
782
-		return
783
-	} else if patient == nil {
784
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
785
-		return
786
-	}
778
+	//patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
779
+	//if getPatientErr != nil {
780
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
781
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
782
+	//	return
783
+	//} else if patient == nil {
784
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
785
+	//	return
786
+	//}
787 787
 
788 788
 	now := time.Now().Unix()
789 789
 	record := models.PatientDiseaseCourse{

+ 11 - 5
controllers/self_drug_api_congtroller.go ファイルの表示

@@ -3499,15 +3499,21 @@ func (this *SelfDrugApiController) GetSendGoodInformation() {
3499 3499
 
3500 3500
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3501 3501
 	fmt.Println("orgid", orgId)
3502
-	//获取入库数据
3503
-	list, _ := service.GetSendGoodInformation(10265)
3504
-
3505
-	//project, _ := service.GetHisPrescriptionList(10265)
3502
+	list, _ := service.GetWarehouseOutInfo(10489)
3506 3503
 
3507 3504
 	for _, it := range list {
3508
-		service.UpdateGoodFlow(it.ID, it.PackingPrice)
3505
+		service.UpdateWarehosueOutInfo(it.ID, it.WarehouseOutTime)
3509 3506
 	}
3510 3507
 
3508
+	//获取入库数据
3509
+	//list, _ := service.GetSendGoodInformation(10265)
3510
+	//
3511
+	////project, _ := service.GetHisPrescriptionList(10265)
3512
+	//
3513
+	//for _, it := range list {
3514
+	//	service.UpdateGoodFlow(it.ID, it.PackingPrice)
3515
+	//}
3516
+
3511 3517
 	//for _, it := range list {
3512 3518
 	//	//查询是否有数据
3513 3519
 	//	_, errcode := service.GetStockFlush(it.StorehouseId, it.GoodId, it.OrgId)

+ 14 - 0
models/device_models.go ファイルの表示

@@ -1488,3 +1488,17 @@ func (XtDialysisRegistration) TableName() string {
1488 1488
 
1489 1489
 	return "xt_dialysis_registration"
1490 1490
 }
1491
+
1492
+type NewDeviceInformation struct {
1493
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1494
+	Date      int64 `gorm:"column:date" json:"date" form:"date"`
1495
+	Class     int64 `gorm:"column:class" json:"class" form:"class"`
1496
+	Zone      int64 `gorm:"column:zone" json:"zone" form:"zone"`
1497
+	BedNumber int64 `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
1498
+	PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1499
+}
1500
+
1501
+func (NewDeviceInformation) TableName() string {
1502
+
1503
+	return "xt_device_information"
1504
+}

+ 33 - 0
models/new_monitor.go ファイルの表示

@@ -50,6 +50,7 @@ type VMMonitorDialysisOrder struct {
50 50
 	DeviceNumber  DeviceNumber `gorm:"ForeignKey:BedId" json:"device_number"`
51 51
 	StartTime     int64        `gorm:"column:start_time" json:"start_time"`
52 52
 	DialysisTotal int64        `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
53
+	Url           string       `gorm:"column:url" json:"url" form:"url"`
53 54
 }
54 55
 
55 56
 func (VMMonitorDialysisOrder) TableName() string {
@@ -120,6 +121,7 @@ type VMMonitoringRecord struct {
120 121
 	VenousPressure         float64 `gorm:"column:venous_pressure" json:"venous_pressure" form:"venous_pressure"`
121 122
 	ArterialPressure       float64 `gorm:"column:arterial_pressure" json:"arterial_pressure" form:"arterial_pressure"`
122 123
 	BloodOxygenSaturation  string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
124
+	Symptom                string  `gorm:"column:symptom" json:"symptom" form:"symptom"`
123 125
 	Dispose                string  `gorm:"column:dispose" json:"dispose" form:"dispose"`
124 126
 	Result                 string  `gorm:"column:result" json:"result" form:"result"`
125 127
 }
@@ -127,3 +129,34 @@ type VMMonitoringRecord struct {
127 129
 func (VMMonitoringRecord) TableName() string {
128 130
 	return "xt_monitoring_record"
129 131
 }
132
+
133
+type NewMonitorDialysisScheduleList struct {
134
+	ID           int64 `gorm:"column:id" json:"id"`
135
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
136
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id"`
137
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id"`
138
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
139
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
140
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
141
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id"`
142
+	Status       int64 `gorm:"column:status" json:"status"`
143
+
144
+	MonitorPatients *VMMonitorPatients `gorm:"ForeignKey:PatientId" json:"patient"`
145
+	DeviceNumber    *DeviceNumber      `gorm:"ForeignKey:BedId" json:"device_number"`
146
+	DeviceZone      *DeviceZone        `gorm:"ForeignKey:PartitionId" json:"device_zone"`
147
+	TreatmentMode   *TreatmentMode     `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
148
+
149
+	DialysisOrder            *VMMonitorDialysisOrder    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
150
+	Prescription             *VMDialysisPrescription    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
151
+	AssessmentBeforeDislysis *VMPredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
152
+	AssessmentAfterDislysis  *VMAssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
153
+	MonitoringRecord         []*VMMonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
154
+	AdviceList               []*VMDoctorAdviceForList   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"advice"`
155
+	DoubleCheck              *VmDoubleCheck             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dobuleCheck"`
156
+	TreatmentSummaryForList  *VMTreatmentSummaryForList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatmentSummary"`
157
+	NewDeviceInformation     *NewDeviceInformation      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatmentSummary"`
158
+}
159
+
160
+func (NewMonitorDialysisScheduleList) TableName() string {
161
+	return "xt_schedule"
162
+}

+ 16 - 0
models/patient_models.go ファイルの表示

@@ -2004,3 +2004,19 @@ type XtPatientAllergic struct {
2004 2004
 func (XtPatientAllergic) TableName() string {
2005 2005
 	return "xt_patient_allergic"
2006 2006
 }
2007
+
2008
+type VmDoubleCheck struct {
2009
+	ID             int64 `gorm:"column:id" json:"id"`
2010
+	UserOrgId      int64 `gorm:"column:user_org_id" json:"user_org_id"`
2011
+	PatientId      int64 `gorm:"column:patient_id" json:"patient_id"`
2012
+	CheckDate      int64 `gorm:"column:check_date" json:"check_date"`
2013
+	Status         int64 `gorm:"column:status" json:"status"`
2014
+	Creater        int64 `gorm:"column:creater" json:"creater"`
2015
+	Modifier       int64 `gorm:"column:modifier" json:"modifier"`
2016
+	CheckTime      int64 `gorm:"column:check_time" json:"check_time"`
2017
+	FirstCheckTime int64 `gorm:"column:first_check_time" json:"first_check_time"`
2018
+}
2019
+
2020
+func (VmDoubleCheck) TableName() string {
2021
+	return "xt_double_check"
2022
+}

+ 1 - 1
service/manage_service.go ファイルの表示

@@ -1809,7 +1809,7 @@ func GetRegistGoodInforList(user_org_id int64) (good []*models.GoodInformationFo
1809 1809
 
1810 1810
 func GetRegistNumber(sys_record_time int64, good_id int64, user_org_id int64) (infor []*models.WarehouseOutInfoNight, err error) {
1811 1811
 
1812
-	err = XTReadDB().Where("sys_record_time = ? and good_id = ? and org_id = ? and status =1", sys_record_time, good_id, user_org_id).Find(&infor).Error
1812
+	err = XTReadDB().Where("sys_record_time = ? and good_id = ? and org_id = ? and status =1 and is_sys=1", sys_record_time, good_id, user_org_id).Find(&infor).Error
1813 1813
 
1814 1814
 	return infor, err
1815 1815
 }

+ 5 - 7
service/mobile_dialysis_service.go ファイルの表示

@@ -276,13 +276,11 @@ func (MSchedualPatientVM) TableName() string {
276 276
 }
277 277
 
278 278
 type MDialysisOrderVM struct {
279
-	ID           int64 `gorm:"column:id" json:"id"`
280
-	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date"`
281
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
282
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
283
-	// PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
284
-	Stage int64 `gorm:"column:stage" json:"stage"`
285
-	// Remark         string `gorm:"column:remark" json:"remark"`
279
+	ID                 int64                      `gorm:"column:id" json:"id"`
280
+	DialysisDate       int64                      `gorm:"column:dialysis_date" json:"dialysis_date"`
281
+	UserOrgId          int64                      `gorm:"column:user_org_id" json:"user_org_id"`
282
+	PatientId          int64                      `gorm:"column:patient_id" json:"patient_id"`
283
+	Stage              int64                      `gorm:"column:stage" json:"stage"`
286 284
 	BedID              int64                      `gorm:"column:bed_id" json:"bed_id"`
287 285
 	StartNurse         int64                      `gorm:"column:start_nurse" json:"start_nurse"`
288 286
 	FinishNurse        int64                      `gorm:"column:finish_nurse" json:"finish_nurse"`

+ 16 - 0
service/new_stock_service.go ファイルの表示

@@ -571,3 +571,19 @@ func AddCountFlowOne(warehouse_info_id int64, good_id int64, user_org_id int64,
571 571
 	err = XTWriteDB().Model(&stockFlow).Where("warehousing_detail_id = ? and good_id = ? and user_org_id = ? and patient_id = ? AND consumable_type = 7 and system_time = ?").Update(map[string]interface{}{"over_count": over_count}).Error
572 572
 	return err
573 573
 }
574
+
575
+func GetWarehouseOutInfo(user_org_id int64) (info []*models.WarehouseOut, err error) {
576
+
577
+	err = XTReadDB().Where("org_id = ? and status =1", 10489).Find(&info).Error
578
+
579
+	return info, err
580
+}
581
+
582
+func UpdateWarehosueOutInfo(id int64, sys_record_time int64) (models.WarehouseOutInfo, error) {
583
+
584
+	info := models.WarehouseOutInfo{}
585
+
586
+	err := XTWriteDB().Model(&info).Where("warehouse_out_id = ? and org_id = ? ", id, 10489).Updates(map[string]interface{}{"sys_record_time": sys_record_time, "ctime": sys_record_time}).Error
587
+
588
+	return info, err
589
+}

+ 96 - 2
service/patient_service.go ファイルの表示

@@ -2442,9 +2442,21 @@ func GetAllZoneByList(orgID int64) (zone []*models.DeviceZone, err error) {
2442 2442
 	}
2443 2443
 }
2444 2444
 
2445
-func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisOrders []*MDialysisOrderVM, err error) {
2445
+func GetAllDialysisOrdersByListNight(orgID int64, scheduleDate int64, pay_tyep int64) (dialysisOrders []*models.VMMonitorDialysisOrder, err error) {
2446
+
2447
+	if pay_tyep == 0 {
2448
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2449
+	}
2450
+	//待下机
2451
+	if pay_tyep == 3 {
2452
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ? and end_time = 0", orgID, scheduleDate).Find(&dialysisOrders).Error
2453
+	}
2454
+
2455
+	fmt.Println("pay_typeowowowoowwo", pay_tyep)
2456
+	if pay_tyep == 7 {
2457
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?'", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?  and url = ''", orgID, scheduleDate).Find(&dialysisOrders).Error
2458
+	}
2446 2459
 
2447
-	err = readDb.Model(&MDialysisOrderVM{}).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2448 2460
 	return dialysisOrders, err
2449 2461
 }
2450 2462
 
@@ -2551,6 +2563,13 @@ func GetAllDialysisOrdersByListSix(orgID int64, scheduleDate int64) (dialysisOrd
2551 2563
 	return dialysisOrders, err
2552 2564
 }
2553 2565
 
2566
+func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisOrders []*MDialysisOrderVM, err error) {
2567
+
2568
+	err = readDb.Model(&MDialysisOrderVM{}).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2569
+
2570
+	return dialysisOrders, err
2571
+}
2572
+
2554 2573
 func GetAllDialysisOrdersByListOne(orgID int64, scheduleDate int64) (dialysisOrders []*models.VMMonitorDialysisOrder, err error) {
2555 2574
 	redis := RedisClient()
2556 2575
 
@@ -2958,3 +2977,78 @@ func GetPatientAllagicList(patient_id int64, user_org_id int64) (list []*models.
2958 2977
 
2959 2978
 	return list, err
2960 2979
 }
2980
+
2981
+func GetNewMonitorRecord(orgID int64, date int64, partition int64, patientId int64) ([]*models.NewMonitorDialysisScheduleList, error) {
2982
+	var mds []*models.NewMonitorDialysisScheduleList
2983
+
2984
+	db := readDb.Model(&models.NewMonitorDialysisScheduleList{})
2985
+	if date > 0 {
2986
+		db = db.Where("schedule_date = ?", date)
2987
+	}
2988
+	if partition > 0 {
2989
+		db = db.Where("partition_id = ?", partition)
2990
+	}
2991
+	if patientId > 0 {
2992
+
2993
+		db = db.Where("patient_id = ?", patientId)
2994
+	}
2995
+
2996
+	err = db.Where("status = 1 and user_org_id = ?", orgID).Find(&mds).Error
2997
+
2998
+	return mds, err
2999
+}
3000
+
3001
+func GetAdviceList(user_org_id int64, advice_date int64, pat_type int64) (advice []*models.VMDoctorAdviceForList, err error) {
3002
+
3003
+	if pat_type == 0 {
3004
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3005
+	}
3006
+	//待医嘱核对
3007
+	if pat_type == 1 {
3008
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3009
+	}
3010
+	//待医嘱执行
3011
+	if pat_type == 6 {
3012
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2", user_org_id, advice_date).Find(&advice).Error
3013
+
3014
+	}
3015
+	return advice, err
3016
+}
3017
+
3018
+func GetDobuleCheck(user_org_id int64, advice_date int64) (check []*models.VmDoubleCheck, err error) {
3019
+
3020
+	err = XTReadDB().Where("user_org_id = ? and check_date = ? and status = 1", user_org_id, advice_date).Find(&check).Error
3021
+	return check, err
3022
+}
3023
+
3024
+func GetTreatmentSummaryForList(user_org_id int64, advice_date int64) (summary []*models.VMTreatmentSummaryForList, err error) {
3025
+
3026
+	err = XTReadDB().Where("user_org_id =? and assessment_date = ? and status =1", user_org_id, advice_date).Find(&summary).Error
3027
+
3028
+	return summary, err
3029
+}
3030
+
3031
+func GetDialysisInformationList(user_org_id int64, advice_date int64) (information []*models.NewDeviceInformation, err error) {
3032
+
3033
+	err = UserReadDB().Where("user_org_id =? and date = ? and status =1", user_org_id, advice_date).Find(&information).Error
3034
+	return information, err
3035
+}
3036
+
3037
+func GetNewAllMonitorList(orgID int64, scheduleDate int64, pat_type int64) (monitor []*models.VMMonitoringRecord, err error) {
3038
+	if pat_type == 0 || pat_type == 9 {
3039
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ?", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3040
+	}
3041
+
3042
+	if pat_type == 10 {
3043
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND accumulated_blood_volume = 0", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3044
+	}
3045
+
3046
+	if pat_type == 11 {
3047
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND symptom <> ''", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3048
+	}
3049
+
3050
+	if pat_type == 12 {
3051
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND dispose <> ''", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3052
+	}
3053
+	return monitor, err
3054
+}