Browse Source

历史排班

28169 1 year ago
parent
commit
4154d3a042

+ 5 - 5
controllers/base_api_controller.go View File

73
 		var userAdmin models.AdminUser
73
 		var userAdmin models.AdminUser
74
 		userAdmin.Id = 16919
74
 		userAdmin.Id = 16919
75
 		userAdmin.Mobile = "15717313968"
75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 10612 //4,809
76
+		userAdmin.Id = 10344 //4,809
77
 		userAdmin.Mobile = "12222222222"
77
 		userAdmin.Mobile = "12222222222"
78
 		userAdmin.IsSuperAdmin = true
78
 		userAdmin.IsSuperAdmin = true
79
 		userAdmin.Status = 1
79
 		userAdmin.Status = 1
81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10460 //机构id 10344
84
+		subscibe.OrgId = 10206 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10460 //机构id小英9675或4
94
+		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
95
 		adminUserInfo.CurrentAppId = 17282 //4
95
 		adminUserInfo.CurrentAppId = 17282 //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10460 //机构id小英10344或4
329
+		subscibe.OrgId = 10206 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10460 //机构id小英9675或4
339
+		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
340
 		adminUserInfo.CurrentAppId = 17282 //4
340
 		adminUserInfo.CurrentAppId = 17282 //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes

+ 1 - 0
controllers/gobal_config_api_controller.go View File

1839
 	limit, _ := c.GetInt64("limit")
1839
 	limit, _ := c.GetInt64("limit")
1840
 	page, _ := c.GetInt64("page")
1840
 	page, _ := c.GetInt64("page")
1841
 	order, total, err := service.GetDrugOutOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id)
1841
 	order, total, err := service.GetDrugOutOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id)
1842
+
1842
 	houseList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1843
 	houseList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1843
 	patientsList, _ := service.GetAllpatient(adminInfo.CurrentOrgId)
1844
 	patientsList, _ := service.GetAllpatient(adminInfo.CurrentOrgId)
1844
 	var drugType = "药品类型"
1845
 	var drugType = "药品类型"

+ 62 - 71
controllers/his_api_controller.go View File

106
 
106
 
107
 	beego.Router("/api/getfapiaonumber", &HisApiController{}, "get:GetFaPiaoNumber")
107
 	beego.Router("/api/getfapiaonumber", &HisApiController{}, "get:GetFaPiaoNumber")
108
 
108
 
109
-	beego.Router("/api/associationprescription", &HisApiController{}, "get:AssociationHisPrescription")
110
-	beego.Router("/api/checkhispatient", &HisApiController{}, "get:CheckHisPatient")
109
+	//beego.Router("/api/associationprescription", &HisApiController{}, "get:AssociationHisPrescription")
110
+	//beego.Router("/api/checkhispatient", &HisApiController{}, "get:CheckHisPatient")
111
 
111
 
112
 }
112
 }
113
 
113
 
114
-func (c *HisApiController) CheckHisPatient() {
115
-	record_date := c.GetString("record_date")
116
-	patient_id, _ := c.GetInt64("patient_id")
117
-
118
-	timeLayout := "2006-01-02"
119
-	loc, _ := time.LoadLocation("Local")
120
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
121
-	if err != nil {
122
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
123
-		return
124
-	}
125
-	recordDateTime := theTime.Unix()
126
-	adminInfo := c.GetAdminUserInfo()
127
-	patients, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
128
-	if len(patients) > 1 {
129
-		ps, _ := service.GetHisPrescriptionByHisPatientID(recordDateTime, adminInfo.CurrentOrgId, patient_id)
130
-		if len(ps) > 0 {
131
-			c.ServeSuccessJSON(map[string]interface{}{
132
-				"status":         1,
133
-				"msg":            "关联",
134
-				"ps":             ps,
135
-				"his_patient_id": patients[len(patients)-1].ID,
136
-				"patient_id":     patients[len(patients)-1].PatientId,
137
-			})
138
-		} else {
139
-			c.ServeSuccessJSON(map[string]interface{}{
140
-				"status": 0,
141
-				"msg":    "无需关联",
142
-			})
143
-		}
144
-	} else {
145
-		c.ServeSuccessJSON(map[string]interface{}{
146
-			"status": 0,
147
-			"msg":    "无需关联",
148
-		})
149
-		return
150
-	}
151
-}
152
-func (c *HisApiController) AssociationHisPrescription() {
153
-	record_date := c.GetString("record_date")
154
-	his_patient_id, _ := c.GetInt64("his_patient_id")
155
-	patient_id, _ := c.GetInt64("patient_id")
156
-	p_ids := c.GetString("p_ids")
157
-	p_ids_arr := strings.Split(p_ids, ",")
158
-	timeLayout := "2006-01-02"
159
-	loc, _ := time.LoadLocation("Local")
160
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
161
-	if err != nil {
162
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
163
-		return
164
-	}
165
-	recordDateTime := theTime.Unix()
166
-	his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
167
-	if his_patient_id == 0 || his_patient.ID == 0 {
168
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
169
-		return
170
-	}
171
-	err = service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, recordDateTime, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
172
-	if err == nil {
173
-		c.ServeSuccessJSON(map[string]interface{}{
174
-			"msg": "关联处方成功",
175
-		})
176
-		return
177
-	} else {
178
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
179
-		return
180
-	}
181
-}
114
+//func (c *HisApiController) CheckHisPatient() {
115
+//	record_date := c.GetString("record_date")
116
+//	patient_id, _ := c.GetInt64("patient_id")
117
+//
118
+//	timeLayout := "2006-01-02"
119
+//	loc, _ := time.LoadLocation("Local")
120
+//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
121
+//	if err != nil {
122
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
123
+//		return
124
+//	}
125
+//	recordDateTime := theTime.Unix()
126
+//	adminInfo := c.GetAdminUserInfo()
127
+//	patients, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
128
+//	if len(patients) > 1 {
129
+//		ps, _ := service.GetHisPrescriptionByHisPatientID(recordDateTime, adminInfo.CurrentOrgId, patient_id)
130
+//		if len(ps) > 0 {
131
+//			c.ServeSuccessJSON(map[string]interface{}{
132
+//				"status": 1,
133
+//				"msg":    "关联",
134
+//				"ps":     ps,
135
+//			})
136
+//		} else {
137
+//			c.ServeSuccessJSON(map[string]interface{}{
138
+//				"status": 0,
139
+//				"msg":    "无需关联",
140
+//			})
141
+//		}
142
+//	} else {
143
+//		c.ServeSuccessJSON(map[string]interface{}{
144
+//			"status": 0,
145
+//			"msg":    "无需关联",
146
+//		})
147
+//		return
148
+//	}
149
+//}
150
+//func (c *HisApiController) AssociationHisPrescription() {
151
+//	record_date, _ := c.GetInt64("record_date")
152
+//	his_patient_id, _ := c.GetInt64("his_patient_id")
153
+//	patient_id, _ := c.GetInt64("patient_id")
154
+//	p_ids := c.GetString("p_ids")
155
+//	p_ids_arr := strings.Split(p_ids, ",")
156
+//	his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
157
+//	if his_patient_id == 0 || his_patient.ID == 0 {
158
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
159
+//		return
160
+//	}
161
+//	err := service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, record_date, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
162
+//	if err == nil {
163
+//		c.ServeSuccessJSON(map[string]interface{}{
164
+//			"msg": "关联处方成功",
165
+//		})
166
+//		return
167
+//	} else {
168
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
169
+//		return
170
+//	}
171
+//}
182
 
172
 
183
 //func (c *HisApiController) AssociationHisPrescription() {
173
 //func (c *HisApiController) AssociationHisPrescription() {
184
 //	record_date, _ := c.GetInt64("record_date")
174
 //	record_date, _ := c.GetInt64("record_date")
7393
 			AliPay:                ali_pay,
7383
 			AliPay:                ali_pay,
7394
 			JifenPay:              jifen_pay,
7384
 			JifenPay:              jifen_pay,
7395
 			BandCardPay:           band_card_pay,
7385
 			BandCardPay:           band_card_pay,
7386
+			Creator:               adminUser.AdminUser.Id,
7396
 		}
7387
 		}
7397
 		err = service.CreateOrderTX(order, tx)
7388
 		err = service.CreateOrderTX(order, tx)
7398
 		if err != nil {
7389
 		if err != nil {
9189
 		"name":                                order.PsnName,            //姓名
9180
 		"name":                                order.PsnName,            //姓名
9190
 		"gender":                              patient.Gender,           //性别
9181
 		"gender":                              patient.Gender,           //性别
9191
 		"psn_cash_money":                      order.PsnCashPay,         //个人支付
9182
 		"psn_cash_money":                      order.PsnCashPay,         //个人支付
9192
-		"pay_way":                             "门诊",                   //结算方式
9183
+		"pay_way":                             "门诊",                     //结算方式
9193
 		"medfee_sumamt":                       order.MedfeeSumamt,       //总费用
9184
 		"medfee_sumamt":                       order.MedfeeSumamt,       //总费用
9194
 		"admin_user_name":                     admin.UserName,           //收款员
9185
 		"admin_user_name":                     admin.UserName,           //收款员
9195
 		"order":                               order,
9186
 		"order":                               order,

+ 7 - 9
controllers/mobile_api_controllers/check_weight_api_controller.go View File

1206
 	// 获取当前或者下次排班信息
1206
 	// 获取当前或者下次排班信息
1207
 	var sc map[string]interface{}
1207
 	var sc map[string]interface{}
1208
 	sc = make(map[string]interface{})
1208
 	sc = make(map[string]interface{})
1209
-	var mode_id int64
1210
 	if dialysistype == 1 {
1209
 	if dialysistype == 1 {
1211
 		daySchedule, _ := service.GetPatientScheduleFormDay(adminUserInfo.Org.Id, startTime, endTime, id)
1210
 		daySchedule, _ := service.GetPatientScheduleFormDay(adminUserInfo.Org.Id, startTime, endTime, id)
1212
-		println(daySchedule[0].Schedule.ModeId)
1213
 		if len(daySchedule) <= 0 {
1211
 		if len(daySchedule) <= 0 {
1214
 			sc["code"] = 1
1212
 			sc["code"] = 1
1215
 			sc["msg"] = "抱歉,您今天没有排版!"
1213
 			sc["msg"] = "抱歉,您今天没有排版!"
1216
-			mode_id = 0
1214
+			sc["mode"] = 0
1217
 			sc["data"] = daySchedule
1215
 			sc["data"] = daySchedule
1218
 		} else {
1216
 		} else {
1219
 			if daySchedule[0].Schedule.ID > 0 {
1217
 			if daySchedule[0].Schedule.ID > 0 {
1220
 				sc["code"] = 0
1218
 				sc["code"] = 0
1221
 				sc["msg"] = ""
1219
 				sc["msg"] = ""
1222
-				mode_id = daySchedule[0].Schedule.ModeId
1220
+				sc["mode"] = daySchedule[0].Schedule.ModeId
1223
 				sc["data"] = daySchedule
1221
 				sc["data"] = daySchedule
1224
 			} else {
1222
 			} else {
1225
 				sc["code"] = 1
1223
 				sc["code"] = 1
1226
 				sc["msg"] = "抱歉,您今天没有排版!"
1224
 				sc["msg"] = "抱歉,您今天没有排版!"
1227
-				mode_id = 0
1225
+				sc["mode"] = 0
1228
 				sc["data"] = daySchedule
1226
 				sc["data"] = daySchedule
1229
 			}
1227
 			}
1230
 		}
1228
 		}
1241
 		if len(nextSchedule) <= 0 {
1239
 		if len(nextSchedule) <= 0 {
1242
 			sc["code"] = 1
1240
 			sc["code"] = 1
1243
 			sc["msg"] = "抱歉,您后续没有排版!"
1241
 			sc["msg"] = "抱歉,您后续没有排版!"
1244
-			mode_id = 0
1242
+			sc["mode"] = 0
1245
 			sc["data"] = nextSchedule
1243
 			sc["data"] = nextSchedule
1246
 		} else {
1244
 		} else {
1247
 			if nextSchedule[0].Schedule.ID > 0 {
1245
 			if nextSchedule[0].Schedule.ID > 0 {
1248
 				sc["code"] = 0
1246
 				sc["code"] = 0
1249
 				sc["msg"] = ""
1247
 				sc["msg"] = ""
1250
-				mode_id = nextSchedule[0].Schedule.ModeId
1248
+				sc["mode"] = nextSchedule[0].Schedule.ModeId
1251
 				sc["data"] = nextSchedule
1249
 				sc["data"] = nextSchedule
1252
 			} else {
1250
 			} else {
1253
 				sc["code"] = 1
1251
 				sc["code"] = 1
1254
 				sc["msg"] = "抱歉,您后续没有排版!"
1252
 				sc["msg"] = "抱歉,您后续没有排版!"
1255
-				mode_id = 0
1253
+				sc["mode"] = 0
1256
 				sc["data"] = nextSchedule
1254
 				sc["data"] = nextSchedule
1257
 			}
1255
 			}
1258
 		}
1256
 		}
1259
 	}
1257
 	}
1260
 
1258
 
1261
-	switch mode_id {
1259
+	switch sc["mode"] {
1262
 	case 1:
1260
 	case 1:
1263
 		sc["mode"] = "HD"
1261
 		sc["mode"] = "HD"
1264
 		break
1262
 		break

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go View File

1666
 				//
1666
 				//
1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1668
 				fmt.Println("config.IsOpen", item.UserOrgId)
1668
 				fmt.Println("config.IsOpen", item.UserOrgId)
1669
-				if config.IsOpen == 1 && item.UserOrgId == 10028 {
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
-				}
1669
+				//if config.IsOpen == 0 && item.UserOrgId == 10402 {
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
+				//}
1685
 
1685
 
1686
 			}
1686
 			}
1687
 		}
1687
 		}

+ 7 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

516
 				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
516
 				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
517
 			}
517
 			}
518
 		}
518
 		}
519
+
520
+		if org_id == 10206 {
521
+			advice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
522
+			if len(advice) > 0 {
523
+				service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
524
+			}
525
+		}
519
 		redis := service.RedisClient()
526
 		redis := service.RedisClient()
520
 		//处方
527
 		//处方
521
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
528
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 6 - 3
controllers/patient_api_controller.go View File

3290
 	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLongTimeAdviceNotCanntEdit)
3290
 	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLongTimeAdviceNotCanntEdit)
3291
 	//	return
3291
 	//	return
3292
 	//}
3292
 	//}
3293
-	if advice.StopState == 1 || advice.ExecutionState == 1 {
3294
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
3295
-		return
3293
+
3294
+	if adminUserInfo.CurrentOrgId != 10612 && adminUserInfo.CurrentOrgId != 10460 {
3295
+		if advice.StopState == 1 || advice.ExecutionState == 1 {
3296
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
3297
+			return
3298
+		}
3296
 	}
3299
 	}
3297
 
3300
 
3298
 	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3301
 	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)

+ 75 - 28
controllers/schedule_api_controller.go View File

98
 	id_two, _ := c.GetInt64("id_two")
98
 	id_two, _ := c.GetInt64("id_two")
99
 	sch, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_one)
99
 	sch, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_one)
100
 	sch_two, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_two)
100
 	sch_two, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_two)
101
+	//order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
102
+	//if order.ID > 0 {
103
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
104
+	//	return
105
+	//}
101
 	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
106
 	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
102
 	if order.ID > 0 {
107
 	if order.ID > 0 {
103
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
104
-		return
105
-	}
106
-	order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
107
-	if order2.ID > 0 {
108
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
109
-		return
108
+
109
+		service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
110
+		redis := service.RedisClient()
111
+		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
112
+		redis.Set(key, "", time.Second)
113
+		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
114
+
115
+		//清空key 值
116
+		redis.Set(keyOne, "", time.Second)
117
+
118
+		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
119
+		//return
110
 	}
120
 	}
111
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
121
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
112
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
122
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
154
 	id_two, _ := c.GetInt64("id_two")
164
 	id_two, _ := c.GetInt64("id_two")
155
 	sch, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_one)
165
 	sch, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_one)
156
 	sch_two, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_two)
166
 	sch_two, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_two)
157
-	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
158
-	if order.ID > 0 {
159
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
160
-		return
161
-	}
162
-	order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
163
-	if order2.ID > 0 {
164
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
165
-		return
166
-	}
167
+
168
+	//order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
169
+	//if order2.ID > 0 {
170
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
171
+	//	return
172
+	//}
167
 
173
 
168
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
174
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
169
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
175
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
181
 	}
187
 	}
182
 
188
 
183
 	err := service.UpdateScheduleThree(sch, sch_two)
189
 	err := service.UpdateScheduleThree(sch, sch_two)
190
+
191
+	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
192
+	if order.ID > 0 {
193
+		//查询该患者的排班机位
194
+		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
195
+		service.UpdateDialysiOrderByPatientId(id_two, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
196
+		redis := service.RedisClient()
197
+		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
198
+		redis.Set(key, "", time.Second)
199
+		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
200
+
201
+		//清空key 值
202
+		redis.Set(keyOne, "", time.Second)
203
+		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
204
+		//return
205
+	}
184
 	if err == nil {
206
 	if err == nil {
185
 
207
 
186
 		//去除当天患者排班中重复数据,保留最后一条数据
208
 		//去除当天患者排班中重复数据,保留最后一条数据
1667
 		return
1689
 		return
1668
 	}
1690
 	}
1669
 
1691
 
1670
-	order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1671
-	if err != nil {
1672
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1673
-		return
1674
-	}
1675
-
1676
-	if order != nil {
1677
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDelScheduleFailByDialysis)
1678
-		return
1679
-	}
1692
+	//order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1693
+	//if err != nil {
1694
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1695
+	//	return
1696
+	//}
1697
+	//
1698
+	//if order != nil {
1699
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDelScheduleFailByDialysis)
1700
+	//	return
1701
+	//}
1680
 
1702
 
1681
 	schedule_two.Status = 0
1703
 	schedule_two.Status = 0
1682
 	schedule_two.UpdatedTime = time.Now().Unix()
1704
 	schedule_two.UpdatedTime = time.Now().Unix()
1696
 	var schedule models.Schedule
1718
 	var schedule models.Schedule
1697
 	dataBody := make(map[string]interface{}, 0)
1719
 	dataBody := make(map[string]interface{}, 0)
1698
 
1720
 
1699
-	err = json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1721
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1700
 	if err != nil {
1722
 	if err != nil {
1701
 		utils.ErrorLog(err.Error())
1723
 		utils.ErrorLog(err.Error())
1702
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1724
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1858
 	//}
1880
 	//}
1859
 	//同天同位置只能排一个
1881
 	//同天同位置只能排一个
1860
 	pointSchedule, err := service.GetPointSchedule(adminUserInfo.CurrentOrgId, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
1882
 	pointSchedule, err := service.GetPointSchedule(adminUserInfo.CurrentOrgId, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
1883
+
1861
 	if err != nil {
1884
 	if err != nil {
1862
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1885
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1863
 		return
1886
 		return
1867
 		return
1890
 		return
1868
 	}
1891
 	}
1869
 	schedule.IsExport = 1000
1892
 	schedule.IsExport = 1000
1893
+
1870
 	err = service.CreateSchedule(&schedule, id)
1894
 	err = service.CreateSchedule(&schedule, id)
1871
 
1895
 
1872
 	lastSchedule, _ := service.GetLastSchedule(patientID, adminUserInfo.CurrentOrgId)
1896
 	lastSchedule, _ := service.GetLastSchedule(patientID, adminUserInfo.CurrentOrgId)
1897
+
1898
+	//查询上机床位号 更改床位号
1899
+	order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1900
+
1901
+	if order.ID > 0 {
1902
+		service.UpdateDialysiOrderByPatientId(order.ID, schedule.ScheduleType, schedule.PartitionId, order.BedID)
1903
+		redis := service.RedisClient()
1904
+		key := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
1905
+		redis.Set(key, "", time.Second)
1906
+		keyOne := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1907
+
1908
+		//清空key 值
1909
+		redis.Set(keyOne, "", time.Second)
1910
+
1911
+	}
1912
+
1873
 	if err == nil {
1913
 	if err == nil {
1874
 		redis := service.RedisClient()
1914
 		redis := service.RedisClient()
1875
 		key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1915
 		key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1976
 		}
2016
 		}
1977
 	}
2017
 	}
1978
 
2018
 
2019
+	if adminINfo.CurrentOrgId == 10206 {
2020
+		advice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2021
+		if len(advice) > 0 {
2022
+			service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2023
+		}
2024
+	}
2025
+
1979
 	redis := service.RedisClient()
2026
 	redis := service.RedisClient()
1980
 
2027
 
1981
 	//处方
2028
 	//处方

+ 29 - 25
controllers/sign_api_controller.go View File

8
 	"fmt"
8
 	"fmt"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
 	"github.com/jung-kurt/gofpdf"
10
 	"github.com/jung-kurt/gofpdf"
11
-	"github.com/mozillazg/go-pinyin"
12
 	"io/ioutil"
11
 	"io/ioutil"
13
 	"time"
12
 	"time"
14
 )
13
 )
665
 
664
 
666
 func (this *SignApiController) UploadPrintOrder() {
665
 func (this *SignApiController) UploadPrintOrder() {
667
 
666
 
668
-	list, _ := service.GetAllPatientNew(10579)
669
-	for _, item := range list {
670
-
671
-		hans := item.Name // 要转换的汉字字符串
672
-		// 创建一个拼音转换器
673
-		p := pinyin.NewArgs()
674
-
675
-		// 将汉字转为拼音
676
-		pinyinSlice := pinyin.Pinyin(hans, p)
677
-
678
-		// 输出拼音
679
-		fmt.Println("Pinyin:", pinyinSlice)
667
+	orderList, _ := service.GetWarehouseOutOrderList()
680
 
668
 
681
-		// 获取首字母
682
-		firstLetter := ""
683
-		for _, py := range pinyinSlice {
684
-			if len(py) > 0 {
685
-				firstLetter += string(py[0][0])
686
-			}
687
-		}
688
-
689
-		item.FirstLetter = firstLetter
690
-		service.UpdatePatientNew(item.ID, item.FirstLetter)
691
-		// 输出首字母
692
-		//fmt.Println("First Letter:", firstLetter)
669
+	for _, item := range orderList {
670
+		service.UpdateWarehouseOutOrderInfo(item.ID, item.WarehouseOutOrderNumber)
693
 	}
671
 	}
672
+	//list, _ := service.GetAllPatientNew(10318)
673
+	//for _, item := range list {
674
+	//
675
+	//	hans := item.Name // 要转换的汉字字符串
676
+	//	// 创建一个拼音转换器
677
+	//	p := pinyin.NewArgs()
678
+	//
679
+	//	// 将汉字转为拼音
680
+	//	pinyinSlice := pinyin.Pinyin(hans, p)
681
+	//
682
+	//	// 输出拼音
683
+	//	fmt.Println("Pinyin:", pinyinSlice)
684
+	//
685
+	//	// 获取首字母
686
+	//	firstLetter := ""
687
+	//	for _, py := range pinyinSlice {
688
+	//		if len(py) > 0 {
689
+	//			firstLetter += string(py[0][0])
690
+	//		}
691
+	//	}
692
+	//
693
+	//	item.FirstLetter = firstLetter
694
+	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
695
+	//	// 输出首字母
696
+	//	//fmt.Println("First Letter:", firstLetter)
697
+	//}
694
 
698
 
695
 	//baseList, _ := service.GeteAllBaseList(10587)
699
 	//baseList, _ := service.GeteAllBaseList(10587)
696
 	//for _, item := range baseList {
700
 	//for _, item := range baseList {

+ 4 - 1
controllers/stock_in_api_controller.go View File

4949
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4949
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4950
 	order, _ := service.GetWarehouseOutOrder(idsArray, orgId)
4950
 	order, _ := service.GetWarehouseOutOrder(idsArray, orgId)
4951
 	list, _ := service.GetOrderDetialByOrderIdOne(idsArray, orgId)
4951
 	list, _ := service.GetOrderDetialByOrderIdOne(idsArray, orgId)
4952
+	fmt.Println("list000000000000000000000000", len(list))
4952
 	stockFlowListGroup, _ := service.GetOrderDetailStockFlowByStorehouseById(idsArray, orgId)
4953
 	stockFlowListGroup, _ := service.GetOrderDetailStockFlowByStorehouseById(idsArray, orgId)
4953
 	stockFlowList, _ := service.GetOrderDetailStockFlow(idsArray, orgId)
4954
 	stockFlowList, _ := service.GetOrderDetailStockFlow(idsArray, orgId)
4954
 	//获取耗材退库数据
4955
 	//获取耗材退库数据
4970
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4971
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4971
 	//自动出库
4972
 	//自动出库
4972
 	userDetails, err, total := service.FindUserDetailByIdOne(good_id, record_time, orgId)
4973
 	userDetails, err, total := service.FindUserDetailByIdOne(good_id, record_time, orgId)
4973
-
4974
+	fmt.Println("userDetails00---------", userDetails)
4974
 	//手动出库
4975
 	//手动出库
4975
 	info, _ := service.GetWarehouseOutInfoById(id, good_id)
4976
 	info, _ := service.GetWarehouseOutInfoById(id, good_id)
4976
 
4977
 
4977
 	//出库数据
4978
 	//出库数据
4978
 	stockFlowList, err := service.GetStockFlowBatchNumberOne(id, good_id)
4979
 	stockFlowList, err := service.GetStockFlowBatchNumberOne(id, good_id)
4980
+
4981
+	fmt.Println("stockFlowList", stockFlowList)
4979
 	//退库数据
4982
 	//退库数据
4980
 	cancelInfo, err := service.GetStockFlowCancelInfo(id, good_id)
4983
 	cancelInfo, err := service.GetStockFlowCancelInfo(id, good_id)
4981
 	if err == nil {
4984
 	if err == nil {

+ 1 - 0
models/self_drug_models.go View File

590
 	InPrice                 float64 `gorm:"column:price" json:"in_price" form:"price"`
590
 	InPrice                 float64 `gorm:"column:price" json:"in_price" form:"price"`
591
 	WarehousingInfoId       int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
591
 	WarehousingInfoId       int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
592
 	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
592
 	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
593
+	InforPrice              float64 `json:"infor_price"`
593
 }
594
 }
594
 
595
 
595
 type XtMonitorConfig struct {
596
 type XtMonitorConfig struct {

+ 16 - 0
service/dialysis_service.go View File

1066
 	return &order, nil
1066
 	return &order, nil
1067
 }
1067
 }
1068
 
1068
 
1069
+func GetPscheduleDate(schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1070
+
1071
+	schedule := models.XtSchedule{}
1072
+
1073
+	err := XTReadDB().Where("schedule_date = ? and patient_id = ? and user_org_id =? and status =1").Find(&schedule).Error
1074
+
1075
+	return schedule, err
1076
+}
1077
+
1078
+func UpdateDialysiOrderByPatientId(id int64, schedule_type int64, partion_id int64, bed_id int64) error {
1079
+
1080
+	err := XTWriteDB().Model(&models.DialysisOrder{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"schedual_type": schedule_type, "zone_id": partion_id, "bed_id": bed_id}).Error
1081
+
1082
+	return err
1083
+}
1084
+
1069
 func GetOrgInfoTemplate(orgID int64) (models.GobalTemplate, error) {
1085
 func GetOrgInfoTemplate(orgID int64) (models.GobalTemplate, error) {
1070
 	var templateInfo models.GobalTemplate
1086
 	var templateInfo models.GobalTemplate
1071
 	var err error
1087
 	var err error

+ 2 - 2
service/gobal_config_service.go View File

396
 
396
 
397
 	db = db.Joins("left join sgj_xt.xt_drug_warehouse_info as p on p.id =x.warehouse_info_id")
397
 	db = db.Joins("left join sgj_xt.xt_drug_warehouse_info as p on p.id =x.warehouse_info_id")
398
 	if manufacturerId > 0 {
398
 	if manufacturerId > 0 {
399
-		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.storehouse_id,x.patient_id,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,b.max_unit,b.min_number,b.dose,b.dose_unit,b.last_price,t.creater,p.price").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_id and t.org_id = ? and t.status  =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&outinfo).Error
399
+		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.storehouse_id,x.patient_id,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,b.max_unit,b.min_number,b.dose,b.dose_unit,b.last_price,t.creater,p.price as infor_price").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_id and t.org_id = ? and t.status  =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&outinfo).Error
400
 	} else {
400
 	} else {
401
-		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.storehouse_id,x.patient_id,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,b.max_unit,b.min_number,b.dose,b.dose_unit,b.last_price,t.creater,p.price").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_id and t.org_id = ? and t.status  =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&outinfo).Error
401
+		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.storehouse_id,x.patient_id,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,b.max_unit,b.min_number,b.dose,b.dose_unit,b.last_price,t.creater,p.price as infor_price").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_id and t.org_id = ? and t.status  =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&outinfo).Error
402
 	}
402
 	}
403
 
403
 
404
 	return outinfo, total, err
404
 	return outinfo, total, err

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

43
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
43
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
44
 		}).
44
 		}).
45
 		Preload("HisAdvices", func(db *gorm.DB) *gorm.DB {
45
 		Preload("HisAdvices", func(db *gorm.DB) *gorm.DB {
46
-			return db.Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, drug_spec_unit,advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time, groupno, IF(parent_id > 0, parent_id, id) as advice_order").
46
+			return db.Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, drug_spec_unit,advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time,prescription_id, groupno, IF(parent_id > 0, parent_id, id) as advice_order").
47
 				Where("user_org_id = ? AND status = 1", orgID).
47
 				Where("user_org_id = ? AND status = 1", orgID).
48
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
48
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
49
 		}).
49
 		}).

+ 12 - 0
service/schedule_service.go View File

1769
 	return advice, err
1769
 	return advice, err
1770
 }
1770
 }
1771
 
1771
 
1772
+func GetHisDoctorAdviceListTwenty(patient_id int64, schedule_date int64, user_org_id int64) (advice []*models.HisDoctorAdvice, err error) {
1773
+
1774
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&advice).Error
1775
+	return advice, err
1776
+}
1777
+
1772
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1778
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1773
 
1779
 
1774
 	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1780
 	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1775
 	return err
1781
 	return err
1776
 }
1782
 }
1777
 
1783
 
1784
+func UpdateHisAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1785
+
1786
+	err = XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1787
+	return err
1788
+}
1789
+
1778
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1790
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1779
 
1791
 
1780
 	schedule := models.XtSchedule{}
1792
 	schedule := models.XtSchedule{}

+ 13 - 1
service/sign_service.go View File

2099
 
2099
 
2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2101
 
2101
 
2102
-	err = XTReadDB().Where("status =1 and user_org_id =10567").Find(&list).Error
2102
+	err = XTReadDB().Where("status =1 and user_org_id =10265").Find(&list).Error
2103
 
2103
 
2104
 	return list, err
2104
 	return list, err
2105
 }
2105
 }
2200
 	err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("drug_id = ? and user_org_id = ?  and status=1", drug_id, user_org_id).Updates(map[string]interface{}{"price": retail_price}).Error
2200
 	err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("drug_id = ? and user_org_id = ?  and status=1", drug_id, user_org_id).Updates(map[string]interface{}{"price": retail_price}).Error
2201
 	return advice, err
2201
 	return advice, err
2202
 }
2202
 }
2203
+
2204
+func GetWarehouseOutOrderList() (out []*models.WarehouseOut, err error) {
2205
+
2206
+	err = XTReadDB().Where("status=1").Find(&out).Error
2207
+	return out, err
2208
+}
2209
+
2210
+func UpdateWarehouseOutOrderInfo(id int64, warehouse_out_order_number string) error {
2211
+
2212
+	err := XTWriteDB().Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? and status=1", id).Updates(map[string]interface{}{"warehouse_out_order_number": warehouse_out_order_number}).Error
2213
+	return err
2214
+}