Procházet zdrojové kódy

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

陈少旭 před 2 měsíci
rodič
revize
6f33c5afa5

+ 5 - 5
controllers/base_api_controller.go Zobrazit soubor

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

+ 1 - 0
controllers/gobal_config_api_controller.go Zobrazit soubor

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

+ 7 - 9
controllers/mobile_api_controllers/check_weight_api_controller.go Zobrazit soubor

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

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go Zobrazit soubor

@@ -1666,22 +1666,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1666 1666
 				//
1667 1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1668 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 Zobrazit soubor

@@ -516,6 +516,13 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
516 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 526
 		redis := service.RedisClient()
520 527
 		//处方
521 528
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 6 - 3
controllers/patient_api_controller.go Zobrazit soubor

@@ -3290,9 +3290,12 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
3290 3290
 	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLongTimeAdviceNotCanntEdit)
3291 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 3301
 	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)

+ 75 - 28
controllers/schedule_api_controller.go Zobrazit soubor

@@ -98,15 +98,25 @@ func (c *ScheduleApiController) CoverSch() {
98 98
 	id_two, _ := c.GetInt64("id_two")
99 99
 	sch, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_one)
100 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 106
 	order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
102 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 122
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
@@ -154,16 +164,12 @@ func (c *ScheduleApiController) ExchangeSch() {
154 164
 	id_two, _ := c.GetInt64("id_two")
155 165
 	sch, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_one)
156 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 175
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
@@ -181,6 +187,22 @@ func (c *ScheduleApiController) ExchangeSch() {
181 187
 	}
182 188
 
183 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 206
 	if err == nil {
185 207
 
186 208
 		//去除当天患者排班中重复数据,保留最后一条数据
@@ -1667,16 +1689,16 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1667 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 1703
 	schedule_two.Status = 0
1682 1704
 	schedule_two.UpdatedTime = time.Now().Unix()
@@ -1696,7 +1718,7 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1696 1718
 	var schedule models.Schedule
1697 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 1722
 	if err != nil {
1701 1723
 		utils.ErrorLog(err.Error())
1702 1724
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1858,6 +1880,7 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1858 1880
 	//}
1859 1881
 	//同天同位置只能排一个
1860 1882
 	pointSchedule, err := service.GetPointSchedule(adminUserInfo.CurrentOrgId, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
1883
+
1861 1884
 	if err != nil {
1862 1885
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1863 1886
 		return
@@ -1867,9 +1890,26 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
1867 1890
 		return
1868 1891
 	}
1869 1892
 	schedule.IsExport = 1000
1893
+
1870 1894
 	err = service.CreateSchedule(&schedule, id)
1871 1895
 
1872 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 1913
 	if err == nil {
1874 1914
 		redis := service.RedisClient()
1875 1915
 		key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
@@ -1976,6 +2016,13 @@ func (c *ScheduleApiController) DeleteSchedule() {
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 2026
 	redis := service.RedisClient()
1980 2027
 
1981 2028
 	//处方

+ 29 - 25
controllers/sign_api_controller.go Zobrazit soubor

@@ -8,7 +8,6 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jung-kurt/gofpdf"
11
-	"github.com/mozillazg/go-pinyin"
12 11
 	"io/ioutil"
13 12
 	"time"
14 13
 )
@@ -665,32 +664,37 @@ func (this *SignApiController) GetEnterPriseDetail() {
665 664
 
666 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 699
 	//baseList, _ := service.GeteAllBaseList(10587)
696 700
 	//for _, item := range baseList {

+ 4 - 1
controllers/stock_in_api_controller.go Zobrazit soubor

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

+ 1 - 0
models/self_drug_models.go Zobrazit soubor

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

+ 16 - 0
service/dialysis_service.go Zobrazit soubor

@@ -1066,6 +1066,22 @@ func GetOneDialysisOrder(orgID, orderData int64, patient_id int64) (*models.Dial
1066 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 1085
 func GetOrgInfoTemplate(orgID int64) (models.GobalTemplate, error) {
1070 1086
 	var templateInfo models.GobalTemplate
1071 1087
 	var err error

+ 2 - 2
service/gobal_config_service.go Zobrazit soubor

@@ -396,9 +396,9 @@ func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64
396 396
 
397 397
 	db = db.Joins("left join sgj_xt.xt_drug_warehouse_info as p on p.id =x.warehouse_info_id")
398 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 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 404
 	return outinfo, total, err

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Zobrazit soubor

@@ -43,7 +43,7 @@ func GetSchedules(orgID int64, schIDs []string) ([]*ScheduleVM, error) {
43 43
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
44 44
 		}).
45 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 47
 				Where("user_org_id = ? AND status = 1", orgID).
48 48
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
49 49
 		}).

+ 12 - 0
service/schedule_service.go Zobrazit soubor

@@ -1769,12 +1769,24 @@ func GetDoctorAdviceListTwenty(patient_id int64, schedule_date int64, user_org_i
1769 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 1778
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1773 1779
 
1774 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 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 1790
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1779 1791
 
1780 1792
 	schedule := models.XtSchedule{}

+ 13 - 1
service/sign_service.go Zobrazit soubor

@@ -2099,7 +2099,7 @@ func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64,
2099 2099
 
2100 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 2104
 	return list, err
2105 2105
 }
@@ -2200,3 +2200,15 @@ func UpdateHisDoctorAdviceOne(drug_id int64, retail_price float64, user_org_id i
2200 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 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
+}