瀏覽代碼

11月9日库存管理

XMLWAN 2 年之前
父節點
當前提交
01f88d11e1

+ 5 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

736
 		if adminUserInfo.Org.Id == 10307 || adminUserInfo.Org.Id == 10445 {
736
 		if adminUserInfo.Org.Id == 10307 || adminUserInfo.Org.Id == 10445 {
737
 			afterevaluation.ActualUltrafiltration = weight_loss * 1000 //中能建的计量单位是毫升(ml)
737
 			afterevaluation.ActualUltrafiltration = weight_loss * 1000 //中能建的计量单位是毫升(ml)
738
 		}
738
 		}
739
+		//北方营口
740
+		if adminUserInfo.Org.Id == 10445 {
741
+			prescribe, _ := service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
742
+			afterevaluation.ActualDisplacement = prescribe.DisplaceLiquiValue
743
+		}
739
 
744
 
740
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
745
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
741
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis"
746
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis"

+ 22 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

87
 	defer redis.Close()
87
 	defer redis.Close()
88
 
88
 
89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
+
90
 	scheduals_json_str, _ := redis.Get(key).Result()
91
 	scheduals_json_str, _ := redis.Get(key).Result()
92
+
91
 	redis.Set(key, "", time.Second)
93
 	redis.Set(key, "", time.Second)
92
 	patients, _ := service.GetAllPatientListSix(orgID)
94
 	patients, _ := service.GetAllPatientListSix(orgID)
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
95
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
786
 		firstCheckDate = firstCheckDateUnix.Unix()
788
 		firstCheckDate = firstCheckDateUnix.Unix()
787
 	}
789
 	}
788
 
790
 
789
-	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10340 {
791
+	if adminUserInfo.Org.Id == 10340 {
790
 
792
 
791
 		list, _ := service.GetRoleList(adminUserInfo.Org.Id, modifier)
793
 		list, _ := service.GetRoleList(adminUserInfo.Org.Id, modifier)
792
 		_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
794
 		_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
967
 		defer redis.Close()
969
 		defer redis.Close()
968
 		//清空key 值
970
 		//清空key 值
969
 		redis.Set(key, "", time.Second)
971
 		redis.Set(key, "", time.Second)
972
+
973
+		keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
974
+		redis.Set(keyOne, "", time.Second)
975
+
970
 		if err == nil {
976
 		if err == nil {
971
 			c.ServeSuccessJSON(map[string]interface{}{
977
 			c.ServeSuccessJSON(map[string]interface{}{
972
 				"receiveTreatmentAsses": receiveTreatmentAsses,
978
 				"receiveTreatmentAsses": receiveTreatmentAsses,
996
 		defer redis.Close()
1002
 		defer redis.Close()
997
 		//清空key 值
1003
 		//清空key 值
998
 		redis.Set(key, "", time.Second)
1004
 		redis.Set(key, "", time.Second)
1005
+
1006
+		fmt.Println("--------------------------------", recordDateStr)
1007
+		keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1008
+
1009
+		redis.Set(keyOne, "", time.Second)
999
 		if err == nil {
1010
 		if err == nil {
1000
 			c.ServeSuccessJSON(map[string]interface{}{
1011
 			c.ServeSuccessJSON(map[string]interface{}{
1001
 				"receiveTreatmentAsses": receiveTreatmentAsses,
1012
 				"receiveTreatmentAsses": receiveTreatmentAsses,
1617
 		redis.Set(key, "", time.Second)
1628
 		redis.Set(key, "", time.Second)
1618
 
1629
 
1619
 		keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1630
 		keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1631
+
1620
 		//清空key 值
1632
 		//清空key 值
1621
 		redis.Set(keyOne, "", time.Second)
1633
 		redis.Set(keyOne, "", time.Second)
1622
 
1634
 
1849
 
1861
 
1850
 		tempassessmentAfterDislysis.ActualTreatmentHour = hour
1862
 		tempassessmentAfterDislysis.ActualTreatmentHour = hour
1851
 		tempassessmentAfterDislysis.ActualTreatmentMinute = minute
1863
 		tempassessmentAfterDislysis.ActualTreatmentMinute = minute
1864
+
1852
 	}
1865
 	}
1853
 
1866
 
1854
 	if fmonitorRecords.ID > 0 && endmonitorRecords.ID > 0 {
1867
 	if fmonitorRecords.ID > 0 && endmonitorRecords.ID > 0 {
1870
 			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1883
 			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1871
 		}
1884
 		}
1872
 
1885
 
1873
-		tempassessmentAfterDislysis.ActualDisplacement = endmonitorRecords.DisplacementQuantity
1886
+		//北方营口医院
1887
+		if adminUserInfo.Org.Id == 10445 {
1888
+			//获取最后一条透析处方数据
1889
+			lastprescription, _ := service.GetLastDialysisPrescriptionByPatientIdTwo(adminUserInfo.Org.Id, id, recordDate.Unix())
1890
+			tempassessmentAfterDislysis.ActualDisplacement = lastprescription.DisplaceLiquiValue
1891
+		} else {
1892
+			tempassessmentAfterDislysis.ActualDisplacement = endmonitorRecords.DisplacementQuantity
1893
+		}
1874
 
1894
 
1875
 	}
1895
 	}
1876
 
1896
 

+ 4 - 4
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go 查看文件

300
 	}
300
 	}
301
 
301
 
302
 	// stockType, _ := service.GetStockType(orgid)
302
 	// stockType, _ := service.GetStockType(orgid)
303
-	// zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
303
+	//zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
304
 	// if err != nil {
304
 	// if err != nil {
305
 	// 	this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
305
 	// 	this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
306
 	// 	return
306
 	// 	return
308
 	this.ServeSuccessJSON(map[string]interface{}{
308
 	this.ServeSuccessJSON(map[string]interface{}{
309
 		"schedule": list,
309
 		"schedule": list,
310
 		// "stockType": stockType,
310
 		// "stockType": stockType,
311
-		// "zonelist":  zonelist,
311
+		//"zonelist":  zonelist,
312
 	})
312
 	})
313
 
313
 
314
 	// id := this.GetMobileAdminUserInfo().Org.Id
314
 	// id := this.GetMobileAdminUserInfo().Org.Id
534
 func (this *StaffScheduleApiController) UpdateBloodSchedule() {
534
 func (this *StaffScheduleApiController) UpdateBloodSchedule() {
535
 
535
 
536
 	patient_id, _ := this.GetInt64("patient_id")
536
 	patient_id, _ := this.GetInt64("patient_id")
537
-	fmt.Println(patient_id)
538
 	mode_id, _ := this.GetInt64("mode_id")
537
 	mode_id, _ := this.GetInt64("mode_id")
539
 	schedule_type, _ := this.GetInt64("schedule_type")
538
 	schedule_type, _ := this.GetInt64("schedule_type")
540
 	start_time, _ := this.GetInt64("start_time")
539
 	start_time, _ := this.GetInt64("start_time")
541
 	bed_id, _ := this.GetInt64("bed_id")
540
 	bed_id, _ := this.GetInt64("bed_id")
541
+	orgid := this.GetMobileAdminUserInfo().Org.Id
542
 	//更改排班
542
 	//更改排班
543
 	schedule := models.XtSchedule{
543
 	schedule := models.XtSchedule{
544
 		ScheduleType: schedule_type,
544
 		ScheduleType: schedule_type,
546
 	}
546
 	}
547
 
547
 
548
 	//查询该床位该班次是否存在排班
548
 	//查询该床位该班次是否存在排班
549
-	_, errschedulecode := service.GetPatientScheduleIsExist(start_time, schedule_type, bed_id)
549
+	_, errschedulecode := service.GetPatientScheduleIsExist(start_time, schedule_type, bed_id, orgid)
550
 	if errschedulecode == gorm.ErrRecordNotFound {
550
 	if errschedulecode == gorm.ErrRecordNotFound {
551
 		service.UpdatedSchedule(schedule, patient_id, start_time, schedule_type, bed_id)
551
 		service.UpdatedSchedule(schedule, patient_id, start_time, schedule_type, bed_id)
552
 		this.ServeSuccessJSON(map[string]interface{}{
552
 		this.ServeSuccessJSON(map[string]interface{}{

+ 21 - 0
models/schedule_models.go 查看文件

610
 func (WeekScheduleSeven) TableName() string {
610
 func (WeekScheduleSeven) TableName() string {
611
 	return "xt_schedule"
611
 	return "xt_schedule"
612
 }
612
 }
613
+
614
+type ScheduleNewPatients struct {
615
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
616
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
617
+	PartitionId         int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
618
+	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
619
+	PatientId           int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
620
+	ScheduleDate        int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
621
+	ScheduleType        int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
622
+	ScheduleWeek        int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
623
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
624
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
625
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
626
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
627
+	IsExport            int64  `gorm:"column:is_export" json:"is_export" form:"is_export"`
628
+	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
629
+}
630
+
631
+func (ScheduleNewPatients) TableName() string {
632
+	return "xt_schedule"
633
+}

+ 3 - 3
service/doctor_schedule_service.go 查看文件

746
 	return &prescription, nil
746
 	return &prescription, nil
747
 }
747
 }
748
 
748
 
749
-func GetPatientScheduleIsExist(startime int64, schedule_type int64, bed_id int64) (*models.Schedule, error) {
749
+func GetPatientScheduleIsExist(startime int64, schedule_type int64, bed_id int64, user_org_id int64) (*models.ScheduleNewPatients, error) {
750
 
750
 
751
-	schedule := models.Schedule{}
752
-	err := XTReadDB().Model(&schedule).Where("schedule_date = ? and schedule_type = ? and bed_id = ? and status = 1", startime, schedule_type, bed_id).Find(&schedule).Error
751
+	schedule := models.ScheduleNewPatients{}
752
+	err := XTReadDB().Model(&schedule).Where("schedule_date = ? and schedule_type = ? and bed_id = ? and status = 1 and user_org_id = ?", startime, schedule_type, bed_id, user_org_id).Find(&schedule).Error
753
 	if err == gorm.ErrRecordNotFound {
753
 	if err == gorm.ErrRecordNotFound {
754
 		return nil, err
754
 		return nil, err
755
 	}
755
 	}

+ 1 - 1
service/mobile_dialysis_service.go 查看文件

38
 	}
38
 	}
39
 
39
 
40
 	err := db.Preload("DialysisLastOrder", func(db *gorm.DB) *gorm.DB {
40
 	err := db.Preload("DialysisLastOrder", func(db *gorm.DB) *gorm.DB {
41
-		return db.Order("dialysis_date desc").Where("status = 1 AND user_org_id = ? and dialysis_date < ?", orgID, scheduleDate)
41
+		return db.Order("dialysis_date desc").Where(" status = 1 AND user_org_id = ? and dialysis_date>=1672502400 && dialysis_date < ?", orgID, scheduleDate)
42
 	}).Preload("DialysisSolution", "status = 1 and user_org_id = ? and solution_status = 1", orgID).Find(&vms).Error
42
 	}).Preload("DialysisSolution", "status = 1 and user_org_id = ? and solution_status = 1", orgID).Find(&vms).Error
43
 	return vms, err
43
 	return vms, err
44
 }
44
 }