XMLWAN 4 lat temu
rodzic
commit
317fc8757c

+ 3 - 3
controllers/dialysis_api_controller.go Wyświetl plik

@@ -2906,12 +2906,12 @@ func (this *DialysisApiController) GetTodayMonitor() {
2906 2906
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2907 2907
 
2908 2908
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2909
-			if template.TemplateId == 6 || template.TemplateId == 32 { //adminInfo.CurrentOrgId == 9538
2909
+			if template.TemplateId == 6 { //adminInfo.CurrentOrgId == 9538
2910 2910
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2911 2911
 				record.UltrafiltrationRate = ultrafiltration_rate
2912 2912
 			}
2913 2913
 
2914
-			if template.TemplateId == 20 || template.TemplateId == 22 { //adminInfo.CurrentOrgId == 9538
2914
+			if template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 { //adminInfo.CurrentOrgId == 9538
2915 2915
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
2916 2916
 				record.UltrafiltrationRate = ultrafiltration_rate
2917 2917
 			}
@@ -2933,7 +2933,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
2933 2933
 		}
2934 2934
 	}
2935 2935
 
2936
-	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 {
2936
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 {
2937 2937
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
2938 2938
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
2939 2939
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 35 - 27
controllers/dialysis_record_api_controller.go Wyświetl plik

@@ -549,6 +549,8 @@ func (this *DialysisRecordAPIController) StartDialysis() {
549 549
 
550 550
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
551 551
 	change_nurse, _ := this.GetInt64("change_nurse")
552
+	difficult_puncture_nurse, _ := this.GetInt64("difficult_puncture_nurse")
553
+	new_fistula_nurse, _ := this.GetInt64("new_fistula_nurse")
552 554
 	bedID, _ := this.GetInt64("bed")
553 555
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
554 556
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -706,22 +708,24 @@ func (this *DialysisRecordAPIController) StartDialysis() {
706 708
 	}
707 709
 
708 710
 	dialysisRecord = &models.DialysisOrder{
709
-		DialysisDate:  recordDate.Unix(),
710
-		UserOrgId:     adminUserInfo.CurrentOrgId,
711
-		PatientId:     patientID,
712
-		Stage:         1,
713
-		BedID:         bedID,
714
-		StartNurse:    nurseID,
715
-		Status:        1,
716
-		StartTime:     startDate.Unix(),
717
-		CreatedTime:   time.Now().Unix(),
718
-		UpdatedTime:   time.Now().Unix(),
719
-		PunctureNurse: punctureNurseId,
720
-		Creator:       adminUserInfo.AdminUser.Id,
721
-		Modifier:      adminUserInfo.AdminUser.Id,
722
-		SchedualType:  schedual_type,
723
-		WashpipeNurse: washpipe_nurse,
724
-		ChangeNurse:   change_nurse,
711
+		DialysisDate:           recordDate.Unix(),
712
+		UserOrgId:              adminUserInfo.CurrentOrgId,
713
+		PatientId:              patientID,
714
+		Stage:                  1,
715
+		BedID:                  bedID,
716
+		StartNurse:             nurseID,
717
+		Status:                 1,
718
+		StartTime:              startDate.Unix(),
719
+		CreatedTime:            time.Now().Unix(),
720
+		UpdatedTime:            time.Now().Unix(),
721
+		PunctureNurse:          punctureNurseId,
722
+		Creator:                adminUserInfo.AdminUser.Id,
723
+		Modifier:               adminUserInfo.AdminUser.Id,
724
+		SchedualType:           schedual_type,
725
+		WashpipeNurse:          washpipe_nurse,
726
+		ChangeNurse:            change_nurse,
727
+		DifficultPunctureNurse: difficult_puncture_nurse,
728
+		NewFistulaNurse:        new_fistula_nurse,
725 729
 	}
726 730
 
727 731
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
@@ -1052,6 +1056,8 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1052 1056
 
1053 1057
 	schedual_type, _ := this.GetInt64("schedual_type")
1054 1058
 	change_nurse, _ := this.GetInt64("change_nurse")
1059
+	difficult_puncture_nurse, _ := this.GetInt64("difficult_puncture_nurse")
1060
+	new_fistula_nurse, _ := this.GetInt64("new_fistula_nurse")
1055 1061
 	if record_id == 0 {
1056 1062
 		this.ErrorLog("id:%v", record_id)
1057 1063
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1170,17 +1176,19 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1170 1176
 
1171 1177
 	}
1172 1178
 	dialysisRecord := &models.DialysisOrder{
1173
-		ID:            record_id,
1174
-		UserOrgId:     adminUserInfo.CurrentOrgId,
1175
-		BedID:         bedID,
1176
-		StartNurse:    nurseID,
1177
-		StartTime:     startDate.Unix(),
1178
-		PunctureNurse: puncture_nurse,
1179
-		Creator:       adminUserInfo.AdminUser.Id,
1180
-		Modifier:      adminUserInfo.AdminUser.Id,
1181
-		SchedualType:  schedual_type,
1182
-		WashpipeNurse: washpipe_nurse,
1183
-		ChangeNurse:   change_nurse,
1179
+		ID:                     record_id,
1180
+		UserOrgId:              adminUserInfo.CurrentOrgId,
1181
+		BedID:                  bedID,
1182
+		StartNurse:             nurseID,
1183
+		StartTime:              startDate.Unix(),
1184
+		PunctureNurse:          puncture_nurse,
1185
+		Creator:                adminUserInfo.AdminUser.Id,
1186
+		Modifier:               adminUserInfo.AdminUser.Id,
1187
+		SchedualType:           schedual_type,
1188
+		WashpipeNurse:          washpipe_nurse,
1189
+		ChangeNurse:            change_nurse,
1190
+		DifficultPunctureNurse: difficult_puncture_nurse,
1191
+		NewFistulaNurse:        new_fistula_nurse,
1184 1192
 	}
1185 1193
 
1186 1194
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 27 - 0
controllers/doctors_api_controller.go Wyświetl plik

@@ -27,6 +27,7 @@ func DoctorApiRegistRouters() {
27 27
 	beego.Router("/api/patients/modifydryweightdata", &DoctorsApiController{}, "Get:ModifydryWeightData")
28 28
 	beego.Router("/api/patient/deletedryweight", &DoctorsApiController{}, "Delete:DeleteDryWeight")
29 29
 	beego.Router("/api/schedule/advices", &DoctorsApiController{}, "Get:ScheduleAdvices")
30
+	beego.Router("/api/schedule/getdoctoradvicecount", &DoctorsApiController{}, "Get:GetDoctorAdviceCount")
30 31
 }
31 32
 
32 33
 func (c *DoctorsApiController) ScheduleAdvices() {
@@ -284,3 +285,29 @@ func (c *DoctorsApiController) DeleteDryWeight() {
284 285
 	c.ServeSuccessJSON(returnData)
285 286
 	return
286 287
 }
288
+
289
+func (c *DoctorsApiController) GetDoctorAdviceCount() {
290
+	timeLayout := "2006-01-02"
291
+	loc, _ := time.LoadLocation("Local")
292
+	start_time := c.GetString("start_time")
293
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
294
+
295
+	end_time := c.GetString("end_time")
296
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
297
+
298
+	delive_way := c.GetString("delive_way")
299
+	adminUserInfo := c.GetAdminUserInfo()
300
+	orgId := adminUserInfo.CurrentOrgId
301
+	list, _ := service.GetDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
302
+	if len(list) == 0 {
303
+		list, _ := service.GetHisDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
304
+		c.ServeSuccessJSON(map[string]interface{}{
305
+			"list": list,
306
+		})
307
+	} else {
308
+		c.ServeSuccessJSON(map[string]interface{}{
309
+			"list": list,
310
+		})
311
+	}
312
+
313
+}

+ 39 - 33
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -1518,6 +1518,8 @@ func (this *DialysisAPIController) StartDialysis() {
1518 1518
 	start_time := this.GetString("start_time")
1519 1519
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
1520 1520
 	change_nurse, _ := this.GetInt64("change_nurse")
1521
+	difficult_puncture_nurse, _ := this.GetInt64("difficult_puncture_nurse")
1522
+	new_fistula_nurse, _ := this.GetInt64("new_fistula_nurse")
1521 1523
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
1522 1524
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1523 1525
 		return
@@ -1670,22 +1672,24 @@ func (this *DialysisAPIController) StartDialysis() {
1670 1672
 	}
1671 1673
 
1672 1674
 	dialysisRecord = &models.DialysisOrder{
1673
-		DialysisDate:  recordDate.Unix(),
1674
-		UserOrgId:     adminUserInfo.Org.Id,
1675
-		PatientId:     patientID,
1676
-		Stage:         1,
1677
-		BedID:         bedID,
1678
-		StartNurse:    nurseID,
1679
-		Status:        1,
1680
-		StartTime:     startDate.Unix(),
1681
-		CreatedTime:   time.Now().Unix(),
1682
-		UpdatedTime:   time.Now().Unix(),
1683
-		PunctureNurse: puncture_nurse,
1684
-		Creator:       adminUserInfo.AdminUser.Id,
1685
-		Modifier:      adminUserInfo.AdminUser.Id,
1686
-		SchedualType:  schedual_type,
1687
-		WashpipeNurse: washpipe_nurse,
1688
-		ChangeNurse:   change_nurse,
1675
+		DialysisDate:           recordDate.Unix(),
1676
+		UserOrgId:              adminUserInfo.Org.Id,
1677
+		PatientId:              patientID,
1678
+		Stage:                  1,
1679
+		BedID:                  bedID,
1680
+		StartNurse:             nurseID,
1681
+		Status:                 1,
1682
+		StartTime:              startDate.Unix(),
1683
+		CreatedTime:            time.Now().Unix(),
1684
+		UpdatedTime:            time.Now().Unix(),
1685
+		PunctureNurse:          puncture_nurse,
1686
+		Creator:                adminUserInfo.AdminUser.Id,
1687
+		Modifier:               adminUserInfo.AdminUser.Id,
1688
+		SchedualType:           schedual_type,
1689
+		WashpipeNurse:          washpipe_nurse,
1690
+		ChangeNurse:            change_nurse,
1691
+		DifficultPunctureNurse: difficult_puncture_nurse,
1692
+		NewFistulaNurse:        new_fistula_nurse,
1689 1693
 	}
1690 1694
 
1691 1695
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.Org.Id, patientID, dialysisRecord)
@@ -2119,19 +2123,17 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2119 2123
 	var ultrafiltration_rate float64
2120 2124
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
2121 2125
 	if prescription.ID > 0 {
2122
-		fmt.Println("444444444")
2123 2126
 
2124 2127
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2125
-			fmt.Println("4444444445555")
2126 2128
 
2127 2129
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2128
-			if template.TemplateId == 6 || template.TemplateId == 32 {
2129
-				fmt.Println("12222222")
2130
+			if template.TemplateId == 6 {
2131
+
2130 2132
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2131 2133
 				record.UltrafiltrationRate = ultrafiltration_rate
2132 2134
 			}
2133 2135
 
2134
-			if template.TemplateId == 20 || template.TemplateId == 22 {
2136
+			if template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 {
2135 2137
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
2136 2138
 				record.UltrafiltrationRate = ultrafiltration_rate
2137 2139
 			}
@@ -2153,7 +2155,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2153 2155
 		}
2154 2156
 	}
2155 2157
 
2156
-	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 { //adminInfo.Org.Id == 9538
2158
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 { //adminInfo.Org.Id == 9538
2157 2159
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
2158 2160
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
2159 2161
 			record.UltrafiltrationVolume = ultrafiltration_volume
@@ -2175,6 +2177,8 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
2175 2177
 	schedual_type, _ := this.GetInt64("schedual_type")
2176 2178
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
2177 2179
 	change_nurse, _ := this.GetInt64("change_nurse")
2180
+	difficult_puncture_nurse, _ := this.GetInt64("difficult_puncture_nurse")
2181
+	new_fistula_nurse, _ := this.GetInt64("new_fistula_nurse")
2178 2182
 	if record_id == 0 {
2179 2183
 		this.ErrorLog("id:%v", record_id)
2180 2184
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -2293,17 +2297,19 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
2293 2297
 
2294 2298
 	}
2295 2299
 	dialysisRecord := &models.DialysisOrder{
2296
-		ID:            record_id,
2297
-		UserOrgId:     adminUserInfo.Org.Id,
2298
-		BedID:         bedID,
2299
-		StartNurse:    nurseID,
2300
-		StartTime:     startDate.Unix(),
2301
-		PunctureNurse: puncture_nurse,
2302
-		Creator:       adminUserInfo.AdminUser.Id,
2303
-		Modifier:      adminUserInfo.AdminUser.Id,
2304
-		WashpipeNurse: washpipe_nurse,
2305
-		SchedualType:  schedual_type,
2306
-		ChangeNurse:   change_nurse,
2300
+		ID:                     record_id,
2301
+		UserOrgId:              adminUserInfo.Org.Id,
2302
+		BedID:                  bedID,
2303
+		StartNurse:             nurseID,
2304
+		StartTime:              startDate.Unix(),
2305
+		PunctureNurse:          puncture_nurse,
2306
+		Creator:                adminUserInfo.AdminUser.Id,
2307
+		Modifier:               adminUserInfo.AdminUser.Id,
2308
+		WashpipeNurse:          washpipe_nurse,
2309
+		SchedualType:           schedual_type,
2310
+		ChangeNurse:            change_nurse,
2311
+		DifficultPunctureNurse: difficult_puncture_nurse,
2312
+		NewFistulaNurse:        new_fistula_nurse,
2307 2313
 	}
2308 2314
 
2309 2315
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 4 - 2
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Wyświetl plik

@@ -889,9 +889,11 @@ func (this *IndexEvaluationApiController) GetNurseWorkloadTableData() {
889 889
 		theEndtTIme = theTime.Unix()
890 890
 	}
891 891
 	data, total, _ := statistics_service.GetNurseWorkloadTableData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, admin_user_id, page, limit)
892
+	dialysisCount, _ := statistics_service.GetOrderDialysisCount(adminUserInfo.Org.Id, theStartTIme, theEndtTIme)
892 893
 	this.ServeSuccessJSON(map[string]interface{}{
893
-		"data":  data,
894
-		"total": total,
894
+		"data":          data,
895
+		"total":         total,
896
+		"dialysisCount": dialysisCount,
895 897
 	})
896 898
 }
897 899
 

+ 24 - 0
controllers/patient_api_controller.go Wyświetl plik

@@ -832,6 +832,30 @@ func (c *PatientApiController) UpdateDialysisSolution() {
832 832
 	solution.UpdatedTime = time.Now().Unix()
833 833
 
834 834
 	err := service.UpdatePatientDialysisSolution(&solution)
835
+
836
+	nowTimeUinx := time.Now()
837
+	today := nowTimeUinx.Format("2006-01-02")
838
+	timeLayout := "2006-01-02"
839
+	loc, _ := time.LoadLocation("Local")
840
+	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
841
+	prescription := models.DialysisPrescription{
842
+		Dialyzer:                   solution.Dialyzer,
843
+		Anticoagulant:              solution.Anticoagulant,
844
+		AnticoagulantShouji:        solution.AnticoagulantShouji,
845
+		AnticoagulantWeichi:        solution.AnticoagulantWeichi,
846
+		AnticoagulantZongliang:     solution.AnticoagulantZongliang,
847
+		ModeId:                     solution.ModeId,
848
+		DialysisDurationHour:       solution.DialysisDurationHour,
849
+		Kalium:                     solution.Kalium,
850
+		Sodium:                     solution.Sodium,
851
+		Calcium:                    solution.Calcium,
852
+		TargetUltrafiltration:      solution.TargetUltrafiltration,
853
+		DialyzerPerfusionApparatus: solution.DialyzerPerfusionApparatus,
854
+		BloodAccess:                solution.BloodAccess,
855
+		DialysateFlow:              solution.DialysateFlow,
856
+		DialysateTemperature:       solution.DialysateTemperature,
857
+	}
858
+	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
835 859
 	if err != nil {
836 860
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisSolutionUpdate)
837 861
 		return

+ 5 - 2
controllers/pc_index_evaluation_api_controller.go Wyświetl plik

@@ -859,6 +859,7 @@ func (this *PCIndexEvaluationApiController) GetNurseWorkloadChartData() {
859 859
 	}
860 860
 
861 861
 	data, _ := statistics_service.GetNurseWorkloadChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type, admin_user_id)
862
+
862 863
 	this.ServeSuccessJSON(map[string]interface{}{
863 864
 		"data": data,
864 865
 	})
@@ -898,9 +899,11 @@ func (this *PCIndexEvaluationApiController) GetNurseWorkloadTableData() {
898 899
 		theEndtTIme = theTime.Unix()
899 900
 	}
900 901
 	data, total, _ := statistics_service.GetNurseWorkloadTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, admin_user_id, page, limit)
902
+	dialysisCount, _ := statistics_service.GetOrderDialysisCount(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme)
901 903
 	this.ServeSuccessJSON(map[string]interface{}{
902
-		"data":  data,
903
-		"total": total,
904
+		"data":          data,
905
+		"total":         total,
906
+		"dialysisCount": dialysisCount,
904 907
 	})
905 908
 }
906 909
 

+ 5 - 4
controllers/schedule_api_controller.go Wyświetl plik

@@ -49,7 +49,7 @@ func ScheduleApiRegistRouters() {
49 49
 func (c *ScheduleApiController) GetWeekPanels() {
50 50
 
51 51
 	data, _ := c.GetInt64("data", 1)
52
-
52
+	patitionId, _ := c.GetInt64("patitionid")
53 53
 	adminInfo := c.GetAdminUserInfo()
54 54
 	thisTime := time.Now()
55 55
 	year, monthTime, day := thisTime.Date()
@@ -80,7 +80,7 @@ func (c *ScheduleApiController) GetWeekPanels() {
80 80
 	}
81 81
 
82 82
 	if data == 1 {
83
-		partitions, _ := service.GetSchedulePartitionPanel(adminInfo.CurrentOrgId)
83
+		partitions, _ := service.GetSchedulePartitionPanelOne(adminInfo.CurrentOrgId, patitionId)
84 84
 		returnData["partitions"] = partitions
85 85
 	}
86 86
 
@@ -90,6 +90,8 @@ func (c *ScheduleApiController) GetWeekPanels() {
90 90
 
91 91
 func (c *ScheduleApiController) GetSchedules() {
92 92
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
93
+	partition_id, _ := c.GetInt64("partition_id")
94
+	schedule_type, _ := c.GetInt64("schedule_type")
93 95
 
94 96
 	adminInfo := c.GetAdminUserInfo()
95 97
 
@@ -135,8 +137,7 @@ func (c *ScheduleApiController) GetSchedules() {
135 137
 	weekStartPoint := theStarTime.Unix()
136 138
 	weekEndPoint := theEndTime.Unix()
137 139
 
138
-	schdules, _ := service.GetWeekSchedule(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint)
139
-
140
+	schdules, _ := service.GetWeekScheduleOne(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, partition_id, schedule_type)
140 141
 	c.ServeSuccessJSON(map[string]interface{}{
141 142
 		"days":      days,
142 143
 		"weekTitle": weekTitle,

+ 9 - 0
models/common_models.go Wyświetl plik

@@ -593,3 +593,12 @@ type BloodLapsetoCount struct {
593 593
 	LapsetoTime int64 `gorm:"column:lapseto_time" json:"lapseto_time" form:"lapseto_time"`
594 594
 	LapsetoType int64 `gorm:"column:lapseto_type" json:"lapseto_type" form:"lapseto_type"`
595 595
 }
596
+
597
+type BloodDialysisOrderOne struct {
598
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
599
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
600
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
601
+	ModeId      int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
602
+	Count       int64
603
+	StartNurse  int64 `gorm:"column:start_nurse" json:"start_nurse" form:"start_nurse"`
604
+}

+ 34 - 25
models/dialysis.go Wyświetl plik

@@ -712,31 +712,33 @@ type DialysisOrders struct {
712 712
 }
713 713
 
714 714
 type DialysisOrder struct {
715
-	ID             int64         `gorm:"column:id" json:"id"`
716
-	DialysisDate   int64         `gorm:"column:dialysis_date" json:"dialysis_date"`
717
-	UserOrgId      int64         `gorm:"column:user_org_id" json:"user_org_id"`
718
-	PatientId      int64         `gorm:"column:patient_id" json:"patient_id"`
719
-	PrescriptionId int64         `gorm:"column:prescription_id" json:"prescription_id"`
720
-	Stage          int64         `gorm:"column:stage" json:"stage"`
721
-	Remark         string        `gorm:"column:remark" json:"remark"`
722
-	BedID          int64         `gorm:"column:bed_id" json:"bed_id"`
723
-	StartNurse     int64         `gorm:"column:start_nurse" json:"start_nurse"`
724
-	FinishNurse    int64         `gorm:"column:finish_nurse" json:"finish_nurse"`
725
-	Status         int64         `gorm:"column:status" json:"status"`
726
-	CreatedTime    int64         `gorm:"column:created_time" json:"created_time"`
727
-	UpdatedTime    int64         `gorm:"column:updated_time" json:"updated_time"`
728
-	DeviceNumber   DeviceNumber  `gorm:"ForeignKey:BedID"`
729
-	StartTime      int64         `gorm:"column:start_time" json:"start_time"`
730
-	EndTime        int64         `gorm:"column:end_time" json:"end_time"`
731
-	PunctureNurse  int64         `gorm:"column:puncture_nurse" json:"puncture_nurse"`
732
-	Creator        int64         `gorm:"column:creator" json:"creator"`
733
-	Modifier       int64         `gorm:"column:modifier" json:"modifier"`
734
-	FinishCreator  int64         `gorm:"column:finish_creator" json:"finish_creator"`
735
-	FinishModifier int64         `gorm:"column:finish_modifier" json:"finish_modifier"`
736
-	SchedualType   int64         `gorm:"column:schedual_type" json:"schedual_type"`
737
-	UserAdminRole  UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:StartNurse;"`
738
-	WashpipeNurse  int64         `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
739
-	ChangeNurse    int64         `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
715
+	ID                     int64         `gorm:"column:id" json:"id"`
716
+	DialysisDate           int64         `gorm:"column:dialysis_date" json:"dialysis_date"`
717
+	UserOrgId              int64         `gorm:"column:user_org_id" json:"user_org_id"`
718
+	PatientId              int64         `gorm:"column:patient_id" json:"patient_id"`
719
+	PrescriptionId         int64         `gorm:"column:prescription_id" json:"prescription_id"`
720
+	Stage                  int64         `gorm:"column:stage" json:"stage"`
721
+	Remark                 string        `gorm:"column:remark" json:"remark"`
722
+	BedID                  int64         `gorm:"column:bed_id" json:"bed_id"`
723
+	StartNurse             int64         `gorm:"column:start_nurse" json:"start_nurse"`
724
+	FinishNurse            int64         `gorm:"column:finish_nurse" json:"finish_nurse"`
725
+	Status                 int64         `gorm:"column:status" json:"status"`
726
+	CreatedTime            int64         `gorm:"column:created_time" json:"created_time"`
727
+	UpdatedTime            int64         `gorm:"column:updated_time" json:"updated_time"`
728
+	DeviceNumber           DeviceNumber  `gorm:"ForeignKey:BedID"`
729
+	StartTime              int64         `gorm:"column:start_time" json:"start_time"`
730
+	EndTime                int64         `gorm:"column:end_time" json:"end_time"`
731
+	PunctureNurse          int64         `gorm:"column:puncture_nurse" json:"puncture_nurse"`
732
+	Creator                int64         `gorm:"column:creator" json:"creator"`
733
+	Modifier               int64         `gorm:"column:modifier" json:"modifier"`
734
+	FinishCreator          int64         `gorm:"column:finish_creator" json:"finish_creator"`
735
+	FinishModifier         int64         `gorm:"column:finish_modifier" json:"finish_modifier"`
736
+	SchedualType           int64         `gorm:"column:schedual_type" json:"schedual_type"`
737
+	UserAdminRole          UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:StartNurse;"`
738
+	WashpipeNurse          int64         `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
739
+	ChangeNurse            int64         `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
740
+	DifficultPunctureNurse int64         `gorm:"column:difficult_puncture_nurse" json:"difficult_puncture_nurse" form:"difficult_puncture_nurse"`
741
+	NewFistulaNurse        int64         `gorm:"column:new_fistula_nurse" json:"new_fistula_nurse" form:"new_fistula_nurse"`
740 742
 }
741 743
 
742 744
 func (DialysisOrder) TableName() string {
@@ -1000,3 +1002,10 @@ type XtDialysisBeforePrepare struct {
1000 1002
 	CommdityCode      string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
1001 1003
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
1002 1004
 }
1005
+
1006
+type BloodDoctorAdvice struct {
1007
+	AdviceName  string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
1008
+	AdviceDesc  string `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
1009
+	DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1010
+	Total       int64
1011
+}

+ 1 - 0
service/drug_stock_service.go Wyświetl plik

@@ -18,6 +18,7 @@ type DrugConfig struct {
18 18
 	DrugSpecs    []DrugConfig `gorm:"ForeignKey:DrugName;AssociationForeignKey:DrugName" json:"drug_specs"`
19 19
 	RetailPrice  float64      `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
20 20
 	LastPrice    float64      `gorm:"column:last_price" json:"last_price" form:"last_price"`
21
+	MinUnit      string       `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
21 22
 }
22 23
 
23 24
 func (DrugConfig) TableName() string {

+ 40 - 2
service/mobile_dialysis_service.go Wyświetl plik

@@ -721,7 +721,7 @@ type MScheduleDoctorAdviceVM struct {
721 721
 	DeviceNumber           *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
722 722
 	DoctorAdvices          []*MDoctorAdviceVM               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
723 723
 	Prescription           *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
724
-	DialysisAssesmentBefor *models.DialysisAssesmentBefor   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assesmentbefor"`
724
+	DialysisAssesmentBefor *models.DialysisAssesmentBefor   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
725 725
 }
726 726
 
727 727
 func (MScheduleDoctorAdviceVM) TableName() string {
@@ -1128,7 +1128,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
1128 1128
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
1129 1129
 	tx := writeDb.Begin()
1130 1130
 	updateTime := time.Now().Unix()
1131
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse}).Error
1131
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse}).Error
1132 1132
 	if err != nil {
1133 1133
 		tx.Rollback()
1134 1134
 		return err
@@ -1728,3 +1728,41 @@ func GetHisDoctorPatientById(orgid int64, patientid int64, recordtime int64) (ad
1728 1728
 	err = db.Select("x.id,x.user_org_id,x.patient_id,x.his_patient_id,x.advice_type,x.advice_date,x.start_time,x.advice_name,x.advice_desc,x.reminder_date,x.single_dose,x.single_dose_unit,x.single_dose_unit,x.prescribing_number_unit,x.prescribing_number,x.delivery_way,x.execution_frequency,x.advice_doctor,x.status,x.advice_affirm,x.remark,x.stop_time,x.stop_reason,x.stop_doctor,x.stop_state,x.parent_id,x.execution_time,x.execution_staff,x.checker,x.record_date,x.dialysis_order_id,x.check_time,x.check_state,x.drug_spec,x.drug_spec_unit,x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.template_id,x.modifier,x.drug_id,x.price,x.prescription_id,x.med_list_codg,x.feedetl_sn,x.day").Find(&advice).Error
1729 1729
 	return advice, err
1730 1730
 }
1731
+
1732
+func GetDoctorAdviceCount(startime int64, endtime int64, deliveway string, orgid int64) (advice []*models.BloodDoctorAdvice, err error) {
1733
+
1734
+	db := XTReadDB().Table("xt_doctor_advice as x").Where("x.status = 1 and x.advice_type =2")
1735
+	if startime > 0 {
1736
+		db = db.Where("x.advice_date >= ?", startime)
1737
+	}
1738
+	if endtime > 0 {
1739
+		db = db.Where("x.advice_date<=?", endtime)
1740
+	}
1741
+	if orgid > 0 {
1742
+		db = db.Where("x.user_org_id = ?", orgid)
1743
+	}
1744
+	if len(deliveway) > 0 {
1745
+		db = db.Where("x.delivery_way = ?", deliveway)
1746
+	}
1747
+	err = db.Select("x.advice_name,x.advice_desc,x.delivery_way,count(x.id) as total").Group("x.advice_name,x.advice_desc").Scan(&advice).Error
1748
+	return advice, err
1749
+}
1750
+
1751
+func GetHisDoctorAdviceCount(startime int64, endtime int64, deliveway string, orgid int64) (advice []*models.BloodDoctorAdvice, err error) {
1752
+
1753
+	db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1 and x.advice_type =2")
1754
+	if startime > 0 {
1755
+		db = db.Where("x.advice_date >= ?", startime)
1756
+	}
1757
+	if endtime > 0 {
1758
+		db = db.Where("x.advice_date<=?", endtime)
1759
+	}
1760
+	if orgid > 0 {
1761
+		db = db.Where("x.user_org_id = ?", orgid)
1762
+	}
1763
+	if len(deliveway) > 0 {
1764
+		db = db.Where("x.delivery_way = ?", deliveway)
1765
+	}
1766
+	err = db.Select("x.advice_name,x.advice_desc,x.delivery_way,count(x.id) as total").Group("x.advice_name,x.advice_desc").Scan(&advice).Error
1767
+	return advice, err
1768
+}

+ 6 - 0
service/patient_service.go Wyświetl plik

@@ -1467,3 +1467,9 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1467 1467
 	}
1468 1468
 	return order, err
1469 1469
 }
1470
+
1471
+func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1472
+
1473
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature}).Error
1474
+	return err
1475
+}

+ 31 - 3
service/schedule_service.go Wyświetl plik

@@ -18,6 +18,18 @@ func GetSchedulePartitionPanel(orgID int64) (partitions []*models.Partition, err
18 18
 	return
19 19
 }
20 20
 
21
+func GetSchedulePartitionPanelOne(orgID int64, partionId int64) (partitions []*models.Partition, err error) {
22
+	fmt.Println("partionId3333333333333333", partionId)
23
+	if partionId > 0 {
24
+		err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1 and zone_id = ?", orgID, partionId).Where("org_id=? and status=1 and id = ?", orgID, partionId).Find(&partitions).Error
25
+	}
26
+	if partionId == 0 {
27
+		err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Find(&partitions).Error
28
+	}
29
+
30
+	return
31
+}
32
+
21 33
 func GetPatientWithScheduleAndSolution(orgID int64, keywords string, weekStart, weekEnd, schedule, contagion int64) (patients []*models.Patients, err error) {
22 34
 	db := readDb.Table("xt_patients as p").
23 35
 		Preload("DialysisSolutions", "user_org_id=? and initiate_mode=1 and affirm_state=1 and parent_id=0 and status=1", orgID).
@@ -44,9 +56,25 @@ func GetPatientWithScheduleAndSolution(orgID int64, keywords string, weekStart,
44 56
 
45 57
 func GetWeekSchedule(orgID int64, start, end int64) (schedules []*models.Schedule, err error) {
46 58
 
47
-	err = readDb.
48
-		Table("xt_schedule as s").
49
-		Preload("PatientInfectiousDiseases", "status = 1 ").
59
+	err = readDb.Table("xt_schedule as s").Preload("PatientInfectiousDiseases", "status = 1 ").
60
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
61
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
62
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
63
+		Order("updated_time asc").
64
+		Find(&schedules).Error
65
+	return
66
+}
67
+
68
+func GetWeekScheduleOne(orgID int64, start, end int64, partionid int64, scheduletype int64) (schedules []*models.Schedule, err error) {
69
+
70
+	db := readDb.Table("xt_schedule as s")
71
+	if partionid > 0 {
72
+		db = db.Where("s.partition_id = ?", partionid)
73
+	}
74
+	if scheduletype > 0 {
75
+		db = db.Where("s.schedule_type = ?", scheduletype)
76
+	}
77
+	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
50 78
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
51 79
 		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
52 80
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").

+ 104 - 0
service/statistics_service/index_evaluation_service.go Wyświetl plik

@@ -1272,7 +1272,16 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1272 1272
 	var NewTotalThree int64
1273 1273
 	var NewTotalFour int64
1274 1274
 
1275
+	var NewTotalFive int64
1276
+	var NewTotalSix int64
1277
+	var NewTotalSeven int64
1278
+	var NewTotalEight int64
1279
+
1275 1280
 	db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalOne)
1281
+	db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalFive)
1282
+	db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalSix)
1283
+	db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalSeven)
1284
+	db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalEight)
1276 1285
 	db.Table("xt_monitoring_record as monitor ").Joins("join xt_schedule sch On sch.schedule_date = monitor.monitoring_date AND sch.patient_id = monitor.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("monitor.user_org_id = ? AND monitor.status = 1  AND monitor.monitoring_date >= ? AND monitor.monitoring_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalThree)
1277 1286
 	db.Table("xt_treatment_summary as summary").Joins("join xt_schedule sch On sch.schedule_date = summary.assessment_date AND sch.patient_id = summary.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("summary.user_org_id = ? AND summary.status = 1  AND summary.assessment_date >= ? AND summary.assessment_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalFour)
1278 1287
 
@@ -1320,6 +1329,67 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1320 1329
 		}
1321 1330
 		break
1322 1331
 
1332
+	case 4:
1333
+		for _, item := range datas {
1334
+			var Total int64
1335
+			db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.change_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1336
+			item.ChangeNuserCount = Total
1337
+			if math.IsNaN(float64(item.ChangeNuserCount) / float64(NewTotalFive)) {
1338
+				item.ChangeRatio = "0.0"
1339
+			} else {
1340
+				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.ChangeNuserCount)/float64(NewTotalFive))*100), 64)
1341
+				item.ChangeRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1342
+			}
1343
+
1344
+		}
1345
+
1346
+		break
1347
+
1348
+	case 5:
1349
+		for _, item := range datas {
1350
+			var Total int64
1351
+			db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.difficult_puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1352
+			item.DiffiCultPuntureNuserCount = Total
1353
+			if math.IsNaN(float64(item.DiffiCultPuntureNuserCount) / float64(NewTotalSix)) {
1354
+				item.DiffiCultNuserRatio = "0.0"
1355
+			} else {
1356
+				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.DiffiCultPuntureNuserCount)/float64(NewTotalSix))*100), 64)
1357
+				item.DiffiCultNuserRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1358
+			}
1359
+
1360
+		}
1361
+		break
1362
+
1363
+	case 6:
1364
+		for _, item := range datas {
1365
+			var Total int64
1366
+			db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.new_fistula_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1367
+			item.NewNuserCount = Total
1368
+			if math.IsNaN(float64(item.NewNuserCount) / float64(NewTotalSeven)) {
1369
+				item.NewNuserRatio = "0.0"
1370
+			} else {
1371
+				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.NewNuserCount)/float64(NewTotalSeven))*100), 64)
1372
+				item.NewNuserRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1373
+			}
1374
+
1375
+		}
1376
+		break
1377
+
1378
+	case 7:
1379
+		for _, item := range datas {
1380
+			var Total int64
1381
+			db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.start_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1382
+			item.StartNuserCount = Total
1383
+			if math.IsNaN(float64(item.StartNuserCount) / float64(NewTotalEight)) {
1384
+				item.StartNuserRatio = "0.0"
1385
+			} else {
1386
+				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.StartNuserCount)/float64(NewTotalEight))*100), 64)
1387
+				item.StartNuserRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1388
+			}
1389
+
1390
+		}
1391
+		break
1392
+
1323 1393
 	}
1324 1394
 
1325 1395
 	if err != nil {
@@ -1346,14 +1416,28 @@ func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int
1346 1416
 		var Total int64
1347 1417
 		var TotalTwo int64
1348 1418
 		var TotalThree int64
1419
+		var TotalFour int64
1420
+		var TotalFive int64
1421
+		var TotalSix int64
1422
+		var TotalSeven int64
1349 1423
 		//db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1350 1424
 		//db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where  d.user_org_id = ?  AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1351 1425
 		db.Table("xt_monitoring_record as monitor ").Joins("join xt_schedule sch On sch.schedule_date = monitor.monitoring_date AND sch.patient_id = monitor.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("monitor.user_org_id = ? AND monitor.status = 1 AND monitor.monitoring_nurse = ? AND monitor.monitoring_date >= ? AND monitor.monitoring_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
1352 1426
 		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1353 1427
 		db.Table("xt_treatment_summary as summary").Joins("join xt_schedule sch On sch.schedule_date = summary.assessment_date AND sch.patient_id = summary.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("summary.user_org_id = ? AND summary.status = 1 AND summary.creater = ? AND summary.assessment_date >= ? AND summary.assessment_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
1428
+
1429
+		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.change_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalFour)
1430
+		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.difficult_puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalFive)
1431
+		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.new_fistula_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalSix)
1432
+		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.start_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalSeven)
1433
+
1354 1434
 		item.PunctureCount = Total
1355 1435
 		item.CureCount = TotalTwo
1356 1436
 		item.MissionCount = TotalThree
1437
+		item.ChangeNuserCount = TotalFour
1438
+		item.DiffiCultPuntureNuserCount = TotalFive
1439
+		item.NewNuserCount = TotalSix
1440
+		item.StartNuserCount = TotalSeven
1357 1441
 	}
1358 1442
 
1359 1443
 	if err != nil {
@@ -1776,3 +1860,23 @@ func FindOrgInspectionCount(user_org_id int64) (count int64, err error) {
1776 1860
 	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ?", user_org_id).Count(&count).Error
1777 1861
 	return
1778 1862
 }
1863
+
1864
+func GetOrderDialysisCount(orgid int64, startime int64, endtime int64) (order []*models.BloodDialysisOrderOne, err error) {
1865
+	db := service.XTReadDB()
1866
+	table := db.Table("xt_schedule as s")
1867
+	fmt.Println(table)
1868
+	d := db.Table("xt_patients as p")
1869
+	fmt.Println(d)
1870
+	db = db.Table("xt_dialysis_order as o").Where("o.status = 1")
1871
+	if orgid > 0 {
1872
+		db = db.Where("o.user_org_id = ?", orgid)
1873
+	}
1874
+	if startime > 0 {
1875
+		db = db.Where("o.dialysis_date>=?", startime)
1876
+	}
1877
+	if endtime > 0 {
1878
+		db = db.Where("o.dialysis_date<=?", endtime)
1879
+	}
1880
+	err = db.Group("o.start_nurse,s.mode_id").Select("s.mode_id,s.patient_id,count(s.mode_id) as count,o.start_nurse").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id ").Where("s.schedule_date = o.dialysis_date and s.status = 1 and o.user_org_id = ?", orgid).Scan(&order).Error
1881
+	return order, err
1882
+}

+ 10 - 0
service/statistics_service/index_models.go Wyświetl plik

@@ -131,6 +131,11 @@ type VMUserAdminRole struct {
131 131
 	CureCount           int64 `gorm:"-" json:"cure_count" `
132 132
 	MissionCount        int64 `gorm:"-" json:"mission_count" `
133 133
 
134
+	ChangeNuserCount           int64 `gorm:"-" json:"change_nuser_count" `
135
+	DiffiCultPuntureNuserCount int64 `gorm:"-" json:"difficult_nuser_count" `
136
+	NewNuserCount              int64 `gorm:"-" json:"new_nuser_count" `
137
+	StartNuserCount            int64 `gorm:"-" json:"start_nuser_count" `
138
+
134 139
 	PRatio      string `gorm:"-" json:"p_ratio"`
135 140
 	CourseRatio string `gorm:"-" json:"course_ratio" `
136 141
 	RescueRatio string `gorm:"-" json:"rescue_ratio" `
@@ -139,6 +144,11 @@ type VMUserAdminRole struct {
139 144
 	ChangemedicineRatio string `gorm:"-" json:"change_medicine_ratio" `
140 145
 	CureRatio           string `gorm:"-" json:"cure_ratio" `
141 146
 	MissionRatio        string `gorm:"-" json:"mission_ratio" `
147
+
148
+	ChangeRatio         string `gorm:"-" json:"change_nurse_ratio" `
149
+	DiffiCultNuserRatio string `gorm:"-" json:"difficult_nurse_ratio" `
150
+	NewNuserRatio       string `gorm:"-" json:"new_nurse_ratio" `
151
+	StartNuserRatio     string `gorm:"-" json:"start_nurse_ratio" `
142 152
 }
143 153
 
144 154
 func (VMUserAdminRole) TableName() string {