Browse Source

11月9日库存管理

XMLWAN 2 years ago
parent
commit
01f88d11e1

+ 5 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -736,6 +736,11 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
736 736
 		if adminUserInfo.Org.Id == 10307 || adminUserInfo.Org.Id == 10445 {
737 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 745
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
741 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 View File

@@ -87,7 +87,9 @@ func (this *DialysisAPIController) Scheduals() {
87 87
 	defer redis.Close()
88 88
 
89 89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
+
90 91
 	scheduals_json_str, _ := redis.Get(key).Result()
92
+
91 93
 	redis.Set(key, "", time.Second)
92 94
 	patients, _ := service.GetAllPatientListSix(orgID)
93 95
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -786,7 +788,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
786 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 793
 		list, _ := service.GetRoleList(adminUserInfo.Org.Id, modifier)
792 794
 		_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -967,6 +969,10 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
967 969
 		defer redis.Close()
968 970
 		//清空key 值
969 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 976
 		if err == nil {
971 977
 			c.ServeSuccessJSON(map[string]interface{}{
972 978
 				"receiveTreatmentAsses": receiveTreatmentAsses,
@@ -996,6 +1002,11 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
996 1002
 		defer redis.Close()
997 1003
 		//清空key 值
998 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 1010
 		if err == nil {
1000 1011
 			c.ServeSuccessJSON(map[string]interface{}{
1001 1012
 				"receiveTreatmentAsses": receiveTreatmentAsses,
@@ -1617,6 +1628,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1617 1628
 		redis.Set(key, "", time.Second)
1618 1629
 
1619 1630
 		keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1631
+
1620 1632
 		//清空key 值
1621 1633
 		redis.Set(keyOne, "", time.Second)
1622 1634
 
@@ -1849,6 +1861,7 @@ func (c *DialysisAPIController) Finish() {
1849 1861
 
1850 1862
 		tempassessmentAfterDislysis.ActualTreatmentHour = hour
1851 1863
 		tempassessmentAfterDislysis.ActualTreatmentMinute = minute
1864
+
1852 1865
 	}
1853 1866
 
1854 1867
 	if fmonitorRecords.ID > 0 && endmonitorRecords.ID > 0 {
@@ -1870,7 +1883,14 @@ func (c *DialysisAPIController) Finish() {
1870 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 View File

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

+ 21 - 0
models/schedule_models.go View File

@@ -610,3 +610,24 @@ type WeekScheduleSeven struct {
610 610
 func (WeekScheduleSeven) TableName() string {
611 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 View File

@@ -746,10 +746,10 @@ func GetDialyisSolution(patientid int64, recorddate int64) (*models.DialysisPres
746 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 753
 	if err == gorm.ErrRecordNotFound {
754 754
 		return nil, err
755 755
 	}

+ 1 - 1
service/mobile_dialysis_service.go View File

@@ -38,7 +38,7 @@ func MobileGetDialysisScheduals(orgID int64, scheduleDate int64, scheduleType in
38 38
 	}
39 39
 
40 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 42
 	}).Preload("DialysisSolution", "status = 1 and user_org_id = ? and solution_status = 1", orgID).Find(&vms).Error
43 43
 	return vms, err
44 44
 }