Browse Source

2024/6/17

28169 3 months ago
parent
commit
066e8eafaf

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10191 //机构id
86
+		subscibe.OrgId = 10278 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10191 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 18470 //4
97
 		adminUserInfo.CurrentAppId = 18470 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10191 //机构id小英9675或4
332
+		subscibe.OrgId = 10278 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10191 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 18470 //4
343
 		adminUserInfo.CurrentAppId = 18470 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 34 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

3957
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3957
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3958
 			}
3958
 			}
3959
 
3959
 
3960
+			if adminUserInfo.Org.Id == 10721 {
3961
+				if prescription.ModeId == 2 {
3962
+					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3963
+					if totalMin == 0 {
3964
+						totalMin = 240
3965
+					}
3966
+					if prescription.ReplacementTotal == 0 {
3967
+						prescription.ReplacementTotal = 15
3968
+					}
3969
+
3970
+					//乘10 除10是为了保留一位小数
3971
+					replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
3972
+				}
3973
+			}
3974
+
3975
+		}
3976
+	}
3977
+
3978
+	if adminUserInfo.Org.Id == 10172 {
3979
+		if prescription.ID == 0 {
3980
+
3981
+			if prescription.ModeId == 2 {
3982
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3983
+				if totalMin == 0 {
3984
+					totalMin = 240
3985
+				}
3986
+				if prescription.ReplacementTotal == 0 {
3987
+					prescription.ReplacementTotal = 15
3988
+				}
3989
+
3990
+				//乘10 除10是为了保留一位小数
3991
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
3992
+			}
3993
+
3960
 		}
3994
 		}
3961
 	}
3995
 	}
3962
 
3996
 

+ 20 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

1478
 			PatientType:       patient_type_one,
1478
 			PatientType:       patient_type_one,
1479
 		}
1479
 		}
1480
 		err = service.UpdatedPatient(patients, patient.BloodId)
1480
 		err = service.UpdatedPatient(patients, patient.BloodId)
1481
+
1482
+		record := models.XtPatientLaspseRecord{
1483
+			PatientId:     patients.ID,
1484
+			RecordDate:    time.Now().Unix(),
1485
+			LapseDate:     time.Now().Unix(),
1486
+			LapseType:     lapseto,
1487
+			LapseClass:    0,
1488
+			LapseReason:   "",
1489
+			AdminUserId:   adminInfo.AdminUser.Id,
1490
+			Remark:        "",
1491
+			UserOrgId:     orgid,
1492
+			Ctime:         time.Now().Unix(),
1493
+			Mtime:         time.Now().Unix(),
1494
+			Status:        1,
1495
+			LapseTypeName: "转入",
1496
+			HisType:       0,
1497
+			HisZone:       "",
1498
+			HisBed:        "",
1499
+		}
1500
+		service.CreatePatientRecord(record)
1481
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.BloodId, 10) + ":patient_info"
1501
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.BloodId, 10) + ":patient_info"
1482
 		redis := service.RedisClient()
1502
 		redis := service.RedisClient()
1483
 		defer redis.Close()
1503
 		defer redis.Close()

+ 0 - 3
controllers/schedule_api_controller.go View File

5501
 
5501
 
5502
 			//查询该床位今天是否存在排班
5502
 			//查询该床位今天是否存在排班
5503
 			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
5503
 			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
5504
-			fmt.Println("schwowowoowowowowowo", sch.ID, sch.PatientId)
5505
 
5504
 
5506
 			if sch.ID == 0 {
5505
 			if sch.ID == 0 {
5507
 				////删除排班
5506
 				////删除排班
5579
 		if bed_id != schedule.BedId {
5578
 		if bed_id != schedule.BedId {
5580
 			//查询该床位今天是否存在排班
5579
 			//查询该床位今天是否存在排班
5581
 			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
5580
 			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
5582
-			fmt.Println("schwowowoowowowowowo", sch.ID, sch.PatientId)
5583
 
5581
 
5584
 			if sch.ID == 0 {
5582
 			if sch.ID == 0 {
5585
 				////删除排班
5583
 				////删除排班
5624
 					IsExport:            8888,
5622
 					IsExport:            8888,
5625
 					DialysisMachineName: "",
5623
 					DialysisMachineName: "",
5626
 				}
5624
 				}
5627
-				fmt.Println("idwoowowowowowowoowowowowo", id)
5628
 
5625
 
5629
 				//赵云的ID
5626
 				//赵云的ID
5630
 				// 该床位存在的患者
5627
 				// 该床位存在的患者

+ 5 - 1
service/mobile_dialysis_service.go View File

3318
 
3318
 
3319
 	if orgid == 10721 {
3319
 	if orgid == 10721 {
3320
 		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3320
 		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3321
-			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? and execution_frequency!='上机前' and delivery_way!='口服' ", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3321
+
3322
+			var keyword = "胰岛素"
3323
+
3324
+			keyword = "%" + keyword + "%"
3325
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? and execution_frequency!='上机前' and delivery_way!='口服' and advice_name not like ?", patientid, orgid, recorddate, keyword).Order("created_time asc").Find(&his).Error
3322
 			if err != nil {
3326
 			if err != nil {
3323
 				if err == gorm.ErrRecordNotFound {
3327
 				if err == gorm.ErrRecordNotFound {
3324
 					if len(his) <= 0 {
3328
 					if len(his) <= 0 {

+ 5 - 1
service/patient_service.go View File

513
 
513
 
514
 	if orgID == 10721 {
514
 	if orgID == 10721 {
515
 
515
 
516
+		var keyword = "胰岛素"
517
+
518
+		keyword = "%" + keyword + "%"
519
+
516
 		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
520
 		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
517
-			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ? and execution_frequency !='上机前' and delivery_way!='口服' ", orgID, scheduleDate).Find(&hisAdvices).Error
521
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ? and execution_frequency !='上机前' and delivery_way!='口服' and advice_name not like ? ", orgID, scheduleDate, keyword).Find(&hisAdvices).Error
518
 			if err != nil {
522
 			if err != nil {
519
 				if err == gorm.ErrRecordNotFound {
523
 				if err == gorm.ErrRecordNotFound {
520
 					if len(hisAdvices) <= 0 {
524
 					if len(hisAdvices) <= 0 {

+ 1 - 22
service/schedule_service.go View File

351
 	return err
351
 	return err
352
 }
352
 }
353
 
353
 
354
-func ModeScheduleByTime(startime int64, endtime int64, orgid int64) error {
355
-
356
-	schedule := models.XtSchedule{}
357
-
358
-	err := XTWriteDB().Model(&schedule).Where("schedule_date >? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Updates(map[string]interface{}{"status": 0}).Error
359
-	return err
360
-}
361
-
362
-func ModeScheduleByTimeOne(startime int64, endtime int64, orgid int64) error {
363
-
364
-	schedule := models.XtSchedule{}
365
-
366
-	err := XTWriteDB().Model(&schedule).Where("schedule_date >=? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Updates(map[string]interface{}{"status": 0}).Error
367
-	return err
368
-}
369
-
370
-func UpdateScheduleByOrgId(patientid int64, scheduledate int64, orgid int64, mode_id int64, schedule_type int64, sch *models.XtSchedule) error {
371
-	err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1 and mode_id = ? and schedule_type = ?", patientid, scheduledate, orgid, mode_id, schedule_type).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix()}).Error
372
-	return err
373
-}
374
-
375
 func UpdateScheduleByOrgIdOne(patientid int64, scheduledate int64, orgid int64, sch *models.XtSchedule) error {
354
 func UpdateScheduleByOrgIdOne(patientid int64, scheduledate int64, orgid int64, sch *models.XtSchedule) error {
376
 	err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1", patientid, scheduledate, orgid).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix(), "dialysis_machine_name": sch.DialysisMachineName}).Error
355
 	err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1", patientid, scheduledate, orgid).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix(), "dialysis_machine_name": sch.DialysisMachineName}).Error
377
 	return err
356
 	return err
1918
 
1897
 
1919
 	for _, schedule := range schedules {
1898
 	for _, schedule := range schedules {
1920
 		// Update records with status = 0 where id is less than max_id
1899
 		// Update records with status = 0 where id is less than max_id
1921
-		XTReadDB().Model(&models.XtSchedule{}).Where("patient_id = ? AND schedule_date = ? AND id < ?", schedule.PatientId, schedule.ScheduleDate, schedule.MaxId).Update("status", 0)
1900
+		XTReadDB().Model(&models.XtSchedule{}).Where("patient_id = ? AND schedule_date = ? AND id < ?", schedule.PatientId, schedule.ScheduleDate, schedule.MaxId).Update("status", 0, "remark", "去除重复排班")
1922
 
1901
 
1923
 	}
1902
 	}
1924
 
1903