XMLWAN 4 gadus atpakaļ
vecāks
revīzija
f20deafbb1

+ 3 - 0
controllers/new_mobile_api_controllers/common_api_controller.go Parādīt failu

@@ -709,6 +709,8 @@ func (this *CommonApiController) GetDialysislist() {
709 709
 	prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
710 710
 	list, totallist, _ := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
711 711
 	fmt.Println("err", err)
712
+	//获取每个病人每个透析模式的数据
713
+	modeIdCount, parseDateErr := service.GetModeIdCount(statime, entime, orgId, page, limit)
712 714
 	if err != nil {
713 715
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
714 716
 		return
@@ -720,6 +722,7 @@ func (this *CommonApiController) GetDialysislist() {
720 722
 		"totallist":        totallist,
721 723
 		"prescriptionList": prescriptionList,
722 724
 		"count":            count,
725
+		"modeIdCount":      modeIdCount,
723 726
 	})
724 727
 }
725 728
 

+ 27 - 21
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go Parādīt failu

@@ -62,27 +62,30 @@ func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
62 62
 		var elist []interface{}
63 63
 		for _, item := range patient {
64 64
 			//查询当前日期的病人是否存在数据
65
-			_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgid, theTime.Unix())
66
-			if errcode == gorm.ErrRecordNotFound {
67
-				//查询每个病人透析处方的最后一次数据
68
-				prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgid)
69
-				vlist = append(vlist, prescription)
70
-			} else if errcode == nil {
71
-				//获取当前日期
72
-				prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
73
-				vlist = append(vlist, prescription)
74
-			}
75
-
76
-			_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, orgid, theTime.Unix())
77
-			if errcodes == gorm.ErrRecordNotFound {
78
-				//查询每个病人透前评估的最后一次数据
79
-				dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, orgid)
80
-				elist = append(elist, dialysis)
81
-			} else if errcodes == nil {
82
-				dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
83
-				elist = append(elist, dialysis)
84
-			}
85
-
65
+			//_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgid, theTime.Unix())
66
+			//if errcode == gorm.ErrRecordNotFound {
67
+			//	//查询每个病人透析处方的最后一次数据
68
+			//	prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgid)
69
+			//	vlist = append(vlist, prescription)
70
+			//} else if errcode == nil {
71
+			//	//获取当前日期
72
+			//	prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
73
+			//	vlist = append(vlist, prescription)
74
+			//}
75
+			//
76
+			//_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, orgid, theTime.Unix())
77
+			//if errcodes == gorm.ErrRecordNotFound {
78
+			//	//查询每个病人透前评估的最后一次数据
79
+			//	dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, orgid)
80
+			//	elist = append(elist, dialysis)
81
+			//} else if errcodes == nil {
82
+			//	dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
83
+			//	elist = append(elist, dialysis)
84
+			//}
85
+			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
86
+			vlist = append(vlist, prescription)
87
+			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
88
+			elist = append(elist, dialysis)
86 89
 		}
87 90
 		if err == nil {
88 91
 			this.ServeSuccessJSON(map[string]interface{}{
@@ -108,11 +111,14 @@ func (this *DialysisParamerterApiController) GetMobileWareHouseOutList() {
108 111
 	fmt.Println(start_time, end_time)
109 112
 	orgId := this.GetMobileAdminUserInfo().Org.Id
110 113
 	wareoutlist, err := service.GetWareHouseOutList(startime.Unix(), endtime.Unix(), orgId)
114
+	count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
111 115
 	if err == nil {
112 116
 		this.ServeSuccessJSON(map[string]interface{}{
113 117
 			"wareoutlist": wareoutlist,
118
+			"count":       count,
114 119
 		})
115 120
 	}
121
+
116 122
 }
117 123
 
118 124
 func (this *DialysisParamerterApiController) GetAllMobileMaterial() {

+ 6 - 0
models/common_models.go Parādīt failu

@@ -574,3 +574,9 @@ type XtPatientsInspection struct {
574 574
 	RangeType    int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
575 575
 	RangeValue   string `gorm:"column:range_value" json:"range_value" form:"range_value"`
576 576
 }
577
+
578
+type BloodDialysisModeIdCount struct {
579
+	PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
580
+	ModeId    int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
581
+	Count     int64
582
+}

+ 19 - 0
service/common_service.go Parādīt failu

@@ -3317,3 +3317,22 @@ func TotalSysNoStandCount(orgid int64, startime int64, endtime int64, sysmin int
3317 3317
 	err = db.Select("x.id,x.user_org_id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.status = 1 and(x.systolic_blood_pressure<=? or x.systolic_blood_pressure>=?) or (x.diastolic_blood_pressure<=? or x.diastolic_blood_pressure>=?)", sysmin, syslarge, diamin, dialarge).Group("x.monitoring_date,x.patient_id").Offset(offset).Limit(limit).Order("x.monitoring_date desc").Scan(&record).Error
3318 3318
 	return record, err
3319 3319
 }
3320
+
3321
+func GetModeIdCount(startime int64, endtime int64, orgid int64, page int64, limit int64) (order []*models.BloodDialysisModeIdCount, err error) {
3322
+
3323
+	table := XTReadDB().Table("xt_schedule as s")
3324
+	fmt.Println("table", table)
3325
+	db := XTReadDB().Table("xt_dialysis_order as o")
3326
+	if orgid > 0 {
3327
+		db = db.Where("o.user_org_id = ?", orgid)
3328
+	}
3329
+	if startime > 0 {
3330
+		db = db.Where("o.dialysis_date>=?", startime)
3331
+	}
3332
+	if endtime > 0 {
3333
+		db = db.Where("o.dialysis_date<=?", endtime)
3334
+	}
3335
+	offset := (page - 1) * limit
3336
+	err = db.Group(" s.patient_id,s.mode_id").Select("s.mode_id,	s.patient_id,	count(o.id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1 ").Offset(offset).Limit(limit).Scan(&order).Error
3337
+	return order, err
3338
+}