Kaynağa Gözat

提交代码

陈少旭 9 ay önce
ebeveyn
işleme
ac4c639a87

+ 2 - 2
controllers/statistics_api_controller.go Dosyayı Görüntüle

@@ -1238,8 +1238,8 @@ func (c *StatisticsApiController) GetDialyzerDetail() {
1238 1238
 }
1239 1239
 func (c *StatisticsApiController) GetDialyzerConfig() {
1240 1240
 	dialyzers, _ := service.GetDialyzerSummary(c.GetAdminUserInfo().CurrentOrgId)
1241
-	Irrigation, _ := service.GetIrrigationSummary(c.GetAdminUserInfo().CurrentOrgId)
1242
-	dialyzers = append(dialyzers, Irrigation...)
1241
+	//Irrigation, _ := service.GetIrrigationSummary(c.GetAdminUserInfo().CurrentOrgId)
1242
+	//dialyzers = append(dialyzers, Irrigation...)
1243 1243
 	c.ServeSuccessJSON(map[string]interface{}{
1244 1244
 		"dialyzers": dialyzers,
1245 1245
 	})

+ 1 - 0
models/patient_models.go Dosyayı Görüntüle

@@ -334,6 +334,7 @@ type DialysisPrescription struct {
334 334
 	TubingHemodialysis         int64         `gorm:"column:tubing_hemodialysis" json:"tubing_hemodialysis"`
335 335
 	Package                    int64         `gorm:"column:package" json:"package"`
336 336
 	ALiquid                    int64         `gorm:"column:a_liquid" json:"a_liquid"`
337
+	QCPatients                 QCPatients    `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientID;"`
337 338
 	UserAdminRole              UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:Creater;"`
338 339
 	PreImpulse                 float64       `gorm:"column:pre_impulse" json:"pre_impulse" form:"pre_impulse"`
339 340
 	AnticoagulantStopTimeMin   int64         `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`

+ 10 - 1
service/statistis_qc_service.go Dosyayı Görüntüle

@@ -608,6 +608,15 @@ func GetDialyzerData(start_time int64, end_time int64, org_id int64) (dr []Dialy
608 608
 	return
609 609
 }
610 610
 
611
+func GetIrrigationData(start_time int64, end_time int64, org_id int64) (dr []DialyzerResult, err error) {
612
+	err = XTReadDB().Model(&models.DialysisPrescription{}).
613
+		Select("dialysis_irrigation as dialyzer, COUNT(*) as count").
614
+		Where("record_date >= ? and record_date <= ? and user_org_id = ? and status = 1", start_time, end_time, org_id).
615
+		Group("dialysis_irrigation").
616
+		Scan(&dr).Error
617
+	return
618
+}
619
+
611 620
 func GetDialyzerTotal(start_time int64, end_time int64, org_id int64) (total int64, err error) {
612 621
 	err = XTReadDB().Model(&models.DialysisPrescription{}).
613 622
 		Where("status = 1 and record_date >= ? and record_date <= ? and user_org_id = ? and dialysis_dialyszers <> ''", start_time, end_time, org_id).
@@ -617,7 +626,7 @@ func GetDialyzerTotal(start_time int64, end_time int64, org_id int64) (total int
617 626
 
618 627
 func GetPrescriptionByAnticoagulant(page int64, limit int64, orgid int64, anticoagulant int64, start_time int64, end_time int64) (solution []*models.DialysisPrescription, total int64, err error) {
619 628
 
620
-	db := XTReadDB().Model(&models.DialysisPrescription{}).Where("status = 1")
629
+	db := XTReadDB().Model(&models.DialysisPrescription{}).Preload("QCPatients", "status = 1 and user_org_id = ?", orgid).Where("status = 1")
621 630
 	if anticoagulant > 0 {
622 631
 		db = db.Where("anticoagulant = ?", anticoagulant)
623 632
 	}