Преглед на файлове

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 преди 2 месеца
родител
ревизия
cde8cb6adf

BIN
XT_New.exe Целия файл


+ 14 - 5
controllers/mobile_api_controllers/check_weight_api_controller.go Целия файл

@@ -547,7 +547,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
547 547
 				}
548 548
 				//err := service.AddSigleRecord(&newprescribe)
549 549
 				var err error
550
-				if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
550
+				if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 || adminUserInfo.Org.Id == 3877 {
551 551
 					prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
552 552
 					if prescriptionTwenty.ID == 0 {
553 553
 						//插入透析处方
@@ -654,7 +654,19 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
654 654
 					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
655 655
 					newprescribe.Remark = lastDialysisPrescription.Remark
656 656
 				}
657
-				err := service.AddSigleRecord(&newprescribe)
657
+
658
+				if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 || adminUserInfo.Org.Id == 3877 {
659
+					prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
660
+					if prescriptionTwenty.ID == 0 {
661
+						//插入透析处方
662
+						service.AddSigleRecord(&newprescribe)
663
+					} else {
664
+						//插入透析处方
665
+						service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
666
+					}
667
+				} else {
668
+					service.AddSigleRecord(&newprescribe)
669
+				}
658 670
 
659 671
 				//记录日志
660 672
 				byterequest, _ := json.Marshal(newprescribe)
@@ -681,9 +693,6 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
681 693
 				keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
682 694
 				redis.Set(keyThree, "", time.Second)
683 695
 				defer redis.Close()
684
-				if err != nil {
685
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
686
-				}
687 696
 
688 697
 			} else {
689 698
 				var newprescribe models.DialysisPrescription

+ 150 - 18
controllers/mobile_api_controllers/dialysis_api_controller.go Целия файл

@@ -2330,7 +2330,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2330 2330
 
2331 2331
 		prescription.ID = dialysisPrescription.ID
2332 2332
 
2333
-		err := service.UpDateDialysisPrescription(&prescription)
2333
+		service.UpDateDialysisPrescription(&prescription)
2334 2334
 
2335 2335
 		//记录日志
2336 2336
 		byterequest, _ := json.Marshal(prescription)
@@ -2360,7 +2360,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2360 2360
 			PatientId:  id,
2361 2361
 		}
2362 2362
 
2363
-		dialysisFinish, err := service.GetDialysisFinish(adminUserInfo.Org.Id, recordDate.Unix(), 1, id)
2363
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.Org.Id, recordDate.Unix(), 1, id)
2364 2364
 		if dialysisFinish.ID == 0 {
2365 2365
 			service.CreateDialysisFinish(finish)
2366 2366
 		}
@@ -2400,21 +2400,20 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2400 2400
 		keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_prescribe_by_mode"
2401 2401
 		redis.Set(keySeven, "", time.Second)
2402 2402
 
2403
-		if err == nil {
2404
-			updateErr := service.UpdateScheduleModeId(patient.ID, adminUserInfo.Org.Id, recordDate.Unix(), mode_id)
2405
-			keyOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
2406
-
2407
-			//清空key 值
2408
-			redis.Set(keyOne, "", time.Second)
2409
-			defer redis.Close()
2410
-			if updateErr != nil {
2411
-				utils.ErrorLog("%v", updateErr)
2412
-			}
2403
+		updateErr := service.UpdateScheduleModeId(patient.ID, adminUserInfo.Org.Id, recordDate.Unix(), mode_id)
2404
+		keyTwoOne := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
2413 2405
 
2414
-			c.ServeSuccessJSON(map[string]interface{}{
2415
-				"prescription": prescription,
2416
-			})
2406
+		//清空key 值
2407
+		redis.Set(keyTwoOne, "", time.Second)
2408
+		defer redis.Close()
2409
+		if updateErr != nil {
2410
+			utils.ErrorLog("%v", updateErr)
2417 2411
 		}
2412
+
2413
+		c.ServeSuccessJSON(map[string]interface{}{
2414
+			"prescription": prescription,
2415
+		})
2416
+
2418 2417
 	}
2419 2418
 
2420 2419
 }
@@ -3421,6 +3420,11 @@ func (this *DialysisAPIController) StartDialysis() {
3421 3420
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3422 3421
 			}
3423 3422
 
3423
+			if adminUserInfo.Org.Id == 10612 {
3424
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
3425
+				ultrafiltration_rate = ultrafiltration_rate / 1000
3426
+			}
3427
+
3424 3428
 		}
3425 3429
 	}
3426 3430
 
@@ -4069,7 +4073,7 @@ func (c *DialysisAPIController) PostSolution() {
4069 4073
 		AdminUserId: adminUserInfo.AdminUser.Id,
4070 4074
 		RecordDate:  prescription.RecordDate,
4071 4075
 		PatientId:   prescription.PatientId,
4072
-		Source:      "手机端新增处方",
4076
+		Source:      "手机端新增长期处方",
4073 4077
 		Status:      1,
4074 4078
 	}
4075 4079
 
@@ -4457,8 +4461,10 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4457 4461
 
4458 4462
 			}
4459 4463
 
4460
-			if adminInfo.Org.Id == 10551 {
4464
+			if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 {
4465
+
4461 4466
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
4467
+				fmt.Println("金阿迪发到付阿道夫", ultrafiltration_rate)
4462 4468
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4463 4469
 			}
4464 4470
 
@@ -4520,7 +4526,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4520 4526
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
4521 4527
 	}
4522 4528
 
4523
-	if adminInfo.Org.Id == 10551 {
4529
+	if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 {
4524 4530
 		ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4525 4531
 
4526 4532
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
@@ -10489,3 +10495,129 @@ func (c *DialysisAPIController) GetLastAcceptRecrods() {
10489 10495
 		"recrods": recrods,
10490 10496
 	})
10491 10497
 }
10498
+
10499
+func (c *DialysisAPIController) ExMobileChangeSch() {
10500
+
10501
+	id_one, _ := c.GetInt64("id_one")
10502
+	id_two, _ := c.GetInt64("id_two")
10503
+	sch, _ := service.GetSchedule(c.GetMobileAdminUserInfo().Org.Id, id_one)
10504
+	sch_two, _ := service.GetSchedule(c.GetMobileAdminUserInfo().Org.Id, id_two)
10505
+
10506
+	//order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
10507
+	//if order2.ID > 0 {
10508
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
10509
+	//	return
10510
+	//}
10511
+
10512
+	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
10513
+	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
10514
+		count, _ := service.GetScheduleCountByDate(c.GetMobileAdminUserInfo().Org.Id, sch_two.ScheduleDate, sch.PatientId)
10515
+		if count > 0 {
10516
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientScheduleRepeat)
10517
+			return
10518
+		}
10519
+
10520
+		count1, _ := service.GetScheduleCountByDate(c.GetMobileAdminUserInfo().Org.Id, sch.ScheduleDate, sch_two.PatientId)
10521
+		if count1 > 0 {
10522
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientScheduleRepeat)
10523
+			return
10524
+		}
10525
+	}
10526
+
10527
+	err := service.UpdateScheduleThree(sch, sch_two)
10528
+
10529
+	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
10530
+	if order.ID > 0 {
10531
+		//查询该患者的排班机位
10532
+		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
10533
+		service.UpdateDialysiOrderByPatientId(id_two, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
10534
+		redis := service.RedisClient()
10535
+		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
10536
+		redis.Set(key, "", time.Second)
10537
+		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
10538
+
10539
+		//清空key 值
10540
+		redis.Set(keyOne, "", time.Second)
10541
+		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
10542
+		//return
10543
+	}
10544
+	if err == nil {
10545
+
10546
+		//去除当天患者排班中重复数据,保留最后一条数据
10547
+		service.UpdateRepeatSchStatus(sch.UserOrgId, sch.ScheduleDate)
10548
+		service.UpdateRepeatSchStatus(sch_two.UserOrgId, sch_two.ScheduleDate)
10549
+
10550
+		c.ServeSuccessJSON(map[string]interface{}{
10551
+			"msg": "交换成功",
10552
+		})
10553
+
10554
+	} else {
10555
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
10556
+		return
10557
+
10558
+	}
10559
+}
10560
+
10561
+func (c *DialysisAPIController) MobileCoverSch() {
10562
+
10563
+	id_one, _ := c.GetInt64("id_one")
10564
+	id_two, _ := c.GetInt64("id_two")
10565
+	sch, _ := service.GetScheduleTen(c.GetMobileAdminUserInfo().Org.Id, id_one)
10566
+	sch_two, _ := service.GetScheduleTen(c.GetMobileAdminUserInfo().Org.Id, id_two)
10567
+
10568
+	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
10569
+	if order.ID > 0 {
10570
+
10571
+		service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
10572
+		redis := service.RedisClient()
10573
+		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
10574
+		redis.Set(key, "", time.Second)
10575
+		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
10576
+
10577
+		//清空key 值
10578
+		redis.Set(keyOne, "", time.Second)
10579
+
10580
+		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
10581
+		//return
10582
+	}
10583
+	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
10584
+	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
10585
+		count, _ := service.GetScheduleCountByDate(c.GetMobileAdminUserInfo().Org.Id, sch_two.ScheduleDate, sch.PatientId)
10586
+		if count > 0 {
10587
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientScheduleRepeat)
10588
+			return
10589
+		}
10590
+	}
10591
+
10592
+	var new_sch models.Schedule
10593
+	new_sch = sch
10594
+	new_sch.BedId = sch_two.BedId
10595
+	new_sch.ScheduleDate = sch_two.ScheduleDate
10596
+	new_sch.ScheduleWeek = sch_two.ScheduleWeek
10597
+	new_sch.PartitionId = sch_two.PartitionId
10598
+	new_sch.ScheduleType = sch_two.ScheduleType
10599
+	new_sch.ID = 0
10600
+	//删除原来的排班
10601
+	err := service.SaveSchTwo(sch, sch_two)
10602
+	//生成新的排班
10603
+	if err == nil {
10604
+		err2 := service.SaveSch(&new_sch)
10605
+		if err2 == nil {
10606
+			//去除当天患者排班中重复数据,保留最后一条数据
10607
+			service.UpdateRepeatSchStatus(sch.UserOrgId, sch.ScheduleDate)
10608
+			service.UpdateRepeatSchStatus(sch_two.UserOrgId, sch_two.ScheduleDate)
10609
+			service.UpdateRepeatSchStatus(new_sch.UserOrgId, new_sch.ScheduleDate)
10610
+
10611
+			c.ServeSuccessJSON(map[string]interface{}{
10612
+				"msg":     "覆盖成功",
10613
+				"new_sch": new_sch,
10614
+			})
10615
+		} else {
10616
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
10617
+			return
10618
+		}
10619
+	} else {
10620
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
10621
+		return
10622
+	}
10623
+}

+ 4 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Целия файл

@@ -208,4 +208,8 @@ func MobileAPIControllersRegisterRouters() {
208 208
 
209 209
 	beego.Router("/m/api/getlastacceptrecrods", &DialysisAPIController{}, "Get:GetLastAcceptRecrods")
210 210
 
211
+	beego.Router("/m/api/sch/exchange", &DialysisAPIController{}, "Get:ExMobileChangeSch")
212
+
213
+	beego.Router("/m/api/sch/coversch", &DialysisAPIController{}, "Get:MobileCoverSch")
214
+
211 215
 }

+ 28 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Целия файл

@@ -1282,3 +1282,31 @@ func (c *StaffScheduleApiController) ChangeScheduleBed() {
1282 1282
 		}
1283 1283
 	}
1284 1284
 }
1285
+
1286
+func (c *StaffScheduleApiController) UpdateMobileSchedule() {
1287
+
1288
+	fmt.Println("hhahdhhfahdfhahdfhahfh")
1289
+	id_one, _ := c.GetInt64("id_one")
1290
+	id_two, _ := c.GetInt64("id_two")
1291
+	schedule_date, _ := c.GetInt64("schedule_date")
1292
+	//timeLayout := "2006-01-02"
1293
+	//loc, _ := time.LoadLocation("Local")
1294
+	//startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", schedule_date+" 00:00:00", loc)
1295
+
1296
+	mode_id, _ := c.GetInt64("mode_id")
1297
+	bed_id, _ := c.GetInt64("bed_id")
1298
+	zone_id, _ := c.GetInt64("zone_id")
1299
+	schedule_type, _ := c.GetInt64("schedule_type")
1300
+	orgId := c.GetMobileAdminUserInfo().Org.Id
1301
+
1302
+	schedule, _ := service.GetSchedulePatientIdByPatient(id_one, schedule_date, orgId)
1303
+
1304
+	if schedule.ID > 0 {
1305
+		service.UpdateMobileSchedule(id_two, mode_id, bed_id, zone_id, schedule_type, schedule.ID)
1306
+	}
1307
+
1308
+	c.ServeSuccessJSON(map[string]interface{}{
1309
+		"msg": "ok",
1310
+	})
1311
+	return
1312
+}

+ 3 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_router.go Целия файл

@@ -35,4 +35,7 @@ func StaffScheduleApiControllersRegisterRouters() {
35 35
 	beego.Router("m/api/schedule/changescheduletype", &StaffScheduleApiController{}, "Get:ChangeScheduleType")
36 36
 
37 37
 	beego.Router("m/api/schedule/changeschedulebed", &StaffScheduleApiController{}, "Get:ChangeScheduleBed")
38
+
39
+	beego.Router("m/api/schedule/updateschedule", &StaffScheduleApiController{}, "Get:UpdateMobileSchedule")
40
+
38 41
 }

+ 571 - 0
controllers/patient_api_controller.go Целия файл

@@ -84,6 +84,54 @@ func PatientApiRegistRouters() {
84 84
 
85 85
 	beego.Router("/api/patient/getexportlist", &PatientApiController{}, "Get:GetExportList")
86 86
 
87
+	beego.Router("/api/patient/savefalloutbedprint", &PatientApiController{}, "Post:SaveFallOutBedPrint")
88
+
89
+	beego.Router("/api/patient/getfalloutbedprintlist", &PatientApiController{}, "Get:GetFallOutBedPrintList")
90
+
91
+	beego.Router("/api/patient/savefilterinformed", &PatientApiController{}, "Post:SaveFilterInformed")
92
+
93
+	beego.Router("/api/patient/getfilterinformed", &PatientApiController{}, "Get:GetFilterInformed")
94
+
95
+	beego.Router("/api/patient/saveprofundainformed", &PatientApiController{}, "Post:SaveProfundaInformed")
96
+
97
+	beego.Router("/api/patient/getprofundainformed", &PatientApiController{}, "Get:GetProfundaInformed")
98
+
99
+	beego.Router("/api/patient/arterovenous", &PatientApiController{}, "Post:SaveArterOvenous")
100
+
101
+	beego.Router("/api/patient/getarterovernous", &PatientApiController{}, "Get:GetArterOverNous")
102
+
103
+	beego.Router("/api/patient/savehighrikinformed", &PatientApiController{}, "Post:SaveHighRikInformed")
104
+
105
+	beego.Router("/api/patient/gethighriskinformed", &PatientApiController{}, "Get:GetHighRiskInformed")
106
+
107
+	beego.Router("/api/patient/saveanticoagulation", &PatientApiController{}, "Post:SaveAnticoagulation")
108
+
109
+	beego.Router("/api/patient/getanticoagulationInformed", &PatientApiController{}, "Get:GetAnticoagulationInformed")
110
+
111
+	beego.Router("/api/patient/savecriticalinfomed", &PatientApiController{}, "Post:SaveCriticalInfomed")
112
+
113
+	beego.Router("/api/patient/getcriticalinformed", &PatientApiController{}, "Get:GetCriticalInformed")
114
+
115
+	beego.Router("/api/patient/savehemoperfusioninformed", &PatientApiController{}, "Post:SaveHemoperfusionInformed")
116
+
117
+	beego.Router("/api/patient/gethemoperfusioninformed", &PatientApiController{}, "Get:GetHemoperfusionInformed")
118
+
119
+	beego.Router("/api/patient/savebringinformed", &PatientApiController{}, "Post:SaveBringInformed")
120
+
121
+	beego.Router("/api/patient/getinformedcontsent", &PatientApiController{}, "Get:GetInformedContsent")
122
+
123
+	beego.Router("/api/patient/savecatheterization", &PatientApiController{}, "Post:SaveCatheterization")
124
+
125
+	beego.Router("/api/patient/getcatheterization", &PatientApiController{}, "Get:GetCatheterization")
126
+
127
+	beego.Router("/api/patient/savedialyzerInformed", &PatientApiController{}, "Post:SaveDialyzerInformed")
128
+
129
+	beego.Router("/api/patient/getdialyzerinformed", &PatientApiController{}, "Get:GetDialyzerInformed")
130
+
131
+	beego.Router("/api/patient/savetheapyinformed", &PatientApiController{}, "Post:SaveTheapyInformed")
132
+
133
+	beego.Router("api/patient/gettherapyinformed", &PatientApiController{}, "Get:GetTherapyInformed")
134
+
87 135
 }
88 136
 func (c *PatientApiController) GetExportList() {
89 137
 	startTime := c.GetString("start_time")
@@ -6060,3 +6108,526 @@ func (c *PatientApiController) GetDialysisSolutionDetailList() {
6060 6108
 		"total": total,
6061 6109
 	})
6062 6110
 }
6111
+
6112
+func (c *PatientApiController) SaveFallOutBedPrint() {
6113
+
6114
+	adminInfo := c.GetAdminUserInfo()
6115
+	orgid := adminInfo.CurrentOrgId
6116
+	dataBody := make(map[string]interface{}, 0)
6117
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6118
+	fmt.Println("err", err)
6119
+	content := dataBody["content"].(string)
6120
+
6121
+	outPrint := models.XtFallOutPrint{
6122
+		UserOrgId: orgid,
6123
+		Content:   content,
6124
+		Status:    1,
6125
+		Ctime:     time.Now().Unix(),
6126
+		Mtime:     time.Now().Unix(),
6127
+	}
6128
+
6129
+	//查询该机构是否存在
6130
+	list, err := service.GetOutPrintList(orgid)
6131
+
6132
+	if list.ID == 0 {
6133
+		service.CreateFallOutBedPrint(outPrint)
6134
+	}
6135
+
6136
+	if list.ID > 0 {
6137
+		service.UpdateFallOutBedPrint(list.ID, content)
6138
+	}
6139
+
6140
+	c.ServeSuccessJSON(map[string]interface{}{
6141
+		"list": list,
6142
+	})
6143
+}
6144
+
6145
+func (c *PatientApiController) GetFallOutBedPrintList() {
6146
+
6147
+	adminInfo := c.GetAdminUserInfo()
6148
+	orgid := adminInfo.CurrentOrgId
6149
+
6150
+	list, _ := service.GetFallOutBedPrintList(orgid)
6151
+	c.ServeSuccessJSON(map[string]interface{}{
6152
+		"list": list,
6153
+	})
6154
+}
6155
+
6156
+func (c *PatientApiController) SaveFilterInformed() {
6157
+
6158
+	adminInfo := c.GetAdminUserInfo()
6159
+	orgid := adminInfo.CurrentOrgId
6160
+	dataBody := make(map[string]interface{}, 0)
6161
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6162
+	fmt.Println("err", err)
6163
+	content := dataBody["content"].(string)
6164
+	informed := models.XtFilterInformed{
6165
+		UserOrgId: orgid,
6166
+		Content:   content,
6167
+		Status:    1,
6168
+		Ctime:     time.Now().Unix(),
6169
+		Mtime:     time.Now().Unix(),
6170
+	}
6171
+
6172
+	filterInformed, _ := service.GetFilterInformed(orgid)
6173
+
6174
+	if filterInformed.ID == 0 {
6175
+
6176
+		service.CreateFilterInformed(informed)
6177
+	}
6178
+
6179
+	if filterInformed.ID > 0 {
6180
+
6181
+		service.UpdateFilterInformed(filterInformed.ID, content)
6182
+	}
6183
+
6184
+	c.ServeSuccessJSON(map[string]interface{}{
6185
+		"informed": informed,
6186
+	})
6187
+
6188
+}
6189
+
6190
+func (c *PatientApiController) GetFilterInformed() {
6191
+
6192
+	adminInfo := c.GetAdminUserInfo()
6193
+	orgid := adminInfo.CurrentOrgId
6194
+	filterInformed, _ := service.GetFilterInformed(orgid)
6195
+
6196
+	c.ServeSuccessJSON(map[string]interface{}{
6197
+		"list": filterInformed,
6198
+	})
6199
+}
6200
+
6201
+func (c *PatientApiController) SaveProfundaInformed() {
6202
+
6203
+	adminInfo := c.GetAdminUserInfo()
6204
+	orgid := adminInfo.CurrentOrgId
6205
+	dataBody := make(map[string]interface{}, 0)
6206
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6207
+	fmt.Println("err", err)
6208
+	content := dataBody["content"].(string)
6209
+
6210
+	informed := models.XtProfundaInformed{
6211
+		UserOrgId: orgid,
6212
+		Content:   content,
6213
+		Status:    1,
6214
+		Ctime:     time.Now().Unix(),
6215
+		Mtime:     time.Now().Unix(),
6216
+	}
6217
+
6218
+	profundaInformed, _ := service.GetProfundaInformed(orgid)
6219
+
6220
+	if profundaInformed.ID == 0 {
6221
+		service.CreateProfundaInformed(informed)
6222
+	}
6223
+
6224
+	if profundaInformed.ID > 0 {
6225
+
6226
+		service.UpdateProfundaInformed(profundaInformed.ID, content)
6227
+	}
6228
+
6229
+	c.ServeSuccessJSON(map[string]interface{}{
6230
+		"list": profundaInformed,
6231
+	})
6232
+}
6233
+
6234
+func (c *PatientApiController) GetProfundaInformed() {
6235
+
6236
+	adminInfo := c.GetAdminUserInfo()
6237
+	orgid := adminInfo.CurrentOrgId
6238
+
6239
+	profundaInformed, _ := service.GetProfundaInformed(orgid)
6240
+
6241
+	c.ServeSuccessJSON(map[string]interface{}{
6242
+		"list": profundaInformed,
6243
+	})
6244
+}
6245
+
6246
+func (c *PatientApiController) SaveArterOvenous() {
6247
+
6248
+	adminInfo := c.GetAdminUserInfo()
6249
+	orgid := adminInfo.CurrentOrgId
6250
+
6251
+	dataBody := make(map[string]interface{}, 0)
6252
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6253
+	fmt.Println("err", err)
6254
+	content := dataBody["content"].(string)
6255
+
6256
+	arterOvenous := models.XtArterOvenous{
6257
+		UserOrgId: orgid,
6258
+		Content:   content,
6259
+		Status:    1,
6260
+		Ctime:     time.Now().Unix(),
6261
+		Mtime:     time.Now().Unix(),
6262
+	}
6263
+
6264
+	list, _ := service.GetArterOvenousList(orgid)
6265
+
6266
+	if list.ID == 0 {
6267
+
6268
+		service.CreateArterOvernous(arterOvenous)
6269
+	}
6270
+
6271
+	if list.ID > 0 {
6272
+		service.UpdateArterOvernous(list.ID, content)
6273
+	}
6274
+
6275
+	c.ServeSuccessJSON(map[string]interface{}{
6276
+		"list": list,
6277
+	})
6278
+}
6279
+
6280
+func (c *PatientApiController) GetArterOverNous() {
6281
+
6282
+	adminInfo := c.GetAdminUserInfo()
6283
+	orgid := adminInfo.CurrentOrgId
6284
+
6285
+	list, _ := service.GetArterOvenousList(orgid)
6286
+
6287
+	c.ServeSuccessJSON(map[string]interface{}{
6288
+		"list": list,
6289
+	})
6290
+
6291
+}
6292
+
6293
+func (c *PatientApiController) SaveHighRikInformed() {
6294
+
6295
+	adminInfo := c.GetAdminUserInfo()
6296
+	orgid := adminInfo.CurrentOrgId
6297
+
6298
+	dataBody := make(map[string]interface{}, 0)
6299
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6300
+	fmt.Println("err", err)
6301
+	content := dataBody["content"].(string)
6302
+
6303
+	risk := models.XtHightRisk{
6304
+		UserOrgId: orgid,
6305
+		Content:   content,
6306
+		Status:    1,
6307
+		Ctime:     time.Now().Unix(),
6308
+		Mtime:     time.Now().Unix(),
6309
+	}
6310
+
6311
+	highRik, _ := service.GetHightRikInformed(orgid)
6312
+
6313
+	if highRik.ID == 0 {
6314
+
6315
+		service.CreateHighRik(risk)
6316
+	}
6317
+
6318
+	if highRik.ID > 0 {
6319
+
6320
+		service.UpdateHighRik(highRik.ID, content)
6321
+	}
6322
+
6323
+	c.ServeSuccessJSON(map[string]interface{}{
6324
+		"list": risk,
6325
+	})
6326
+}
6327
+
6328
+func (c *PatientApiController) GetHighRiskInformed() {
6329
+
6330
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6331
+
6332
+	rikInformed, _ := service.GetHightRikInformed(orgId)
6333
+
6334
+	c.ServeSuccessJSON(map[string]interface{}{
6335
+		"list": rikInformed,
6336
+	})
6337
+}
6338
+
6339
+func (c *PatientApiController) SaveAnticoagulation() {
6340
+
6341
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6342
+	dataBody := make(map[string]interface{}, 0)
6343
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6344
+	fmt.Println("err", err)
6345
+	content := dataBody["content"].(string)
6346
+
6347
+	auticoagutionPrint := models.XtAuticoagutionPrint{
6348
+		Content:   content,
6349
+		UserOrgId: orgId,
6350
+		Status:    1,
6351
+		Ctime:     time.Now().Unix(),
6352
+		Mtime:     time.Now().Unix(),
6353
+	}
6354
+
6355
+	anticoagulation, _ := service.GetAnticoagulation(orgId)
6356
+
6357
+	if anticoagulation.ID == 0 {
6358
+
6359
+		service.CreateAnticoagulation(auticoagutionPrint)
6360
+	}
6361
+
6362
+	if anticoagulation.ID > 0 {
6363
+
6364
+		service.UpdateAnticoagulation(anticoagulation.ID, content)
6365
+	}
6366
+
6367
+	c.ServeSuccessJSON(map[string]interface{}{
6368
+		"list": auticoagutionPrint,
6369
+	})
6370
+
6371
+}
6372
+
6373
+func (c *PatientApiController) GetAnticoagulationInformed() {
6374
+
6375
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6376
+
6377
+	anticoagulation, _ := service.GetAnticoagulation(orgId)
6378
+
6379
+	c.ServeSuccessJSON(map[string]interface{}{
6380
+		"list": anticoagulation,
6381
+	})
6382
+}
6383
+
6384
+func (c *PatientApiController) SaveCriticalInfomed() {
6385
+
6386
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6387
+	dataBody := make(map[string]interface{}, 0)
6388
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6389
+	fmt.Println("err", err)
6390
+	content := dataBody["content"].(string)
6391
+
6392
+	criticalinfomedPrint := models.XtCriticalinfomedPrint{
6393
+		UserOrgId: orgId,
6394
+		Content:   content,
6395
+		Status:    1,
6396
+		Ctime:     time.Now().Unix(),
6397
+		Mtime:     time.Now().Unix(),
6398
+	}
6399
+
6400
+	infomed, _ := service.GetCriticalInfomed(orgId)
6401
+
6402
+	if infomed.ID == 0 {
6403
+		service.CreatedCriticalInfomed(criticalinfomedPrint)
6404
+	}
6405
+
6406
+	if infomed.ID > 0 {
6407
+		service.UpdateCriticalInfomed(infomed.ID, content)
6408
+	}
6409
+
6410
+	c.ServeSuccessJSON(map[string]interface{}{
6411
+		"list": criticalinfomedPrint,
6412
+	})
6413
+}
6414
+
6415
+func (c *PatientApiController) GetCriticalInformed() {
6416
+
6417
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6418
+
6419
+	infomed, _ := service.GetCriticalInfomed(orgId)
6420
+
6421
+	c.ServeSuccessJSON(map[string]interface{}{
6422
+		"list": infomed,
6423
+	})
6424
+}
6425
+
6426
+func (c *PatientApiController) SaveHemoperfusionInformed() {
6427
+
6428
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6429
+	dataBody := make(map[string]interface{}, 0)
6430
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6431
+	fmt.Println("err", err)
6432
+	content := dataBody["content"].(string)
6433
+
6434
+	hemoperfusionmedPrint := models.XtHemoperfusionmedPrint{
6435
+		UserOrgId: orgId,
6436
+		Content:   content,
6437
+		Status:    1,
6438
+		Ctime:     time.Now().Unix(),
6439
+		Mtime:     time.Now().Unix(),
6440
+	}
6441
+
6442
+	informed, _ := service.GetHemoperfusionInformed(orgId)
6443
+
6444
+	if informed.ID == 0 {
6445
+
6446
+		service.CreateHemoperfusionInformed(hemoperfusionmedPrint)
6447
+	}
6448
+
6449
+	if informed.ID > 0 {
6450
+
6451
+		service.UpdateHemoperfusionInformed(informed.ID, content)
6452
+	}
6453
+
6454
+	c.ServeSuccessJSON(map[string]interface{}{
6455
+		"list": hemoperfusionmedPrint,
6456
+	})
6457
+}
6458
+
6459
+func (c *PatientApiController) GetHemoperfusionInformed() {
6460
+
6461
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6462
+
6463
+	informed, _ := service.GetHemoperfusionInformed(orgId)
6464
+
6465
+	c.ServeSuccessJSON(map[string]interface{}{
6466
+		"list": informed,
6467
+	})
6468
+}
6469
+
6470
+func (c *PatientApiController) SaveBringInformed() {
6471
+
6472
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6473
+	dataBody := make(map[string]interface{}, 0)
6474
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6475
+	fmt.Println("err", err)
6476
+	content := dataBody["content"].(string)
6477
+
6478
+	bringinformedPrint := models.XtBringinformedPrint{
6479
+		Content:   content,
6480
+		UserOrgId: orgId,
6481
+		Ctime:     time.Now().Unix(),
6482
+		Mtime:     time.Now().Unix(),
6483
+		Status:    1,
6484
+	}
6485
+
6486
+	informed, _ := service.GetBringInformed(orgId)
6487
+
6488
+	if informed.ID == 0 {
6489
+		service.CreateBringInformed(bringinformedPrint)
6490
+	}
6491
+	if informed.ID > 0 {
6492
+		service.UpdateBringInformed(informed.ID, content)
6493
+	}
6494
+
6495
+	c.ServeSuccessJSON(map[string]interface{}{
6496
+		"list": bringinformedPrint,
6497
+	})
6498
+}
6499
+
6500
+func (c *PatientApiController) GetInformedContsent() {
6501
+
6502
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6503
+	informed, _ := service.GetBringInformed(orgId)
6504
+
6505
+	c.ServeSuccessJSON(map[string]interface{}{
6506
+		"list": informed,
6507
+	})
6508
+}
6509
+
6510
+func (c *PatientApiController) SaveCatheterization() {
6511
+
6512
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6513
+	dataBody := make(map[string]interface{}, 0)
6514
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6515
+	fmt.Println("err", err)
6516
+	content := dataBody["content"].(string)
6517
+
6518
+	cathetercationPrint := models.XtCathetercationPrint{
6519
+		UserOrgId: orgId,
6520
+		Content:   content,
6521
+		Status:    1,
6522
+		Ctime:     time.Now().Unix(),
6523
+		Mtime:     time.Now().Unix(),
6524
+	}
6525
+
6526
+	catheterization, _ := service.GetCatheterization(orgId)
6527
+
6528
+	if cathetercationPrint.ID == 0 {
6529
+
6530
+		service.CreateCatheteriztion(cathetercationPrint)
6531
+	}
6532
+
6533
+	if cathetercationPrint.ID > 0 {
6534
+
6535
+		service.UpdateCatheterization(catheterization.ID, content)
6536
+	}
6537
+
6538
+	c.ServeSuccessJSON(map[string]interface{}{
6539
+		"list": catheterization,
6540
+	})
6541
+}
6542
+
6543
+func (c *PatientApiController) GetCatheterization() {
6544
+
6545
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6546
+	catheterization, _ := service.GetCatheterization(orgId)
6547
+	c.ServeSuccessJSON(map[string]interface{}{
6548
+		"list": catheterization,
6549
+	})
6550
+}
6551
+
6552
+func (c *PatientApiController) SaveDialyzerInformed() {
6553
+
6554
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6555
+	dataBody := make(map[string]interface{}, 0)
6556
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6557
+	fmt.Println("err", err)
6558
+	content := dataBody["content"].(string)
6559
+
6560
+	dialyszerinformedPrint := models.XtDialyszerinformedPrint{
6561
+		UserOrgId: orgId,
6562
+		Content:   content,
6563
+		Status:    1,
6564
+		Ctime:     time.Now().Unix(),
6565
+		Mtime:     time.Now().Unix(),
6566
+	}
6567
+
6568
+	informed, _ := service.GetDialyzerInformed(orgId)
6569
+
6570
+	if informed.ID == 0 {
6571
+
6572
+		service.CreateDialyzerInformed(dialyszerinformedPrint)
6573
+	}
6574
+
6575
+	if informed.ID > 0 {
6576
+		service.UpdateDialyszerInformed(informed.ID, content)
6577
+	}
6578
+	c.ServeSuccessJSON(map[string]interface{}{
6579
+		"list": dialyszerinformedPrint,
6580
+	})
6581
+}
6582
+
6583
+func (c *PatientApiController) GetDialyzerInformed() {
6584
+
6585
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6586
+	informed, _ := service.GetDialyzerInformed(orgId)
6587
+	c.ServeSuccessJSON(map[string]interface{}{
6588
+		"list": informed,
6589
+	})
6590
+}
6591
+
6592
+func (c *PatientApiController) SaveTheapyInformed() {
6593
+
6594
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6595
+	dataBody := make(map[string]interface{}, 0)
6596
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6597
+	fmt.Println("err", err)
6598
+	content := dataBody["content"].(string)
6599
+
6600
+	theapyinformedPrint := models.XtTheapyinformedPrint{
6601
+		Content:   content,
6602
+		UserOrgId: orgId,
6603
+		Status:    1,
6604
+		Ctime:     time.Now().Unix(),
6605
+		Mtime:     time.Now().Unix(),
6606
+	}
6607
+
6608
+	theapyInformed, _ := service.GetTheapyInformed(orgId)
6609
+
6610
+	if theapyInformed.ID == 0 {
6611
+
6612
+		service.CreateTheapyInformed(theapyinformedPrint)
6613
+	}
6614
+
6615
+	if theapyInformed.ID > 0 {
6616
+
6617
+		service.UpdateTheaphInformed(theapyInformed.ID, content)
6618
+	}
6619
+
6620
+	c.ServeSuccessJSON(map[string]interface{}{
6621
+		"list": theapyinformedPrint,
6622
+	})
6623
+
6624
+}
6625
+
6626
+func (c *PatientApiController) GetTherapyInformed() {
6627
+
6628
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6629
+	theapyInformed, _ := service.GetTheapyInformed(orgId)
6630
+	c.ServeSuccessJSON(map[string]interface{}{
6631
+		"list": theapyInformed,
6632
+	})
6633
+}

+ 41 - 45
controllers/schedule_api_controller.go Целия файл

@@ -103,7 +103,7 @@ func (c *ScheduleApiController) CoverSch() {
103 103
 	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
104 104
 	//	return
105 105
 	//}
106
-	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
106
+	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
107 107
 	if order.ID > 0 {
108 108
 
109 109
 		service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
@@ -188,7 +188,7 @@ func (c *ScheduleApiController) ExchangeSch() {
188 188
 
189 189
 	err := service.UpdateScheduleThree(sch, sch_two)
190 190
 
191
-	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
191
+	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
192 192
 	if order.ID > 0 {
193 193
 		//查询该患者的排班机位
194 194
 		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
@@ -1679,15 +1679,16 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1679 1679
 	tm := time.Unix(int64(schedule_two.ScheduleDate), 0)
1680 1680
 	timeStr := tm.Format(timeTemplate)
1681 1681
 	if timeNow > timeStr {
1682
+		fmt.Println("寄哪里地方")
1682 1683
 		utils.ErrorLog(timeNow)
1683 1684
 		utils.ErrorLog(timeStr)
1684 1685
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleBeforeNow)
1685 1686
 		return
1686 1687
 	}
1687
-	if schedule_two == nil {
1688
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeScheduleNotExist)
1689
-		return
1690
-	}
1688
+	//if schedule_two == nil {
1689
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeScheduleNotExist)
1690
+	//	return
1691
+	//}
1691 1692
 
1692 1693
 	//order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1693 1694
 	//if err != nil {
@@ -1896,57 +1897,52 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1896 1897
 	lastSchedule, _ := service.GetLastSchedule(patientID, adminUserInfo.CurrentOrgId)
1897 1898
 
1898 1899
 	//查询上机床位号 更改床位号
1899
-	order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1900
-
1900
+	order, err := service.GetOneDialysisOrderOne(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1901
+	fmt.Println("errw222222222222222222", order.ID)
1901 1902
 	if order.ID > 0 {
1902 1903
 		service.UpdateDialysiOrderByPatientId(order.ID, schedule.ScheduleType, schedule.PartitionId, order.BedID)
1903 1904
 		redis := service.RedisClient()
1904
-		key := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
1905
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
1905 1906
 		redis.Set(key, "", time.Second)
1906
-		keyOne := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1907
+		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1907 1908
 
1908 1909
 		//清空key 值
1909 1910
 		redis.Set(keyOne, "", time.Second)
1910 1911
 
1911 1912
 	}
1912 1913
 
1913
-	if err == nil {
1914
-		redis := service.RedisClient()
1915
-		key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1916
-		redis.Set(key, "", time.Second)
1917
-		//处方
1918
-		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
1919
-		redis.Set(keyOne, "", time.Second)
1920
-		//医嘱
1921
-		keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":advice_list_all"
1922
-		redis.Set(keyTwo, "", time.Second)
1923
-		keySix := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":assessment_befores_list_all"
1924
-		redis.Set(keySix, "", time.Second)
1925
-		keyThree := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":assessment_after_dislysis_list_all"
1926
-		redis.Set(keyThree, "", time.Second)
1927
-		keyFour := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":monitor_record_list_all"
1928
-		redis.Set(keyFour, "", time.Second)
1929
-		keyFive := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":treatment_summarys_list_all"
1930
-		redis.Set(keyFive, "", time.Second)
1931
-		keySeven := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1932
-		redis.Set(keySeven, "", time.Second)
1933
-		defer redis.Close()
1934
-		schedule.Patient = patientInfo.Name
1914
+	redis := service.RedisClient()
1915
+	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1916
+	redis.Set(key, "", time.Second)
1917
+	//处方
1918
+	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
1919
+	redis.Set(keyOne, "", time.Second)
1920
+	//医嘱
1921
+	keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":advice_list_all"
1922
+	redis.Set(keyTwo, "", time.Second)
1923
+	keySix := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":assessment_befores_list_all"
1924
+	redis.Set(keySix, "", time.Second)
1925
+	keyThree := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":assessment_after_dislysis_list_all"
1926
+	redis.Set(keyThree, "", time.Second)
1927
+	keyFour := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":monitor_record_list_all"
1928
+	redis.Set(keyFour, "", time.Second)
1929
+	keyFive := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":treatment_summarys_list_all"
1930
+	redis.Set(keyFive, "", time.Second)
1931
+	keySeven := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1932
+	redis.Set(keySeven, "", time.Second)
1933
+	defer redis.Close()
1934
+	schedule.Patient = patientInfo.Name
1935 1935
 
1936
-		//去除当天患者排班中重复数据,保留最后一条数据
1937
-		service.UpdateRepeatSchStatus(schedule.UserOrgId, schedule.ScheduleDate)
1936
+	//去除当天患者排班中重复数据,保留最后一条数据
1937
+	service.UpdateRepeatSchStatus(schedule.UserOrgId, schedule.ScheduleDate)
1938 1938
 
1939
-		c.ServeSuccessJSON(map[string]interface{}{
1940
-			"msg":          "ok",
1941
-			"schedule":     schedule,
1942
-			"schedule_two": schedule_two,
1943
-			"lastSchedule": lastSchedule,
1944
-		})
1945
-		return
1946
-	} else {
1947
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateScheduleFail)
1948
-		return
1949
-	}
1939
+	c.ServeSuccessJSON(map[string]interface{}{
1940
+		"msg":          "ok",
1941
+		"schedule":     schedule,
1942
+		"schedule_two": schedule_two,
1943
+		"lastSchedule": lastSchedule,
1944
+	})
1945
+	return
1950 1946
 
1951 1947
 }
1952 1948
 

+ 3 - 0
controllers/self_drug_api_congtroller.go Целия файл

@@ -4361,6 +4361,9 @@ func (this *SelfDrugApiController) GetPurchaseStockQueryList() {
4361 4361
 		for _, it := range losses {
4362 4362
 			item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
4363 4363
 		}
4364
+
4365
+		//获取期初结余
4366
+		//service.GetNewOverInCount(item.ID, orgId, startTime, storeConfig.StorehouseOutInfo)
4364 4367
 	}
4365 4368
 
4366 4369
 	if err != nil {

+ 19 - 23
controllers/sign_api_controller.go Целия файл

@@ -8,6 +8,7 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jung-kurt/gofpdf"
11
+	"github.com/mozillazg/go-pinyin"
11 12
 	"io/ioutil"
12 13
 	"time"
13 14
 )
@@ -664,12 +665,7 @@ func (this *SignApiController) GetEnterPriseDetail() {
664 665
 
665 666
 func (this *SignApiController) UploadPrintOrder() {
666 667
 
667
-	orderList, _ := service.GetWarehouseOutOrderList()
668
-
669
-	for _, item := range orderList {
670
-		service.UpdateWarehouseOutOrderInfo(item.ID, item.WarehouseOutOrderNumber)
671
-	}
672
-	//list, _ := service.GetAllPatientNew(10318)
668
+	//list, _ := service.GetAllPatientNew(10622)
673 669
 	//for _, item := range list {
674 670
 	//
675 671
 	//	hans := item.Name // 要转换的汉字字符串
@@ -696,23 +692,23 @@ func (this *SignApiController) UploadPrintOrder() {
696 692
 	//	//fmt.Println("First Letter:", firstLetter)
697 693
 	//}
698 694
 
699
-	//baseList, _ := service.GeteAllBaseList(10587)
700
-	//for _, item := range baseList {
701
-	//	hans := item.DrugName // 要转换的汉字字符串
702
-	//	// 创建一个拼音转换器
703
-	//	p := pinyin.NewArgs()
704
-	//	// 将汉字转为拼音
705
-	//	pinyinSlice := pinyin.Pinyin(hans, p)
706
-	//	// 获取首字母
707
-	//	firstLetter := ""
708
-	//	for _, py := range pinyinSlice {
709
-	//		if len(py) > 0 {
710
-	//			firstLetter += string(py[0][0])
711
-	//		}
712
-	//	}
713
-	//	item.FirstLetter = firstLetter
714
-	//	service.UpdateBaseList(item.ID, item.FirstLetter)
715
-	//}
695
+	baseList, _ := service.GeteAllBaseList(10622)
696
+	for _, item := range baseList {
697
+		hans := item.DrugName // 要转换的汉字字符串
698
+		// 创建一个拼音转换器
699
+		p := pinyin.NewArgs()
700
+		// 将汉字转为拼音
701
+		pinyinSlice := pinyin.Pinyin(hans, p)
702
+		// 获取首字母
703
+		firstLetter := ""
704
+		for _, py := range pinyinSlice {
705
+			if len(py) > 0 {
706
+				firstLetter += string(py[0][0])
707
+			}
708
+		}
709
+		item.FirstLetter = firstLetter
710
+		service.UpdateBaseList(item.ID, item.FirstLetter)
711
+	}
716 712
 	//pdf := gofpdf.New("P", "mm", "A4", "")
717 713
 	//pdf.AddPage()
718 714
 	//pdf.Text(5, 10, "血液净化治疗记录单")

+ 1 - 0
go.mod Целия файл

@@ -22,6 +22,7 @@ require (
22 22
 	github.com/jung-kurt/gofpdf v1.16.2 // indirect
23 23
 	github.com/kr/text v0.2.0 // indirect
24 24
 	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
25
+	github.com/mozillazg/go-pinyin v0.20.0 // indirect
25 26
 	github.com/prometheus/client_golang v1.7.0 // indirect
26 27
 	github.com/prometheus/client_model v0.2.0 // indirect
27 28
 	github.com/prometheus/common v0.10.0 // indirect

+ 2 - 0
go.sum Целия файл

@@ -112,6 +112,8 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
112 112
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
113 113
 github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
114 114
 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
115
+github.com/mozillazg/go-pinyin v0.20.0 h1:BtR3DsxpApHfKReaPO1fCqF4pThRwH9uwvXzm+GnMFQ=
116
+github.com/mozillazg/go-pinyin v0.20.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
115 117
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
116 118
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
117 119
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=

+ 31 - 26
models/new_stock_models.go Целия файл

@@ -145,32 +145,33 @@ func (NewBaseDrug) TableName() string {
145 145
 }
146 146
 
147 147
 type NewBaseDrugOne struct {
148
-	ID                  int64                  `gorm:"column:id" json:"id" form:"id"`
149
-	DrugName            string                 `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
150
-	DrugSpec            string                 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
151
-	DrugStockLimit      string                 `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
152
-	MaxUnit             string                 `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
153
-	MinNumber           int64                  `gorm:"column:min_number" json:"min_number" form:"min_number"`
154
-	MinUnit             string                 `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
155
-	Dose                string                 `gorm:"column:dose" json:"dose" form:"dose"`
156
-	DoseUnit            string                 `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
157
-	RetailPrice         float64                `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
158
-	MinPrice            float64                `gorm:"column:min_price" json:"min_price" form:"min_price"`
159
-	LastPrice           float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
160
-	Number              string                 `gorm:"column:number" json:"number" form:"number"`
161
-	OrgId               int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
162
-	DrugWarehouseInfo   []*VsDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
163
-	XtDrugStockCount    []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_count"`
164
-	DrugStockCount      []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_info"`
165
-	TotalCount          int64                  `gorm:"column:total_count" json:"total_count" form:"total_count"`
166
-	IsUser              int64                  `gorm:"column:is_user" json:"is_user" form:"is_user"`
167
-	BatchRetaiPrice     float64                `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
168
-	DrugStockLimitCount int64                  `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
169
-	SumCount            int64                  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
170
-	SumInCount          int64                  `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
171
-	IsPharmacy          int64                  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
172
-	Manufacturer        int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
173
-	Dealer              int64                  `gorm:"column:dealer" json:"dealer" form:"dealer"`
148
+	ID                     int64                  `gorm:"column:id" json:"id" form:"id"`
149
+	DrugName               string                 `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
150
+	DrugSpec               string                 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
151
+	DrugStockLimit         string                 `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
152
+	MaxUnit                string                 `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
153
+	MinNumber              int64                  `gorm:"column:min_number" json:"min_number" form:"min_number"`
154
+	MinUnit                string                 `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
155
+	Dose                   string                 `gorm:"column:dose" json:"dose" form:"dose"`
156
+	DoseUnit               string                 `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
157
+	RetailPrice            float64                `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
158
+	MinPrice               float64                `gorm:"column:min_price" json:"min_price" form:"min_price"`
159
+	LastPrice              float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
160
+	Number                 string                 `gorm:"column:number" json:"number" form:"number"`
161
+	OrgId                  int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
162
+	DrugWarehouseInfo      []*VsDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
163
+	XtDrugStockCount       []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_count"`
164
+	DrugStockCount         []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_info"`
165
+	TotalCount             int64                  `gorm:"column:total_count" json:"total_count" form:"total_count"`
166
+	IsUser                 int64                  `gorm:"column:is_user" json:"is_user" form:"is_user"`
167
+	BatchRetaiPrice        float64                `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
168
+	DrugStockLimitCount    int64                  `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
169
+	SumCount               int64                  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
170
+	SumInCount             int64                  `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
171
+	IsPharmacy             int64                  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
172
+	Manufacturer           int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
173
+	Dealer                 int64                  `gorm:"column:dealer" json:"dealer" form:"dealer"`
174
+	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
174 175
 }
175 176
 
176 177
 func (NewBaseDrugOne) TableName() string {
@@ -307,6 +308,10 @@ type GoodInfoTwenty struct {
307 308
 	WareStartEndStockInventoryProfit []*VmStockFlowTwenty //期间盘盈
308 309
 	WareStartEndStockInventoryLosses []*VmStockFlowTwenty //期间盘亏
309 310
 
311
+	//newOverInCount     []*VmStockFlowTwenty
312
+	//newOverOuntCount   []*VmStockFlowTwenty
313
+	//newOverCancelCount []*VmStockFlowTwenty
314
+
310 315
 	//期初结余
311 316
 	GoodStartFlowInfo VmStockFlowTwenty
312 317
 	//期末结余

+ 156 - 0
models/patient_models.go Целия файл

@@ -2376,3 +2376,159 @@ type PatientsTwenty struct {
2376 2376
 func (PatientsTwenty) TableName() string {
2377 2377
 	return "xt_patients"
2378 2378
 }
2379
+
2380
+type XtFallOutPrint struct {
2381
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2382
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2383
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2384
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2385
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2386
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2387
+}
2388
+
2389
+func (XtFallOutPrint) TableName() string {
2390
+	return "xt_fall_out_print"
2391
+}
2392
+
2393
+type XtFilterInformed struct {
2394
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2395
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2396
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2397
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2398
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2399
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2400
+}
2401
+
2402
+func (XtFilterInformed) TableName() string {
2403
+	return "xt_filter_informed"
2404
+}
2405
+
2406
+type XtProfundaInformed struct {
2407
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2408
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2409
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2410
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2411
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2412
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2413
+}
2414
+
2415
+func (XtProfundaInformed) TableName() string {
2416
+	return "xt_profunda_informed"
2417
+}
2418
+
2419
+type XtArterOvenous struct {
2420
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2421
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2422
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2423
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2424
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2425
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2426
+}
2427
+
2428
+func (XtArterOvenous) TableName() string {
2429
+	return "xt_arter_ovenous"
2430
+}
2431
+
2432
+type XtHightRisk struct {
2433
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2434
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2435
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2436
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2437
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2438
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2439
+}
2440
+
2441
+func (XtHightRisk) TableName() string {
2442
+	return "xt_hight_risk"
2443
+}
2444
+
2445
+type XtAuticoagutionPrint struct {
2446
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2447
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2448
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2449
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2450
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2451
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2452
+}
2453
+
2454
+func (XtAuticoagutionPrint) TableName() string {
2455
+	return "xt_auticoagution_print"
2456
+}
2457
+
2458
+type XtCriticalinfomedPrint struct {
2459
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2460
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2461
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2462
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2463
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2464
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2465
+}
2466
+
2467
+func (XtCriticalinfomedPrint) TableName() string {
2468
+	return "xt_criticalinfomed_print"
2469
+}
2470
+
2471
+type XtHemoperfusionmedPrint struct {
2472
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2473
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2474
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2475
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2476
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2477
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2478
+}
2479
+
2480
+func (XtHemoperfusionmedPrint) TableName() string {
2481
+	return "xt_hemoperfusionmed_print"
2482
+}
2483
+
2484
+type XtBringinformedPrint struct {
2485
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2486
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2487
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2488
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2489
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2490
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2491
+}
2492
+
2493
+func (XtBringinformedPrint) TableName() string {
2494
+	return "xt_bring_print"
2495
+}
2496
+
2497
+type XtCathetercationPrint struct {
2498
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2499
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2500
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2501
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2502
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2503
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2504
+}
2505
+
2506
+func (XtCathetercationPrint) TableName() string {
2507
+	return "xt_cathetercation_print"
2508
+}
2509
+
2510
+type XtDialyszerinformedPrint struct {
2511
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2512
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2513
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2514
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2515
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2516
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2517
+}
2518
+
2519
+func (XtDialyszerinformedPrint) TableName() string {
2520
+	return "xt_dialyszerinformed_print"
2521
+}
2522
+
2523
+type XtTheapyinformedPrint struct {
2524
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2525
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2526
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2527
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2528
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2529
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2530
+}
2531
+
2532
+func (XtTheapyinformedPrint) TableName() string {
2533
+	return "xt_theapyinformed_print"
2534
+}

+ 9 - 0
service/dialysis_service.go Целия файл

@@ -1066,6 +1066,15 @@ func GetOneDialysisOrder(orgID, orderData int64, patient_id int64) (*models.Dial
1066 1066
 	return &order, nil
1067 1067
 }
1068 1068
 
1069
+func GetOneDialysisOrderOne(orgID, orderData int64, patient_id int64) (models.DialysisOrder, error) {
1070
+
1071
+	order := models.DialysisOrder{}
1072
+
1073
+	err := readDb.Where("user_org_id=? and dialysis_date=? and status=1 and patient_id = ?", orgID, orderData, patient_id).Find(&order).Error
1074
+
1075
+	return order, err
1076
+}
1077
+
1069 1078
 func GetPscheduleDate(schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1070 1079
 
1071 1080
 	schedule := models.XtSchedule{}

+ 279 - 1
service/patient_service.go Целия файл

@@ -1531,7 +1531,7 @@ func GetPatientDialysisRecord(orgID, patientID int64, page, limit, start, end, m
1531 1531
 		Preload("PredialysisEvaluation", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
1532 1532
 		Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
1533 1533
 			return readDb.Where("patient_id=? and user_org_id=? and status=1", patientID, orgID).Preload("UserAdminRole", func(db *gorm.DB) *gorm.DB {
1534
-				return readUserDb.Where("status = 1")
1534
+				return readUserDb.Where("status = 1 and org_id=?", orgID)
1535 1535
 			})
1536 1536
 		}).
1537 1537
 		Preload("AssessmentAfterDislysis", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
@@ -3404,3 +3404,281 @@ func GetLastAcceptRecrods(patient_id int64) (models.ReceiveTreatmentAsses, error
3404 3404
 	err := XTReadDB().Where("patient_id = ? and status= 1 and admission_number!=''", patient_id).Last(&treatmentAsses).Error
3405 3405
 	return treatmentAsses, err
3406 3406
 }
3407
+
3408
+func GetOutPrintList(user_org_id int64) (models.XtFallOutPrint, error) {
3409
+
3410
+	outPrint := models.XtFallOutPrint{}
3411
+
3412
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&outPrint).Error
3413
+
3414
+	return outPrint, err
3415
+}
3416
+
3417
+func CreateFallOutBedPrint(outPrint models.XtFallOutPrint) error {
3418
+
3419
+	err := XTWriteDB().Create(&outPrint).Error
3420
+
3421
+	return err
3422
+}
3423
+
3424
+func UpdateFallOutBedPrint(id int64, content string) error {
3425
+
3426
+	err := XTWriteDB().Model(&models.XtFallOutPrint{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3427
+
3428
+	return err
3429
+}
3430
+
3431
+func GetFallOutBedPrintList(user_org_id int64) (models.XtFallOutPrint, error) {
3432
+
3433
+	outPrint := models.XtFallOutPrint{}
3434
+
3435
+	err := XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&outPrint).Error
3436
+
3437
+	return outPrint, err
3438
+}
3439
+
3440
+func GetFilterInformed(user_org_id int64) (models.XtFilterInformed, error) {
3441
+
3442
+	informed := models.XtFilterInformed{}
3443
+
3444
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&informed).Error
3445
+
3446
+	return informed, err
3447
+}
3448
+
3449
+func CreateFilterInformed(informed models.XtFilterInformed) error {
3450
+
3451
+	err := XTWriteDB().Create(&informed).Error
3452
+
3453
+	return err
3454
+}
3455
+
3456
+func UpdateFilterInformed(id int64, content string) error {
3457
+
3458
+	err := XTWriteDB().Model(&models.XtFilterInformed{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3459
+
3460
+	return err
3461
+}
3462
+
3463
+func GetProfundaInformed(user_org_id int64) (models.XtProfundaInformed, error) {
3464
+
3465
+	informed := models.XtProfundaInformed{}
3466
+
3467
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&informed).Error
3468
+
3469
+	return informed, err
3470
+}
3471
+
3472
+func CreateProfundaInformed(informed models.XtProfundaInformed) error {
3473
+
3474
+	err := XTWriteDB().Create(&informed).Error
3475
+
3476
+	return err
3477
+}
3478
+
3479
+func UpdateProfundaInformed(id int64, content string) error {
3480
+
3481
+	profundaInformed := models.XtProfundaInformed{}
3482
+
3483
+	err := XTWriteDB().Model(&profundaInformed).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3484
+	return err
3485
+}
3486
+
3487
+func GetArterOvenousList(user_org_id int64) (models.XtArterOvenous, error) {
3488
+
3489
+	ovenous := models.XtArterOvenous{}
3490
+	err := XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&ovenous).Error
3491
+	return ovenous, err
3492
+}
3493
+
3494
+func CreateArterOvernous(ovenous models.XtArterOvenous) error {
3495
+
3496
+	err := XTWriteDB().Create(&ovenous).Error
3497
+
3498
+	return err
3499
+}
3500
+
3501
+func UpdateArterOvernous(id int64, content string) error {
3502
+
3503
+	err := XTWriteDB().Model(&models.XtArterOvenous{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3504
+
3505
+	return err
3506
+}
3507
+
3508
+func GetHightRikInformed(user_org_id int64) (models.XtHightRisk, error) {
3509
+
3510
+	risk := models.XtHightRisk{}
3511
+
3512
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&risk).Error
3513
+
3514
+	return risk, err
3515
+}
3516
+
3517
+func CreateHighRik(risk models.XtHightRisk) error {
3518
+
3519
+	err := XTWriteDB().Create(&risk).Error
3520
+
3521
+	return err
3522
+}
3523
+
3524
+func UpdateHighRik(id int64, content string) error {
3525
+
3526
+	err := XTWriteDB().Model(&models.XtHightRisk{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3527
+
3528
+	return err
3529
+}
3530
+
3531
+func GetAnticoagulation(user_org_id int64) (models.XtAuticoagutionPrint, error) {
3532
+
3533
+	auticoagutionPrint := models.XtAuticoagutionPrint{}
3534
+
3535
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&auticoagutionPrint).Error
3536
+
3537
+	return auticoagutionPrint, err
3538
+}
3539
+
3540
+func CreateAnticoagulation(auticoagutionPrint models.XtAuticoagutionPrint) error {
3541
+
3542
+	err := XTWriteDB().Create(&auticoagutionPrint).Error
3543
+
3544
+	return err
3545
+}
3546
+
3547
+func UpdateAnticoagulation(id int64, content string) error {
3548
+
3549
+	err := XTWriteDB().Model(&models.XtAuticoagutionPrint{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3550
+
3551
+	return err
3552
+}
3553
+
3554
+func GetCriticalInfomed(org_id int64) (models.XtCriticalinfomedPrint, error) {
3555
+
3556
+	criticalinfomedPrint := models.XtCriticalinfomedPrint{}
3557
+
3558
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&criticalinfomedPrint).Error
3559
+
3560
+	return criticalinfomedPrint, err
3561
+}
3562
+
3563
+func CreatedCriticalInfomed(criticalinfomedPrint models.XtCriticalinfomedPrint) error {
3564
+
3565
+	err := XTWriteDB().Create(&criticalinfomedPrint).Error
3566
+
3567
+	return err
3568
+}
3569
+
3570
+func UpdateCriticalInfomed(id int64, content string) error {
3571
+
3572
+	err := XTWriteDB().Model(&models.XtCriticalinfomedPrint{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3573
+
3574
+	return err
3575
+}
3576
+
3577
+func GetHemoperfusionInformed(user_org_id int64) (models.XtHemoperfusionmedPrint, error) {
3578
+
3579
+	hemoperfusionmedPrint := models.XtHemoperfusionmedPrint{}
3580
+
3581
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&hemoperfusionmedPrint).Error
3582
+
3583
+	return hemoperfusionmedPrint, err
3584
+}
3585
+
3586
+func CreateHemoperfusionInformed(hemoperfusionmedPrint models.XtHemoperfusionmedPrint) error {
3587
+
3588
+	err := XTWriteDB().Create(&hemoperfusionmedPrint).Error
3589
+
3590
+	return err
3591
+}
3592
+
3593
+func UpdateHemoperfusionInformed(id int64, content string) error {
3594
+
3595
+	err := XTWriteDB().Model(&models.XtHemoperfusionmedPrint{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3596
+
3597
+	return err
3598
+}
3599
+
3600
+func GetBringInformed(org_id int64) (models.XtBringinformedPrint, error) {
3601
+
3602
+	bringinformedPrint := models.XtBringinformedPrint{}
3603
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&bringinformedPrint).Error
3604
+
3605
+	return bringinformedPrint, err
3606
+}
3607
+
3608
+func CreateBringInformed(bringinformedPrint models.XtBringinformedPrint) error {
3609
+
3610
+	err := XTWriteDB().Create(&bringinformedPrint).Error
3611
+
3612
+	return err
3613
+}
3614
+
3615
+func UpdateBringInformed(id int64, content string) error {
3616
+
3617
+	err := XTWriteDB().Model(&models.XtBringinformedPrint{}).Where("id =? and status= 1", id).Updates(map[string]interface{}{"content": content}).Error
3618
+
3619
+	return err
3620
+}
3621
+
3622
+func GetCatheterization(user_org_id int64) (models.XtCathetercationPrint, error) {
3623
+
3624
+	cathetercationPrint := models.XtCathetercationPrint{}
3625
+
3626
+	err := XTReadDB().Where("user_org_id = ? and status= 1", user_org_id).Find(&cathetercationPrint).Error
3627
+	return cathetercationPrint, err
3628
+}
3629
+
3630
+func CreateCatheteriztion(cathetercationPrint models.XtCathetercationPrint) error {
3631
+
3632
+	err := XTWriteDB().Create(&cathetercationPrint).Error
3633
+	return err
3634
+}
3635
+
3636
+func UpdateCatheterization(id int64, content string) error {
3637
+
3638
+	err := XTWriteDB().Model(models.XtCathetercationPrint{}).Where("id=? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3639
+
3640
+	return err
3641
+}
3642
+
3643
+func GetDialyzerInformed(org_id int64) (models.XtDialyszerinformedPrint, error) {
3644
+
3645
+	dialyszerinformedPrint := models.XtDialyszerinformedPrint{}
3646
+
3647
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&dialyszerinformedPrint).Error
3648
+
3649
+	return dialyszerinformedPrint, err
3650
+}
3651
+
3652
+func CreateDialyzerInformed(dialyszerinformedPrint models.XtDialyszerinformedPrint) error {
3653
+
3654
+	err := XTWriteDB().Create(&dialyszerinformedPrint).Error
3655
+
3656
+	return err
3657
+}
3658
+
3659
+func UpdateDialyszerInformed(id int64, content string) error {
3660
+
3661
+	err := XTWriteDB().Model(&models.XtDialyszerinformedPrint{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3662
+	return err
3663
+}
3664
+
3665
+func GetTheapyInformed(org_id int64) (models.XtTheapyinformedPrint, error) {
3666
+
3667
+	theapyinformedPrint := models.XtTheapyinformedPrint{}
3668
+
3669
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&theapyinformedPrint).Error
3670
+
3671
+	return theapyinformedPrint, err
3672
+}
3673
+
3674
+func CreateTheapyInformed(theapyinformedPrint models.XtTheapyinformedPrint) error {
3675
+
3676
+	err := XTWriteDB().Create(&theapyinformedPrint).Error
3677
+	return err
3678
+}
3679
+
3680
+func UpdateTheaphInformed(id int64, content string) error {
3681
+
3682
+	err := XTWriteDB().Model(&models.XtTheapyinformedPrint{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3683
+	return err
3684
+}

+ 16 - 0
service/schedule_service.go Целия файл

@@ -1811,3 +1811,19 @@ func UpdateRepeatSchStatus(user_org_id int64, schedule_date int64) {
1811 1811
 	}
1812 1812
 
1813 1813
 }
1814
+
1815
+func GetSchedulePatientIdByPatient(patient_id int64, schedule_date int64, user_org_id int64) (models.Schedule, error) {
1816
+
1817
+	schedule := models.Schedule{}
1818
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status =1", patient_id, schedule_date, user_org_id).Find(&schedule).Error
1819
+	return schedule, err
1820
+}
1821
+
1822
+func UpdateMobileSchedule(id_two int64, mode_id int64, bed_id int64, zone_id int64, schedule_type int64, id int64) error {
1823
+
1824
+	schedule := models.Schedule{}
1825
+
1826
+	err = XTWriteDB().Model(&schedule).Where("id = ? and status=1", id).Updates(map[string]interface{}{"patient_id": id_two, "mode_id": mode_id, "bed_id": bed_id, "partition_id": zone_id, "schedule_type": schedule_type}).Error
1827
+
1828
+	return err
1829
+}