Bläddra i källkod

库存流水展示

XMLWAN 2 år sedan
förälder
incheckning
45810e50c3

+ 12 - 4
controllers/dialysis_api_controller.go Visa fil

598
 				prescription.DisplaceLiquiValue = 0
598
 				prescription.DisplaceLiquiValue = 0
599
 			}
599
 			}
600
 		}
600
 		}
601
+		if adminUserInfo.CurrentOrgId == 10340 && prescription.AdminUserId == 0 {
602
+			prescription.AdminUserId = adminUserInfo.AdminUser.Id
603
+		}
601
 
604
 
602
 		err := service.AddSigleRecord(&prescription)
605
 		err := service.AddSigleRecord(&prescription)
603
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
606
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1179
 		}
1182
 		}
1180
 	}
1183
 	}
1181
 
1184
 
1185
+	if adminUserInfo.CurrentOrgId == 10340 && prescription.AdminUserId == 0 {
1186
+		prescription.AdminUserId = adminUserInfo.AdminUser.Id
1187
+	}
1188
+
1182
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1189
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1183
 
1190
 
1184
 	//获取最新1条
1191
 	//获取最新1条
5235
 
5242
 
5236
 	schedule_type, _ := this.GetInt64("schedule_type")
5243
 	schedule_type, _ := this.GetInt64("schedule_type")
5237
 
5244
 
5238
-	partion_type, _ := this.GetInt64("partion_type")
5239
-
5245
+	//partion_type, _ := this.GetInt64("partion_type")
5246
+	partion_type := this.GetString("partion_type")
5247
+	var ids []string
5248
+	ids = strings.Split(partion_type, ",")
5240
 	start_time := this.GetString("selected_date")
5249
 	start_time := this.GetString("selected_date")
5241
 	timeLayout := "2006-01-02"
5250
 	timeLayout := "2006-01-02"
5242
 	loc, _ := time.LoadLocation("Local")
5251
 	loc, _ := time.LoadLocation("Local")
5243
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5252
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5244
-
5245
-	list, _ := service.GetHisDialysisGoodCount(orgId, schedule_type, partion_type, startTime.Unix())
5253
+	list, _ := service.GetHisDialysisGoodCountTwo(orgId, schedule_type, ids, startTime.Unix())
5246
 
5254
 
5247
 	this.ServeSuccessJSON(map[string]interface{}{
5255
 	this.ServeSuccessJSON(map[string]interface{}{
5248
 		"list": list,
5256
 		"list": list,

+ 3 - 1
controllers/manage_api_controller.go Visa fil

3543
 	orgId := adminUserInfo.CurrentOrgId
3543
 	orgId := adminUserInfo.CurrentOrgId
3544
 	appId := this.GetAdminUserInfo().CurrentAppId
3544
 	appId := this.GetAdminUserInfo().CurrentAppId
3545
 	list, err := service.GetAllDoctorTwo(orgId, appId)
3545
 	list, err := service.GetAllDoctorTwo(orgId, appId)
3546
+	operators, err := service.GetAdminUserEsOne(orgId)
3546
 	if err != nil {
3547
 	if err != nil {
3547
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3548
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3548
 		return
3549
 		return
3549
 	}
3550
 	}
3550
 	this.ServeSuccessJSON(map[string]interface{}{
3551
 	this.ServeSuccessJSON(map[string]interface{}{
3551
-		"list": list,
3552
+		"list":      list,
3553
+		"operators": operators,
3552
 	})
3554
 	})
3553
 }
3555
 }
3554
 
3556
 

+ 10 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

1685
 				prescription.DisplaceLiquiValue = 0
1685
 				prescription.DisplaceLiquiValue = 0
1686
 			}
1686
 			}
1687
 		}
1687
 		}
1688
-
1688
+		if adminUserInfo.Org.Id == 10340 && prescription.AdminUserId == 0 {
1689
+			prescription.AdminUserId = adminUserInfo.AdminUser.Id
1690
+		}
1689
 		err := service.AddSigleRecord(&prescription)
1691
 		err := service.AddSigleRecord(&prescription)
1690
 
1692
 
1691
 		//长沙南雅医院,自动生成抗凝剂的临时处方
1693
 		//长沙南雅医院,自动生成抗凝剂的临时处方
3166
 
3168
 
3167
 	if dialysisPrescription.ID == 0 { //新增
3169
 	if dialysisPrescription.ID == 0 { //新增
3168
 		prescription.Creater = adminUserInfo.AdminUser.Id
3170
 		prescription.Creater = adminUserInfo.AdminUser.Id
3169
-
3171
+		if adminUserInfo.Org.Id == 10340 && prescription.AdminUserId == 0 {
3172
+			prescription.AdminUserId = adminUserInfo.AdminUser.Id
3173
+		}
3170
 	} else { //修改
3174
 	} else { //修改
3171
 		if dialysisPrescription.Creater == 0 {
3175
 		if dialysisPrescription.Creater == 0 {
3172
 			prescription.Creater = adminUserInfo.AdminUser.Id
3176
 			prescription.Creater = adminUserInfo.AdminUser.Id
3174
 			prescription.Creater = dialysisPrescription.Creater
3178
 			prescription.Creater = dialysisPrescription.Creater
3175
 		}
3179
 		}
3176
 
3180
 
3181
+		if adminUserInfo.Org.Id == 10340 && prescription.AdminUserId == 0 {
3182
+			prescription.AdminUserId = adminUserInfo.AdminUser.Id
3183
+		}
3184
+
3177
 		//if/**/
3185
 		//if/**/
3178
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
3186
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
3179
 
3187
 

+ 31 - 0
service/dialysis_solution_service.go Visa fil

522
 	return schedule, err
522
 	return schedule, err
523
 
523
 
524
 }
524
 }
525
+
526
+func GetHisDialysisGoodCountTwo(orgID int64, schedule_type int64, partition_id []string, scheduleDate int64) (schedule []*models.VmBloodScheduleTwo, err error) {
527
+
528
+	db := XTReadDB().Model(&models.VmBloodScheduleTwo{}).Where("xt_schedule.status = 1")
529
+	if scheduleDate > 0 {
530
+		db = db.Where("xt_schedule.schedule_date = ?", scheduleDate)
531
+	}
532
+	if schedule_type > 0 {
533
+		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
534
+	}
535
+	if len(partition_id) > 0 {
536
+		db = db.Where("xt_schedule.partition_id in (?)", partition_id)
537
+	}
538
+	if orgID > 0 {
539
+		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
540
+	}
541
+
542
+	err = db.
543
+		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
544
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
545
+		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
546
+		Preload("HisPrescriptionTemplateSix", func(db *gorm.DB) *gorm.DB {
547
+			return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
548
+				return db.Where("user_org_id = ? and status = 1 and type = 2", orgID).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {
549
+					return db.Where("user_org_id = ? and status = 1 and type = 3 and (frequency_type =1 or (frequency_type =2 and day_count >0) or (frequency_type =3 and week_day<>''))", orgID).Preload("GoodInfo", "org_id =? and status = 1", orgID)
550
+				})
551
+			})
552
+		}).Find(&schedule).Error
553
+
554
+	return schedule, err
555
+}