ソースを参照

库存流水展示

XMLWAN 2 年 前
コミット
45810e50c3

+ 12 - 4
controllers/dialysis_api_controller.go ファイルの表示

@@ -598,6 +598,9 @@ func (c *DialysisApiController) PostPrescription() {
598 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 605
 		err := service.AddSigleRecord(&prescription)
603 606
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -1179,6 +1182,10 @@ func (c *DialysisApiController) PostSoulution() {
1179 1182
 		}
1180 1183
 	}
1181 1184
 
1185
+	if adminUserInfo.CurrentOrgId == 10340 && prescription.AdminUserId == 0 {
1186
+		prescription.AdminUserId = adminUserInfo.AdminUser.Id
1187
+	}
1188
+
1182 1189
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1183 1190
 
1184 1191
 	//获取最新1条
@@ -5235,14 +5242,15 @@ func (this *DialysisApiController) GetHisDialysisGoodCount() {
5235 5242
 
5236 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 5249
 	start_time := this.GetString("selected_date")
5241 5250
 	timeLayout := "2006-01-02"
5242 5251
 	loc, _ := time.LoadLocation("Local")
5243 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 5255
 	this.ServeSuccessJSON(map[string]interface{}{
5248 5256
 		"list": list,

+ 3 - 1
controllers/manage_api_controller.go ファイルの表示

@@ -3543,12 +3543,14 @@ func (this *MachineApiController) GetAllDoctorList() {
3543 3543
 	orgId := adminUserInfo.CurrentOrgId
3544 3544
 	appId := this.GetAdminUserInfo().CurrentAppId
3545 3545
 	list, err := service.GetAllDoctorTwo(orgId, appId)
3546
+	operators, err := service.GetAdminUserEsOne(orgId)
3546 3547
 	if err != nil {
3547 3548
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3548 3549
 		return
3549 3550
 	}
3550 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 ファイルの表示

@@ -1685,7 +1685,9 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1685 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 1691
 		err := service.AddSigleRecord(&prescription)
1690 1692
 
1691 1693
 		//长沙南雅医院,自动生成抗凝剂的临时处方
@@ -3166,7 +3168,9 @@ func (c *DialysisAPIController) PostSolution() {
3166 3168
 
3167 3169
 	if dialysisPrescription.ID == 0 { //新增
3168 3170
 		prescription.Creater = adminUserInfo.AdminUser.Id
3169
-
3171
+		if adminUserInfo.Org.Id == 10340 && prescription.AdminUserId == 0 {
3172
+			prescription.AdminUserId = adminUserInfo.AdminUser.Id
3173
+		}
3170 3174
 	} else { //修改
3171 3175
 		if dialysisPrescription.Creater == 0 {
3172 3176
 			prescription.Creater = adminUserInfo.AdminUser.Id
@@ -3174,6 +3178,10 @@ func (c *DialysisAPIController) PostSolution() {
3174 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 3185
 		//if/**/
3178 3186
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
3179 3187
 

+ 31 - 0
service/dialysis_solution_service.go ファイルの表示

@@ -522,3 +522,34 @@ func GetDialysisAdviceSchedulistTen(orgID int64, schedule_type int64, partition_
522 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
+}