Bladeren bron

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

test_user 2 jaren geleden
bovenliggende
commit
82aa941d23

+ 3 - 2
conf/app.conf Bestand weergeven

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9531
2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4
 #dev/prod
4
 #dev/prod
5
 
5
 
6
 #
6
 #
146
 
146
 
147
 [dev]
147
 [dev]
148
 mobile_token_expiration_second = 604800
148
 mobile_token_expiration_second = 604800
149
-httpdomain = http://new_mobile.xt.api.sgjyun.com
149
+# httpdomain = http://new_mobile.xt.api.sgjyun.com
150
+httpdomain = https://api.xt.test.sgjyun.com
150
 sso_domain = https://testsso.sgjyun.com
151
 sso_domain = https://testsso.sgjyun.com
151
 call_domain = http://hf.szjkhd.com
152
 call_domain = http://hf.szjkhd.com
152
 front_end_domain = "http://xt.test.sgjyun.com/#"
153
 front_end_domain = "http://xt.test.sgjyun.com/#"

+ 6 - 6
controllers/base_api_controller.go Bestand weergeven

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

+ 4 - 4
controllers/dialysis_api_controller.go Bestand weergeven

1894
 	age := c.GetString("age")
1894
 	age := c.GetString("age")
1895
 	his_department := c.GetString("his_department")
1895
 	his_department := c.GetString("his_department")
1896
 	his_bed := c.GetString("his_bed")
1896
 	his_bed := c.GetString("his_bed")
1897
+	point_puncture := c.GetString("point_puncture")
1897
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1898
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1898
 		DialysisCount:                  dialysis_count,
1899
 		DialysisCount:                  dialysis_count,
1899
 		EmergencyTreatment:             emergency_treatment,
1900
 		EmergencyTreatment:             emergency_treatment,
1967
 		Age:                            age,
1968
 		Age:                            age,
1968
 		HisDepartment:                  his_department,
1969
 		HisDepartment:                  his_department,
1969
 		HisBed:                         his_bed,
1970
 		HisBed:                         his_bed,
1971
+		PointPuncture:                  point_puncture,
1970
 	}
1972
 	}
1971
 
1973
 
1972
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1974
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1984
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
1986
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
1985
 
1987
 
1986
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
1988
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
1987
-			fmt.Println("进来--------------------------------------")
1988
-			fmt.Println("evaluation.WeightBefore", weight_before)
1989
-			fmt.Println(" evaluation.DryWeight", dry_weight)
1990
 			var dewater_amount float64
1989
 			var dewater_amount float64
1991
 			dewater_amount = 0
1990
 			dewater_amount = 0
1992
 			if dry_weight > 0 {
1991
 			if dry_weight > 0 {
3442
 
3441
 
3443
 	//透析单
3442
 	//透析单
3444
 	dialysisOrder, _ := service.MobileGetSchedualDialysisRecordTen(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3443
 	dialysisOrder, _ := service.MobileGetSchedualDialysisRecordTen(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3444
+	fmt.Println("dialysisOrder----------------", dialysisOrder)
3445
 	if dialysisOrder != nil {
3445
 	if dialysisOrder != nil {
3446
 		if dialysisOrder.FinishNurse > 0 {
3446
 		if dialysisOrder.FinishNurse > 0 {
3447
 			operatorIDs = append(operatorIDs, dialysisOrder.FinishNurse)
3447
 			operatorIDs = append(operatorIDs, dialysisOrder.FinishNurse)
5141
 	var ids []string
5141
 	var ids []string
5142
 
5142
 
5143
 	ids = strings.Split(partion_type, ",")
5143
 	ids = strings.Split(partion_type, ",")
5144
-	fmt.Println("ids------------------------", ids)
5144
+
5145
 	timeLayout := "2006-01-02"
5145
 	timeLayout := "2006-01-02"
5146
 	loc, _ := time.LoadLocation("Local")
5146
 	loc, _ := time.LoadLocation("Local")
5147
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5147
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)

+ 4 - 1
controllers/doctors_api_controller.go Bestand weergeven

1262
 
1262
 
1263
 	id, _ := this.GetInt64("id")
1263
 	id, _ := this.GetInt64("id")
1264
 	detail, err := service.GetHospitalSummaryDetail(id)
1264
 	detail, err := service.GetHospitalSummaryDetail(id)
1265
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1266
+	operators, err := service.GetAdminUserEsOne(orgId)
1265
 	if err == nil {
1267
 	if err == nil {
1266
 		this.ServeSuccessJSON(map[string]interface{}{
1268
 		this.ServeSuccessJSON(map[string]interface{}{
1267
-			"detail": detail,
1269
+			"detail":    detail,
1270
+			"operators": operators,
1268
 		})
1271
 		})
1269
 		return
1272
 		return
1270
 	}
1273
 	}

+ 61 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

843
 			order, _ := service.GetDialysisOrder(recordDate.Unix(), id, adminUserInfo.Org.Id)
843
 			order, _ := service.GetDialysisOrder(recordDate.Unix(), id, adminUserInfo.Org.Id)
844
 			doubleCheck.Creater = order.StartNurse
844
 			doubleCheck.Creater = order.StartNurse
845
 		}
845
 		}
846
+
847
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
848
+			//查询未核对的医嘱
849
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
850
+			for _, advice := range doctorList {
851
+				if advice.ExecutionStaff == modifier {
852
+
853
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
854
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
855
+					return
856
+				}
857
+			}
858
+		}
846
 		err := service.AddSigleDoubleCheck(&doubleCheck)
859
 		err := service.AddSigleDoubleCheck(&doubleCheck)
847
 
860
 
848
 		//针对长沙南雅
861
 		//针对长沙南雅
851
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
864
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
852
 			if len(doctorList) > 0 && modifier > 0 {
865
 			if len(doctorList) > 0 && modifier > 0 {
853
 				for _, advice := range doctorList {
866
 				for _, advice := range doctorList {
867
+
854
 					service.UpdateDoctorAdviceList(advice.ID, modifier)
868
 					service.UpdateDoctorAdviceList(advice.ID, modifier)
855
 					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
869
 					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
856
 					redis := service.RedisClient()
870
 					redis := service.RedisClient()
890
 		doubleCheck.EmployeeNumber = employee_number
904
 		doubleCheck.EmployeeNumber = employee_number
891
 		doubleCheck.NeedleBatchNumber = needle_batch_number
905
 		doubleCheck.NeedleBatchNumber = needle_batch_number
892
 		doubleCheck.DialyzerBatchNumber = dialyzer_batch_number
906
 		doubleCheck.DialyzerBatchNumber = dialyzer_batch_number
907
+
908
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
909
+			//查询未核对的医嘱
910
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
911
+			for _, advice := range doctorList {
912
+				if advice.ExecutionStaff == modifier {
913
+
914
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
915
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
916
+					return
917
+				}
918
+			}
919
+		}
893
 		err := service.UpdateDoubleCheck(&doubleCheck)
920
 		err := service.UpdateDoubleCheck(&doubleCheck)
921
+
894
 		//针对长沙南雅
922
 		//针对长沙南雅
895
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
923
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
896
 			//查询未核对的医嘱
924
 			//查询未核对的医嘱
1701
 			if prescribing_number == 0 {
1729
 			if prescribing_number == 0 {
1702
 				prescribing_number = 1
1730
 				prescribing_number = 1
1703
 			}
1731
 			}
1732
+			if prescribing_number == 0 && id == 14682 {
1733
+				prescribing_number = 2
1734
+			}
1735
+
1736
+			if prescribing_number == 0 && id == 18560 {
1737
+				prescribing_number = 2
1738
+			}
1704
 			advice := models.DoctorAdvice{
1739
 			advice := models.DoctorAdvice{
1705
 				UserOrgId:             adminUserInfo.Org.Id,
1740
 				UserOrgId:             adminUserInfo.Org.Id,
1706
 				PatientId:             id,
1741
 				PatientId:             id,
3294
 		}
3329
 		}
3295
 	}
3330
 	}
3296
 
3331
 
3332
+	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 {
3333
+
3334
+		if solution.PrescribingNumber == 0 {
3335
+			solution.PrescribingNumber = 1
3336
+		}
3337
+		if prescription.PrescribingNumber == 0 {
3338
+			prescription.PrescribingNumber = 1
3339
+		}
3340
+
3341
+		if solution.PrescribingNumber == 0 && id == 14682 {
3342
+			solution.PrescribingNumber = 2
3343
+		}
3344
+
3345
+		if solution.PrescribingNumber == 0 && id == 18560 {
3346
+			solution.PrescribingNumber = 2
3347
+		}
3348
+
3349
+		if prescription.PrescribingNumber == 0 && id == 14682 {
3350
+			prescription.PrescribingNumber = 2
3351
+		}
3352
+
3353
+		if prescription.PrescribingNumber == 0 && id == 18560 {
3354
+			prescription.PrescribingNumber = 2
3355
+		}
3356
+	}
3357
+
3297
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
3358
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
3298
 	//获取最新1条
3359
 	//获取最新1条
3299
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(id, adminUserInfo.Org.Id)
3360
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(id, adminUserInfo.Org.Id)

+ 6 - 0
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

2849
 
2849
 
2850
 		evaluation.HisBed = his_bed
2850
 		evaluation.HisBed = his_bed
2851
 	}
2851
 	}
2852
+
2853
+	if dataBody["point_puncture"] != nil && reflect.TypeOf(dataBody["point_puncture"]).String() == "string" {
2854
+		point_puncture := dataBody["point_puncture"].(string)
2855
+
2856
+		evaluation.PointPuncture = point_puncture
2857
+	}
2852
 	return
2858
 	return
2853
 }
2859
 }
2854
 
2860
 

+ 12 - 0
controllers/new_mobile_api_controllers/mobile_his_api_controller.go Bestand weergeven

1269
 	})
1269
 	})
1270
 	return
1270
 	return
1271
 }
1271
 }
1272
+
1273
+func (c *MobileHisApiController) ToGetPatient() {
1274
+
1275
+	order, _ := service.GetDialysisOrderList(10340)
1276
+	for _, item := range order {
1277
+		service.UpdatePatientDialysisOrder(item.PatientId, item.Url)
1278
+	}
1279
+	c.ServeSuccessJSON(map[string]interface{}{
1280
+		"msg": "ok",
1281
+	})
1282
+	return
1283
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Bestand weergeven

181
 	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
181
 	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
182
 
182
 
183
 	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
183
 	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
184
+	beego.Router("/m/api/patient/togetpatient", &MobileHisApiController{}, "Get:ToGetPatient")
184
 
185
 
185
 }
186
 }

+ 115 - 14
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Bestand weergeven

49
 func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
49
 func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
50
 
50
 
51
 	orgId := this.GetMobileAdminUserInfo().Org.Id
51
 	orgId := this.GetMobileAdminUserInfo().Org.Id
52
-	start_time, _ := this.GetInt64("start_time")
53
-	fmt.Println("staft_time", start_time)
54
-	end_time, _ := this.GetInt64("end_time")
55
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
52
+	//start_time, _ := this.GetInt64("start_time")
53
+	//fmt.Println("staft_time", start_time)
54
+	//end_time, _ := this.GetInt64("end_time")
55
+	//fmt.Println("start_time",start_time)
56
+	//fmt.Println("end_time",end_time)
57
+	start_time_one := this.GetString("start_time_one")
58
+	end_time_one := this.GetString("end_time_one")
59
+	fmt.Println("start_time_one--------", len(start_time_one))
60
+	fmt.Println("end_time_one-------", end_time_one)
61
+	timeLayout := "2006-01-02"
62
+	loc, _ := time.LoadLocation("Local")
63
+	var startTime int64
64
+	if len(start_time_one) > 0 {
65
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
66
+		fmt.Println("err-----------", err)
67
+		if err != nil {
68
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
69
+			return
70
+		}
71
+		startTime = theTime.Unix()
72
+	}
73
+	var endTime int64
74
+	if len(end_time_one) > 0 {
75
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
76
+		if err != nil {
77
+			utils.ErrorLog(err.Error())
78
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
79
+			return
80
+		}
81
+		endTime = theTime.Unix()
82
+	}
83
+	fmt.Println("starti_time233232323232", startTime)
84
+	fmt.Println("end_time2323223232323", endTime)
85
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
56
 	if err != nil {
86
 	if err != nil {
57
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
87
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
58
 		return
88
 		return
66
 func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
96
 func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
67
 
97
 
68
 	orgId := this.GetMobileAdminUserInfo().Org.Id
98
 	orgId := this.GetMobileAdminUserInfo().Org.Id
69
-	start_time, _ := this.GetInt64("start_time")
70
-	end_time, _ := this.GetInt64("end_time")
99
+	//start_time, _ := this.GetInt64("start_time")
100
+	//end_time, _ := this.GetInt64("end_time")
101
+	start_time_one := this.GetString("start_time_one")
102
+	end_time_one := this.GetString("end_time_one")
103
+	timeLayout := "2006-01-02"
104
+	loc, _ := time.LoadLocation("Local")
105
+	var startTime int64
106
+	if len(start_time_one) > 0 {
107
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
108
+		if err != nil {
109
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
110
+			return
111
+		}
112
+		startTime = theTime.Unix()
113
+	}
114
+	var endTime int64
115
+	if len(end_time_one) > 0 {
116
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
117
+		if err != nil {
118
+			utils.ErrorLog(err.Error())
119
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
120
+			return
121
+		}
122
+		endTime = theTime.Unix()
123
+	}
71
 
124
 
72
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
125
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
73
 	if err != nil {
126
 	if err != nil {
74
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
127
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
75
 		return
128
 		return
82
 
135
 
83
 func (this *StaffScheduleApiController) GetScheduleByUserType() {
136
 func (this *StaffScheduleApiController) GetScheduleByUserType() {
84
 	doctor_id, _ := this.GetInt64("doctor_id")
137
 	doctor_id, _ := this.GetInt64("doctor_id")
85
-	start_time, _ := this.GetInt64("start_time")
86
-	end_time, _ := this.GetInt64("end_time")
138
+	//start_time, _ := this.GetInt64("start_time")
139
+	//end_time, _ := this.GetInt64("end_time")
140
+	start_time_one := this.GetString("start_time_one")
141
+	end_time_one := this.GetString("end_time_one")
142
+	timeLayout := "2006-01-02"
143
+	loc, _ := time.LoadLocation("Local")
144
+	var startTime int64
145
+	if len(start_time_one) > 0 {
146
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
147
+		if err != nil {
148
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
149
+			return
150
+		}
151
+		startTime = theTime.Unix()
152
+	}
153
+	var endTime int64
154
+	if len(end_time_one) > 0 {
155
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
156
+		if err != nil {
157
+			utils.ErrorLog(err.Error())
158
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
159
+			return
160
+		}
161
+		endTime = theTime.Unix()
162
+	}
87
 	orgId := this.GetMobileAdminUserInfo().Org.Id
163
 	orgId := this.GetMobileAdminUserInfo().Org.Id
88
-	staffList, err := service.GetScheduleByDoctorId(doctor_id, start_time, end_time, orgId)
164
+	staffList, err := service.GetScheduleByDoctorId(doctor_id, startTime, endTime, orgId)
89
 	if err != nil {
165
 	if err != nil {
90
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
166
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
91
 		return
167
 		return
100
 
176
 
101
 	orgId := this.GetMobileAdminUserInfo().Org.Id
177
 	orgId := this.GetMobileAdminUserInfo().Org.Id
102
 	user_name := this.GetString("user_name")
178
 	user_name := this.GetString("user_name")
103
-	start_time, _ := this.GetInt64("start_time")
104
-	end_time, _ := this.GetInt64("end_time")
105
-	staffList, err := service.ToSearchSeacheduleList(user_name, start_time, end_time, orgId)
179
+	//start_time, _ := this.GetInt64("start_time")
180
+	//end_time, _ := this.GetInt64("end_time")
181
+
182
+	start_time_one := this.GetString("start_time_one")
183
+	end_time_one := this.GetString("end_time_one")
184
+	timeLayout := "2006-01-02"
185
+	loc, _ := time.LoadLocation("Local")
186
+	var startTime int64
187
+	if len(start_time_one) > 0 {
188
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
189
+		if err != nil {
190
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
191
+			return
192
+		}
193
+		startTime = theTime.Unix()
194
+	}
195
+	var endTime int64
196
+	if len(end_time_one) > 0 {
197
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
198
+		if err != nil {
199
+			utils.ErrorLog(err.Error())
200
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
201
+			return
202
+		}
203
+		endTime = theTime.Unix()
204
+	}
205
+	//
206
+	staffList, err := service.ToSearchSeacheduleList(user_name, startTime, endTime, orgId)
106
 	if err != nil {
207
 	if err != nil {
107
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
208
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
108
 		return
209
 		return
812
 	patient_id, _ := c.GetInt64("patient_id")
913
 	patient_id, _ := c.GetInt64("patient_id")
813
 	org_id := c.GetMobileAdminUserInfo().Org.Id
914
 	org_id := c.GetMobileAdminUserInfo().Org.Id
814
 	err := service.ChangeScheduleById(id, mode_id)
915
 	err := service.ChangeScheduleById(id, mode_id)
815
-	fmt.Println("9999999999999999", err)
916
+	fmt.Println("err", err)
816
 	err = service.ChangeDialysisSolution(patient_id, schedule_date, org_id, mode_id)
917
 	err = service.ChangeDialysisSolution(patient_id, schedule_date, org_id, mode_id)
817
 	c.ServeSuccessJSON(map[string]interface{}{
918
 	c.ServeSuccessJSON(map[string]interface{}{
818
 		"msg": "ok",
919
 		"msg": "ok",

+ 31 - 14
controllers/pharmacy_controller.go Bestand weergeven

35
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
35
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
36
 }
36
 }
37
 
37
 
38
-//测试
38
+// 测试
39
 func (this *PharmacyController) Tlili() {
39
 func (this *PharmacyController) Tlili() {
40
 	var err error
40
 	var err error
41
 	defer func() {
41
 	defer func() {
65
 	return
65
 	return
66
 }
66
 }
67
 
67
 
68
-//查询今天的待发药,已发药人数
68
+// 查询今天的待发药,已发药人数
69
 func (this *PharmacyController) TodayNumber() {
69
 func (this *PharmacyController) TodayNumber() {
70
 	var err error
70
 	var err error
71
 	defer func() {
71
 	defer func() {
166
 	}
166
 	}
167
 
167
 
168
 	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 {
168
 	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 {
169
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1)
170
-		fmt.Println("list23323232323232", list)
169
+
170
+		//获取排班班次
171
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
172
+
173
+		var ids []int64
174
+		for _, item := range schedule {
175
+			ids = append(ids, item.PatientId)
176
+		}
177
+
178
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
179
+
171
 		var flist []models.TmpPatientOne
180
 		var flist []models.TmpPatientOne
172
 		if len(list) > 0 {
181
 		if len(list) > 0 {
173
 			for _, item := range list {
182
 			for _, item := range list {
247
 			return
256
 			return
248
 		}
257
 		}
249
 		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
258
 		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
259
+
250
 		if err != nil {
260
 		if err != nil {
251
 			utils.ErrorLog(err.Error())
261
 			utils.ErrorLog(err.Error())
252
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
262
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
261
 	//当天已发药的人数
271
 	//当天已发药的人数
262
 	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
272
 	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
263
 
273
 
264
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0)
274
+		//获取排班班次
275
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
276
+		fmt.Println("schedule--------", schedule)
277
+		var ids []int64
278
+		for _, item := range schedule {
279
+			ids = append(ids, item.PatientId)
280
+		}
281
+
282
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
265
 
283
 
266
 		var flist []models.TmpPatientOne
284
 		var flist []models.TmpPatientOne
267
 		if len(list) > 0 {
285
 		if len(list) > 0 {
278
 
296
 
279
 }
297
 }
280
 
298
 
281
-//
282
 func (this *PharmacyController) GetPharmacyContent() {
299
 func (this *PharmacyController) GetPharmacyContent() {
283
 	var err error
300
 	var err error
284
 	defer func() {
301
 	defer func() {
320
 
337
 
321
 }
338
 }
322
 
339
 
323
-//发药按钮点击
340
+// 发药按钮点击
324
 func (this *PharmacyController) DispensingMedicine() {
341
 func (this *PharmacyController) DispensingMedicine() {
325
 	var err error
342
 	var err error
326
 	defer func() {
343
 	defer func() {
399
 	return
416
 	return
400
 }
417
 }
401
 
418
 
402
-//退药按钮点击
419
+// 退药按钮点击
403
 func (this *PharmacyController) DrugWithdrawal() {
420
 func (this *PharmacyController) DrugWithdrawal() {
404
 	var err error
421
 	var err error
405
 	defer func() {
422
 	defer func() {
437
 
454
 
438
 }
455
 }
439
 
456
 
440
-//发药明细列表
457
+// 发药明细列表
441
 func (this *PharmacyController) DispensingDetails() {
458
 func (this *PharmacyController) DispensingDetails() {
442
 	var err error
459
 	var err error
443
 	defer func() {
460
 	defer func() {
485
 	return
502
 	return
486
 }
503
 }
487
 
504
 
488
-//处方详情
505
+// 处方详情
489
 func (this *PharmacyController) PrescriptionDetails() {
506
 func (this *PharmacyController) PrescriptionDetails() {
490
 	var err error
507
 	var err error
491
 	defer func() {
508
 	defer func() {
518
 	return
535
 	return
519
 }
536
 }
520
 
537
 
521
-//已发药品的信息
538
+// 已发药品的信息
522
 func (this *PharmacyController) DispenseMedicine() {
539
 func (this *PharmacyController) DispenseMedicine() {
523
 	var err error
540
 	var err error
524
 	defer func() {
541
 	defer func() {
563
 	return
580
 	return
564
 }
581
 }
565
 
582
 
566
-//待发药的药品信息
583
+// 待发药的药品信息
567
 func (this *PharmacyController) WaitingMedicine() {
584
 func (this *PharmacyController) WaitingMedicine() {
568
 	var err error
585
 	var err error
569
 	defer func() {
586
 	defer func() {
608
 	return
625
 	return
609
 }
626
 }
610
 
627
 
611
-//获取药品的所有患者信息
628
+// 获取药品的所有患者信息
612
 func (this *PharmacyController) GetPatientsWithDrugs() {
629
 func (this *PharmacyController) GetPatientsWithDrugs() {
613
 	var err error
630
 	var err error
614
 	defer func() {
631
 	defer func() {
675
 	return
692
 	return
676
 }
693
 }
677
 
694
 
678
-//药品管理发药按钮点击
695
+// 药品管理发药按钮点击
679
 func (this *PharmacyController) MedicineDeparture() {
696
 func (this *PharmacyController) MedicineDeparture() {
680
 	var err error
697
 	var err error
681
 	defer func() {
698
 	defer func() {

+ 15 - 2
controllers/schedule_api_controller.go Bestand weergeven

4334
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4334
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4335
 	patitionIdStr := c.GetString("patitionid")
4335
 	patitionIdStr := c.GetString("patitionid")
4336
 	ids := strings.Split(patitionIdStr, ",")
4336
 	ids := strings.Split(patitionIdStr, ",")
4337
-	fmt.Println("patitonStr", ids)
4337
+	//fmt.Println("patitonStr", ids)
4338
 	schedule_type, _ := c.GetInt64("schedule_type")
4338
 	schedule_type, _ := c.GetInt64("schedule_type")
4339
+	is_before, _ := c.GetInt64("is_before")
4340
+	start_time := c.GetString("start_time")
4341
+	end_time := c.GetString("end_time")
4342
+
4339
 	adminInfo := c.GetAdminUserInfo()
4343
 	adminInfo := c.GetAdminUserInfo()
4340
 
4344
 
4341
 	thisTime := time.Now()
4345
 	thisTime := time.Now()
4346
+
4342
 	today := thisTime.Format("2006-01-02")
4347
 	today := thisTime.Format("2006-01-02")
4343
 	if week < 1 || week > 4 {
4348
 	if week < 1 || week > 4 {
4344
 		week = 2
4349
 		week = 2
4377
 	loc, _ := time.LoadLocation("Local")
4382
 	loc, _ := time.LoadLocation("Local")
4378
 	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
4383
 	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
4379
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4384
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4385
+
4380
 	weekStartPoint := theStarTime.Unix()
4386
 	weekStartPoint := theStarTime.Unix()
4381
 	weekEndPoint := theEndTime.Unix()
4387
 	weekEndPoint := theEndTime.Unix()
4382
-
4388
+	if is_before > 0 {
4389
+		timeLayout := "2006-01-02 15:04:05"
4390
+		loc, _ := time.LoadLocation("Local")
4391
+		theStarTime, _ := time.ParseInLocation(timeLayout, start_time, loc)
4392
+		theEndTime, _ := time.ParseInLocation(timeLayout, end_time, loc)
4393
+		weekStartPoint = theStarTime.Unix()
4394
+		weekEndPoint = theEndTime.Unix()
4395
+	}
4383
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4396
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4384
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4397
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4385
 	c.ServeSuccessJSON(map[string]interface{}{
4398
 	c.ServeSuccessJSON(map[string]interface{}{

+ 3 - 0
enums/error_code.go Bestand weergeven

275
 	ErrorCodeDelScheduleFailByDialysisTwo = 60000003
275
 	ErrorCodeDelScheduleFailByDialysisTwo = 60000003
276
 
276
 
277
 	ErrorCodeSyncWrong = 60000006
277
 	ErrorCodeSyncWrong = 60000006
278
+
279
+	AdviceCodeParamWrong = 600000007
278
 )
280
 )
279
 
281
 
280
 var ErrCodeMsgs = map[int]string{
282
 var ErrCodeMsgs = map[int]string{
533
 	ErrorCodePatientDialysisOrderTwo:      "被替换的患者已经上机,无法替换排班",
535
 	ErrorCodePatientDialysisOrderTwo:      "被替换的患者已经上机,无法替换排班",
534
 	ErrorCodePatientScheduleRepeat:        "一天只能存在一次排班",
536
 	ErrorCodePatientScheduleRepeat:        "一天只能存在一次排班",
535
 	ErrorCodeDelScheduleFailByDialysisTwo: "已经上机透析,不能操作排班",
537
 	ErrorCodeDelScheduleFailByDialysisTwo: "已经上机透析,不能操作排班",
538
+	AdviceCodeParamWrong:                  "医嘱核对人和执行人不能为同一人,请更换第二核对人!",
536
 }
539
 }
537
 
540
 
538
 type SGJError struct {
541
 type SGJError struct {

+ 2 - 0
models/dialysis.go Bestand weergeven

325
 	Age                            string  `gorm:"column:age" json:"age" form:"age"`
325
 	Age                            string  `gorm:"column:age" json:"age" form:"age"`
326
 	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
326
 	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
327
 	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
327
 	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
328
+	PointPuncture                  string  `gorm:"column:point_puncture" json:"point_puncture" form:"point_puncture"`
328
 }
329
 }
329
 
330
 
330
 func (PredialysisEvaluation) TableName() string {
331
 func (PredialysisEvaluation) TableName() string {
887
 	Number         int64  `gorm:"column:number" json:"number" form:"number"`
888
 	Number         int64  `gorm:"column:number" json:"number" form:"number"`
888
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
889
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
889
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
890
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
891
+	Url            string `gorm:"column:url" json:"url" form:"url"`
890
 }
892
 }
891
 
893
 
892
 func (XtDialysisOrder) TableName() string {
894
 func (XtDialysisOrder) TableName() string {

+ 1 - 0
models/patient_models.go Bestand weergeven

1177
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
1177
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
1178
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1178
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1179
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1179
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1180
+	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1180
 }
1181
 }
1181
 
1182
 
1182
 func (XtPatients) TableName() string {
1183
 func (XtPatients) TableName() string {

+ 1 - 1
service/dialysis_service.go Bestand weergeven

896
 	// cur_date := time.Now().Format("2006-01-02")
896
 	// cur_date := time.Now().Format("2006-01-02")
897
 	key := strconv.FormatInt(orgid, 10) + ":starfes"
897
 	key := strconv.FormatInt(orgid, 10) + ":starfes"
898
 	starfes_str, _ := redis.Get(key).Result()
898
 	starfes_str, _ := redis.Get(key).Result()
899
-
899
+	redis.Set(key, "", time.Second)
900
 	if len(starfes_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
900
 	if len(starfes_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
901
 		db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
901
 		db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
902
 		err = db.Select("x.id,x.admin_user_id,x.org_id,x.app_id,x.role_id,x.user_name,x.avatar,x.user_type,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id and s.status = 1").Where("x.org_id = ?", orgid).Scan(&es).Error
902
 		err = db.Select("x.id,x.admin_user_id,x.org_id,x.app_id,x.role_id,x.user_name,x.avatar,x.user_type,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id and s.status = 1").Where("x.org_id = ?", orgid).Scan(&es).Error

+ 1 - 1
service/dialysis_solution_service.go Bestand weergeven

203
 	//if partition_id > 0 {
203
 	//if partition_id > 0 {
204
 	//	db = db.Where("partition_id = ?", partition_id)
204
 	//	db = db.Where("partition_id = ?", partition_id)
205
 	//}
205
 	//}
206
-	fmt.Println("len-------------", len(partition_id))
206
+
207
 	if len(partition_id) > 0 {
207
 	if len(partition_id) > 0 {
208
 		db = db.Where("partition_id in(?)", partition_id)
208
 		db = db.Where("partition_id in(?)", partition_id)
209
 	}
209
 	}

+ 16 - 4
service/his_service.go Bestand weergeven

618
 	return
618
 	return
619
 }
619
 }
620
 
620
 
621
-//未收费
621
+// 未收费
622
 func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
622
 func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
623
 	err = readDb.Model(&models.HisPrescription{}).
623
 	err = readDb.Model(&models.HisPrescription{}).
624
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
624
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
637
 	return
637
 	return
638
 }
638
 }
639
 
639
 
640
-//已收费
640
+// 已收费
641
 func GetChargeMonthHisPrescriptionFour(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
641
 func GetChargeMonthHisPrescriptionFour(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
642
 	err = readDb.Model(&models.HisPrescription{}).
642
 	err = readDb.Model(&models.HisPrescription{}).
643
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
643
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2235
 	return
2235
 	return
2236
 }
2236
 }
2237
 
2237
 
2238
-//组
2238
+// 
2239
 func GetHisPrescriptionTemplateL(template_id int64, org_id int64) (prescription []*models.HisPrescriptionInfoTemplateL, err error) {
2239
 func GetHisPrescriptionTemplateL(template_id int64, org_id int64) (prescription []*models.HisPrescriptionInfoTemplateL, err error) {
2240
 	err = readDb.Model(&models.HisPrescriptionInfoTemplateL{}).
2240
 	err = readDb.Model(&models.HisPrescriptionInfoTemplateL{}).
2241
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
2241
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
2343
 	return
2343
 	return
2344
 }
2344
 }
2345
 
2345
 
2346
-//已收费
2346
+// 已收费
2347
 func GetChargeMonthHisPrescriptionFive(org_id int64, patient_id int64, order_number string, p_type int64) (prescription []*models.HisPrescription, err error) {
2347
 func GetChargeMonthHisPrescriptionFive(org_id int64, patient_id int64, order_number string, p_type int64) (prescription []*models.HisPrescription, err error) {
2348
 	err = readDb.Model(&models.HisPrescription{}).
2348
 	err = readDb.Model(&models.HisPrescription{}).
2349
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2349
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2714
 	err := XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status = 1", id).Update(map[string]interface{}{"treatment_plan": trement_plan}).Error
2714
 	err := XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status = 1", id).Update(map[string]interface{}{"treatment_plan": trement_plan}).Error
2715
 	return err
2715
 	return err
2716
 }
2716
 }
2717
+
2718
+func GetDialysisOrderList(orgid int64) (order []*models.XtDialysisOrder, err error) {
2719
+
2720
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and url<>''", orgid).Group("patient_id").Find(&order).Error
2721
+	return order, err
2722
+}
2723
+
2724
+func UpdatePatientDialysisOrder(patient_id int64, url string) error {
2725
+
2726
+	err := XTWriteDB().Model(&models.XtPatients{}).Where("id =? and status=1", patient_id).Updates(map[string]interface{}{"url": url}).Error
2727
+	return err
2728
+}

+ 4 - 0
service/new_stock_service.go Bestand weergeven

90
 		db = db.Where("x.sum_count = 0")
90
 		db = db.Where("x.sum_count = 0")
91
 	}
91
 	}
92
 
92
 
93
+	if good_type == 4 {
94
+		db = db.Where("x.sum_count > 0")
95
+	}
96
+
93
 	if len(keyword) > 0 {
97
 	if len(keyword) > 0 {
94
 		db = db.Where("good_name like ? or manufacturer in(?)", likeKey, ids)
98
 		db = db.Where("good_name like ? or manufacturer in(?)", likeKey, ids)
95
 	}
99
 	}

+ 2 - 2
service/patient_service.go Bestand weergeven

533
 }
533
 }
534
 
534
 
535
 func FindPatientByDialysisNo(orgID int64, dialysisNo string) (patient models.Patients, err error) {
535
 func FindPatientByDialysisNo(orgID int64, dialysisNo string) (patient models.Patients, err error) {
536
-	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and dialysis_no=?", orgID, dialysisNo).First(&patient).Error
536
+	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and dialysis_no=? and lapseto = 1", orgID, dialysisNo).First(&patient).Error
537
 	return
537
 	return
538
 }
538
 }
539
 
539
 
605
 		return db.Preload("DeviceNumber", "org_id = ?", orgID).
605
 		return db.Preload("DeviceNumber", "org_id = ?", orgID).
606
 			Preload("DeviceZone", "org_id = ?", orgID).
606
 			Preload("DeviceZone", "org_id = ?", orgID).
607
 			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
607
 			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
608
-	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1", orgID, no).First(&patient).Error
608
+	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1 ", orgID, no).First(&patient).Error
609
 	return
609
 	return
610
 }
610
 }
611
 
611
 

+ 36 - 2
service/pharmacy_service.go Bestand weergeven

96
 	return len(tmp), err
96
 	return len(tmp), err
97
 }
97
 }
98
 
98
 
99
-func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64) (advice []*models.HisDoctorAdviceInfo, err error) {
99
+func GetSchedulePatientId(start_time int64, end_time int64, org_id int64, class_type int64, partion_type int64) (schedule []*models.XtSchedules, err error) {
100
+
101
+	db := XTReadDB().Model(&schedule).Where("status = 1")
102
+
103
+	if start_time > 0 {
104
+		db = db.Where("schedule_date >=?", start_time)
105
+	}
106
+
107
+	if end_time > 0 {
108
+		db = db.Where("schedule_date <=?", end_time)
109
+	}
110
+
111
+	if org_id > 0 {
112
+		db = db.Where("user_org_id = ?", org_id)
113
+	}
114
+	if class_type > 0 {
115
+		db = db.Where("schedule_type =?", class_type)
116
+	}
117
+	if partion_type > 0 {
118
+		db = db.Where("partition_id = ?", partion_type)
119
+	}
120
+	err = db.Find(&schedule).Error
121
+
122
+	return schedule, err
123
+}
124
+
125
+func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64, ids []int64) (advice []*models.HisDoctorAdviceInfo, err error) {
100
 
126
 
101
 	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
127
 	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
102
 	if stime > 0 {
128
 	if stime > 0 {
109
 		db = db.Where("user_org_id = ?", orgid)
135
 		db = db.Where("user_org_id = ?", orgid)
110
 	}
136
 	}
111
 
137
 
138
+	if len(ids) == 0 {
139
+		db = db.Where("patient_id not in(?)", ids)
140
+	}
141
+	if len(ids) > 0 {
142
+		db = db.Where("patient_id in(?)", ids)
143
+	}
144
+
112
 	err = db.Group("patient_id").Find(&advice).Error
145
 	err = db.Group("patient_id").Find(&advice).Error
113
 	return advice, err
146
 	return advice, err
114
 }
147
 }
1828
 	if shift == 0 && partition == 0 {
1861
 	if shift == 0 && partition == 0 {
1829
 		return flist, nil
1862
 		return flist, nil
1830
 	}
1863
 	}
1831
-	err = XTWriteDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1864
+	err = XTReadDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1865
+
1832
 	if err != nil {
1866
 	if err != nil {
1833
 		return
1867
 		return
1834
 	}
1868
 	}

+ 4 - 0
service/self_drug_service.go Bestand weergeven

1816
 	if good_type == 3 {
1816
 	if good_type == 3 {
1817
 		db = db.Where("x.sum_count = 0")
1817
 		db = db.Where("x.sum_count = 0")
1818
 	}
1818
 	}
1819
+
1820
+	if good_type == 4 {
1821
+		db = db.Where("x.sum_count > 0")
1822
+	}
1819
 	if storehouse_id > 0 {
1823
 	if storehouse_id > 0 {
1820
 		db = db.Preload("DrugWarehouseInfo", "org_id = ? and status = 1 and storehouse_id = ? and is_check = 1", orgId, storehouse_id)
1824
 		db = db.Preload("DrugWarehouseInfo", "org_id = ? and status = 1 and storehouse_id = ? and is_check = 1", orgId, storehouse_id)
1821
 
1825