28169 1 rok temu
rodzic
commit
faca4d389d

+ 21 - 20
controllers/mobile_api_controllers/patient_api_controller.go Wyświetl plik

@@ -1,15 +1,16 @@
1 1
 package mobile_api_controllers
2 2
 
3 3
 import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"math"
7
+	"strings"
8
+
4 9
 	"XT_New/enums"
5 10
 	"XT_New/models"
6 11
 	"XT_New/service"
7 12
 	"XT_New/utils"
8
-	"encoding/json"
9
-	"fmt"
10 13
 	"github.com/jinzhu/gorm"
11
-	"math"
12
-	"strings"
13 14
 
14 15
 	// "fmt"
15 16
 	"reflect"
@@ -1665,22 +1666,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1665 1666
 				}
1666 1667
 
1667 1668
 				//
1668
-				//if config.IsOpen == 1 && item.UserOrgId == 10210 {
1669
-				//
1670
-				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1671
-				//	//更新字典里面的库存
1672
-				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1673
-				//	var sum_count int64
1674
-				//	for _, its := range stockInfo {
1675
-				//		if its.MaxUnit == medical.MaxUnit {
1676
-				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1677
-				//		}
1678
-				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1679
-				//	}
1680
-				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1681
-				//	//剩余库存
1682
-				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1683
-				//}
1669
+				if config.IsOpen == 1 && item.UserOrgId == 10188 {
1670
+
1671
+					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
+					//更新字典里面的库存
1673
+					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
+					var sum_count int64
1675
+					for _, its := range stockInfo {
1676
+						if its.MaxUnit == medical.MaxUnit {
1677
+							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
+						}
1679
+						sum_count += its.StockMaxNumber + its.StockMinNumber
1680
+					}
1681
+					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
+					//剩余库存
1683
+					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
+				}
1684 1685
 
1685 1686
 			}
1686 1687
 		}

+ 29 - 18
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Wyświetl plik

@@ -399,14 +399,19 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
399 399
 		}
400 400
 	}
401 401
 
402
+	timenow := time.Now().Format("2006-01-02")
403
+	timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timenow)
402 404
 	//针对百霖和贝尔
403 405
 	if orgid == 10138 || orgid == 10278 || orgid == 3877 {
404 406
 		//获取今日的排班数据
405 407
 		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
406 408
 		for _, item := range list {
407
-			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
408
-			var str = solution.DialysisDialyszers + "/" + solution.DialysisIrrigation
409
-			service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
409
+			if item.ScheduleDate >= timeNewDate.Unix() {
410
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
411
+				var str = solution.DialysisDialyszers + "/" + solution.DialysisIrrigation
412
+				service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
413
+			}
414
+
410 415
 		}
411 416
 	}
412 417
 
@@ -414,9 +419,12 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
414 419
 		//获取今日的排班数据
415 420
 		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
416 421
 		for _, item := range list {
417
-			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
418
-			var str = solution.DialyzerPerfusionApparatus
419
-			service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
422
+			if item.ScheduleDate >= timeNewDate.Unix() {
423
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
424
+				var str = solution.DialyzerPerfusionApparatus
425
+				service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
426
+			}
427
+
420 428
 		}
421 429
 	}
422 430
 
@@ -426,20 +434,23 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
426 434
 		schedulesFive, _ := service.GetMobileScheduleListByScheduleDateOne(orgid, startTime)
427 435
 
428 436
 		for _, item := range schedulesFive {
429
-			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
430
-			var DialysisMachineName string
431
-			if len(solution.DialysisDialyszers) > 0 {
432
-				DialysisMachineName = solution.DialysisDialyszers
433
-			}
434
-			if len(solution.DialyzerPerfusionApparatus) > 0 {
435
-				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
436
-			}
437
+			if item.ScheduleDate >= timeNewDate.Unix() {
438
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
439
+				var DialysisMachineName string
440
+				if len(solution.DialysisDialyszers) > 0 {
441
+					DialysisMachineName = solution.DialysisDialyszers
442
+				}
443
+				if len(solution.DialyzerPerfusionApparatus) > 0 {
444
+					DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
445
+				}
437 446
 
438
-			if len(solution.DialysisIrrigation) > 0 {
439
-				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
447
+				if len(solution.DialysisIrrigation) > 0 {
448
+					DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
449
+				}
450
+				item.DialysisMachineName = DialysisMachineName
451
+				service.UpdateSchOne(item.ID, item.DialysisMachineName)
440 452
 			}
441
-			item.DialysisMachineName = DialysisMachineName
442
-			service.UpdateSchOne(item.ID, item.DialysisMachineName)
453
+
443 454
 		}
444 455
 
445 456
 	}

+ 19 - 12
controllers/patient_api_controller.go Wyświetl plik

@@ -1,13 +1,7 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8 4
 	"encoding/json"
9
-	"github.com/jinzhu/gorm"
10
-	"github.com/mozillazg/go-pinyin"
11 5
 	"math"
12 6
 	"math/rand"
13 7
 	"reflect"
@@ -16,6 +10,13 @@ import (
16 10
 	"strings"
17 11
 	"time"
18 12
 
13
+	"XT_New/enums"
14
+	"XT_New/models"
15
+	"XT_New/service"
16
+	"XT_New/utils"
17
+	"github.com/jinzhu/gorm"
18
+	"github.com/mozillazg/go-pinyin"
19
+
19 20
 	"fmt"
20 21
 
21 22
 	"github.com/astaxie/beego"
@@ -951,12 +952,18 @@ func (c *PatientApiController) EditLapseto() {
951 952
 	err = service.EditPatientLapseto(&patient, &lapseto)
952 953
 
953 954
 	if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
954
-		timeStr := time.Now().Format("2006-01-02")
955
-		timeLayout := "2006-01-02 15:04:05"
956
-		timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
957
-		timenow := timeStringToTime.Unix()
958
-		service.UpdateScheduleByDeathTime(id, timenow)
959
-		service.UpdateScheduleItemByPatientId(id)
955
+		fmt.Println("lapsetoTimeUnix.Unix()", lapsetoTimeUnix.Unix())
956
+		if adminUserInfo.CurrentOrgId == 10340 {
957
+			service.UpdateScheduleByDeathTime(id, lapsetoTimeUnix.Unix())
958
+			service.UpdateScheduleItemByPatientId(id)
959
+		} else {
960
+			timeStr := time.Now().Format("2006-01-02")
961
+			timeLayout := "2006-01-02 15:04:05"
962
+			timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
963
+			timenow := timeStringToTime.Unix()
964
+			service.UpdateScheduleByDeathTime(id, timenow)
965
+			service.UpdateScheduleItemByPatientId(id)
966
+		}
960 967
 	}
961 968
 
962 969
 	allergic := models.XtPatientAllergic{

+ 22 - 15
controllers/schedule_api_controller.go Wyświetl plik

@@ -4741,14 +4741,18 @@ func (c *ScheduleApiController) GetScheduleOne() {
4741 4741
 		weekEndPoint = theEndTime.Unix()
4742 4742
 	}
4743 4743
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4744
-
4744
+	timenow := time.Now().Format("2006-01-02")
4745
+	timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timenow)
4745 4746
 	if adminInfo.CurrentOrgId == 10346 || adminInfo.CurrentOrgId == 10585 {
4746 4747
 
4747 4748
 		if len(schdules) > 0 {
4748 4749
 			//获取长期医嘱里面的透析器灌流器
4749 4750
 			for _, item := range schdules {
4750
-				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4751
-				service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, solution.DialyzerPerfusionApparatus, item.ScheduleType)
4751
+				if item.ScheduleDate >= timeNewDate.Unix() {
4752
+					solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4753
+					service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, solution.DialyzerPerfusionApparatus, item.ScheduleType)
4754
+				}
4755
+
4752 4756
 			}
4753 4757
 
4754 4758
 		}
@@ -4760,20 +4764,23 @@ func (c *ScheduleApiController) GetScheduleOne() {
4760 4764
 		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4761 4765
 
4762 4766
 		for _, item := range schedulesFive {
4763
-			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4764
-			var DialysisMachineName string
4765
-			if len(solution.DialysisDialyszers) > 0 {
4766
-				DialysisMachineName = solution.DialysisDialyszers
4767
-			}
4768
-			if len(solution.DialyzerPerfusionApparatus) > 0 {
4769
-				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
4770
-			}
4767
+			if item.ScheduleDate >= timeNewDate.Unix() {
4768
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4769
+				var DialysisMachineName string
4770
+				if len(solution.DialysisDialyszers) > 0 {
4771
+					DialysisMachineName = solution.DialysisDialyszers
4772
+				}
4773
+				if len(solution.DialyzerPerfusionApparatus) > 0 {
4774
+					DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
4775
+				}
4771 4776
 
4772
-			if len(solution.DialysisIrrigation) > 0 {
4773
-				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
4777
+				if len(solution.DialysisIrrigation) > 0 {
4778
+					DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
4779
+				}
4780
+				item.DialysisMachineName = DialysisMachineName
4781
+				service.UpdateSchOne(item.ID, item.DialysisMachineName)
4774 4782
 			}
4775
-			item.DialysisMachineName = DialysisMachineName
4776
-			service.UpdateSchOne(item.ID, item.DialysisMachineName)
4783
+
4777 4784
 		}
4778 4785
 
4779 4786
 	}