浏览代码

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

陈少旭 3 周前
父节点
当前提交
1d2a347acd
共有 36 个文件被更改,包括 508 次插入122 次删除
  1. 二进制
      XT_New.exe
  2. 10 10
      controllers/base_api_controller.go
  3. 1 15
      controllers/common_api_controller.go
  4. 52 3
      controllers/drug_stock_api_contorller.go
  5. 23 7
      controllers/his_project_api_controller.go
  6. 21 0
      controllers/manage_api_controller.go
  7. 14 3
      controllers/manager_center_api_controller.go
  8. 22 18
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 6 9
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  10. 9 9
      controllers/mobile_api_controllers/patient_api_controller.go
  11. 1 0
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  12. 11 5
      controllers/patient_api_controller.go
  13. 9 7
      controllers/pharmacy_controller.go
  14. 33 2
      controllers/role_controller.go
  15. 29 6
      controllers/self_drug_api_congtroller.go
  16. 52 1
      controllers/stock_in_api_controller.go
  17. 8 0
      models/device_models.go
  18. 2 0
      models/drug.go
  19. 4 2
      models/good_models.go
  20. 11 7
      models/his_models.go
  21. 2 0
      models/new_stock_models.go
  22. 4 0
      models/role_models.go
  23. 39 0
      models/stock_models.go
  24. 3 3
      service/common_service.go
  25. 1 1
      service/device_service.go
  26. 2 2
      service/doctor_advice_service.go
  27. 1 1
      service/his_project_service.go
  28. 66 0
      service/his_service.go
  29. 9 0
      service/manage_center_service.go
  30. 1 1
      service/manage_service.go
  31. 6 2
      service/new_stock_service.go
  32. 8 1
      service/patient_service.go
  33. 9 3
      service/role_service.go
  34. 36 3
      service/self_drug_service.go
  35. 2 0
      service/stock_service.go
  36. 1 1
      service/user_service.go

二进制
XT_New.exe 查看文件


+ 10 - 10
controllers/base_api_controller.go 查看文件

@@ -72,10 +72,10 @@ func (this *BaseAuthAPIController) Prepare() {
72 72
 	this.BaseAPIController.Prepare()
73 73
 	if this.GetAdminUserInfo() == nil {
74 74
 		var userAdmin models.AdminUser
75
-		userAdmin.Id = 3207
75
+		userAdmin.Id = 2301
76 76
 		userAdmin.Mobile = "13318599895"
77 77
 
78
-		userAdmin.Id = 3207 //4,809
78
+		userAdmin.Id = 2301 //4,809
79 79
 		userAdmin.Mobile = "12222222222"
80 80
 		userAdmin.IsSuperAdmin = true
81 81
 		userAdmin.Status = 1
@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10745 //机构id
86
+		subscibe.OrgId = 10164 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10745 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 18734 //4
96
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 17733 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -318,10 +318,10 @@ func (this *BaseServeAPIController) Prepare() {
318 318
 	this.BaseAPIController.Prepare()
319 319
 	if this.GetAdminUserInfo() == nil {
320 320
 		var userAdmin models.AdminUser
321
-		userAdmin.Id = 3207
321
+		userAdmin.Id = 2301
322 322
 		userAdmin.Mobile = "13318599895"
323 323
 
324
-		userAdmin.Id = 3207 //4,809
324
+		userAdmin.Id = 2301 //4,809
325 325
 		userAdmin.Mobile = "12222222222"
326 326
 		userAdmin.IsSuperAdmin = false
327 327
 		userAdmin.Status = 1
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10745 //机构id小英9675或4
332
+		subscibe.OrgId = 10164 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10745 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 18734 //4
342
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 17733 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 15
controllers/common_api_controller.go 查看文件

@@ -1436,7 +1436,7 @@ func (this *CommonApiController) GetPatientscontrol() {
1436 1436
 	startimeStrUnix := startimeStr.Unix()
1437 1437
 
1438 1438
 	endtime := this.GetString("endtime")
1439
-	fmt.Println("结束时间", endtime)
1439
+
1440 1440
 	endtimeStr := endtime + " 23:59:59"
1441 1441
 	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
1442 1442
 	endtimeStrsUnix := endtimeStrs.Unix()
@@ -1467,34 +1467,20 @@ func (this *CommonApiController) GetPatientscontrol() {
1467 1467
 func (this *CommonApiController) GetCartogramList() {
1468 1468
 	adminUser := this.GetAdminUserInfo()
1469 1469
 	orgid := adminUser.CurrentOrgId
1470
-	//fmt.Println("orgid", orgid)
1471 1470
 	lapstor, _ := this.GetInt64("lapstor")
1472 1471
 	fmt.Println("lapstor", lapstor)
1473 1472
 	startime := this.GetString("startime")
1474
-	//fmt.Println("开始时间", startime)
1475 1473
 	startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
1476 1474
 	startimeStrUnix := startimeStr.Unix()
1477
-	//fmt.Println("时间搓", startimeStrUnix)
1478 1475
 	endtime := this.GetString("endtime")
1479
-	//fmt.Println("结束时间", endtime)
1480 1476
 	endtimeStr := endtime + " 23:59:59"
1481 1477
 	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
1482 1478
 	endtimeStrsUnix := endtimeStrs.Unix()
1483
-	//fmt.Println("结束时间搓", endtimeStrsUnix)
1484
-	//limit, _ := this.GetInt64("limit")
1485
-	//page, _ := this.GetInt64("page")
1486
-
1487 1479
 	//统计总共
1488 1480
 	_, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
1489
-	//fmt.Println("total=================", total)
1490 1481
 	//统计rangetype= 1
1491 1482
 	_, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
1492
-	//fmt.Println(standtotal)
1493 1483
 	_, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
1494
-	//fmt.Println(standtotalOne)
1495
-	//cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
1496
-	//infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
1497
-	//_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
1498 1484
 	if err != nil {
1499 1485
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1500 1486
 		return

+ 52 - 3
controllers/drug_stock_api_contorller.go 查看文件

@@ -3473,7 +3473,6 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3473 3473
 
3474 3474
 		flowList, _ := service.GetNewDrugFlowList(item.DrugId, item.OrgId, item.ID, tx)
3475 3475
 
3476
-		fmt.Println("FlowList=================", flowList)
3477 3476
 		var his_count int64
3478 3477
 		if len(flowList) > 0 {
3479 3478
 			for _, item := range flowList {
@@ -3489,8 +3488,6 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3489 3488
 				}
3490 3489
 			}
3491 3490
 		}
3492
-		fmt.Println("incount_0000000000000000", in_cout)
3493
-		fmt.Println("his_count--------------", his_count)
3494 3491
 
3495 3492
 		if in_cout != his_count {
3496 3493
 			is_success = 1
@@ -3498,6 +3495,32 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3498 3495
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFlow)
3499 3496
 			return
3500 3497
 		}
3498
+
3499
+		goodcodelist := strings.Split(item.DrugCode, ",")
3500
+
3501
+		if len(goodcodelist) > 0 {
3502
+			goodInfo, _ := service.GetNewDrugByIdIsStop(item.DrugId, item.OrgId, tx)
3503
+			for _, it := range goodcodelist {
3504
+				if it != "" {
3505
+					codeInfo := models.XtDrugCodeInfo{
3506
+						DrugId:          item.DrugId,
3507
+						BatchNumber:     item.Number,
3508
+						DrugCode:        it,
3509
+						WarehouseInfoId: item.ID,
3510
+						IsUserCount:     0,
3511
+						IsOutStatus:     2,
3512
+						Status:          1,
3513
+						UserOrgId:       item.OrgId,
3514
+						Ctime:           time.Now().Unix(),
3515
+						Mtime:           time.Now().Unix(),
3516
+						SplitOfNumber:   goodInfo.SplitOfNumber,
3517
+					}
3518
+					service.CreateDrugCodeInfo(codeInfo, tx)
3519
+				}
3520
+
3521
+			}
3522
+		}
3523
+
3501 3524
 	}
3502 3525
 
3503 3526
 	if is_success != 1 {
@@ -3600,6 +3623,32 @@ func (c *StockDrugApiController) ReturnCheckWarehouseingInfo() {
3600 3623
 		//扣减库存
3601 3624
 		service.ReduceNewDrugStockCount(item.StorehouseId, item.DrugId, item.OrgId, total_count, over_count, tx)
3602 3625
 
3626
+		//改变扫码库里面的状态
3627
+		goodcodelist := strings.Split(item.DrugCode, ",")
3628
+
3629
+		if len(goodcodelist) > 0 {
3630
+			goodInfo, _ := service.GetNewGoodByIdIsStop(item.DrugId, item.OrgId, tx)
3631
+			for _, it := range goodcodelist {
3632
+				if it != "" {
3633
+					codeInfo := models.XtDrugCodeInfo{
3634
+						DrugId:          item.DrugId,
3635
+						BatchNumber:     item.Number,
3636
+						DrugCode:        it,
3637
+						WarehouseInfoId: item.ID,
3638
+						IsUserCount:     0,
3639
+						IsOutStatus:     2,
3640
+						Status:          0,
3641
+						UserOrgId:       item.OrgId,
3642
+						Ctime:           time.Now().Unix(),
3643
+						Mtime:           time.Now().Unix(),
3644
+						SplitOfNumber:   goodInfo.SplitOfNumber,
3645
+					}
3646
+					service.UpdateDrugCodeInfo(codeInfo, tx)
3647
+				}
3648
+
3649
+			}
3650
+		}
3651
+
3603 3652
 	}
3604 3653
 	//更新审核
3605 3654
 	err := service.ReturnNewCheckWarehouseingInfo(warehousing_id, orgId, tx)

+ 23 - 7
controllers/his_project_api_controller.go 查看文件

@@ -856,14 +856,22 @@ func (this *HisProjectApiController) SaveDePartment() {
856 856
 
857 857
 	name := this.GetString("name")
858 858
 	number := this.GetString("number")
859
+	department_type := this.GetString("department_type")
860
+	lender := this.GetString("lender")
861
+	phone := this.GetString("phone")
862
+	start_time := this.GetString("start_time")
859 863
 	adminUserInfo := this.GetAdminUserInfo()
860 864
 	orgId := adminUserInfo.CurrentOrgId
861 865
 	department := models.XtHisDepartment{
862
-		Name:        name,
863
-		Number:      number,
864
-		UserOrgId:   orgId,
865
-		CreatedTime: time.Now().Unix(),
866
-		Status:      1,
866
+		Name:           name,
867
+		Number:         number,
868
+		UserOrgId:      orgId,
869
+		CreatedTime:    time.Now().Unix(),
870
+		Status:         1,
871
+		DepartmentType: department_type,
872
+		Lender:         lender,
873
+		Phone:          phone,
874
+		StartTime:      start_time,
867 875
 	}
868 876
 	err := service.CreateDePartment(&department)
869 877
 	if err != nil {
@@ -918,9 +926,17 @@ func (this *HisProjectApiController) UpdatedDeparment() {
918 926
 	id, _ := this.GetInt64("id")
919 927
 	name := this.GetString("name")
920 928
 	number := this.GetString("number")
929
+	department_type := this.GetString("department_type")
930
+	lender := this.GetString("lender")
931
+	phone := this.GetString("phone")
932
+	start_time := this.GetString("start_time")
921 933
 	department := models.XtHisDepartment{
922
-		Name:   name,
923
-		Number: number,
934
+		Name:           name,
935
+		Number:         number,
936
+		DepartmentType: department_type,
937
+		Lender:         lender,
938
+		Phone:          phone,
939
+		StartTime:      start_time,
924 940
 	}
925 941
 	err := service.UpdatedDepartment(id, &department)
926 942
 	if err != nil {

+ 21 - 0
controllers/manage_api_controller.go 查看文件

@@ -252,6 +252,14 @@ func (this *MachineApiController) SaveManageInfo() {
252 252
 	treat_types := dataBody["treat_type"].([]interface{})
253 253
 	revers := int64(dataBody["revers_mode"].(float64))
254 254
 	zone_id := int64(dataBody["zone_id"].(float64))
255
+	home_address := dataBody["home_address"].(string)
256
+
257
+	home_setting := dataBody["home_setting"].(string)
258
+
259
+	home_type := dataBody["home_type"].(string)
260
+
261
+	home_big_type := dataBody["home_big_type"].(string)
262
+
255 263
 	ids := make([]int64, 0)
256 264
 	for _, treat := range treat_types {
257 265
 		id := int64(treat.(float64))
@@ -295,6 +303,10 @@ func (this *MachineApiController) SaveManageInfo() {
295 303
 		Status:              1,
296 304
 		Ctime:               time.Now().Unix(),
297 305
 		UserOrgId:           orgid,
306
+		HomeAddress:         home_address,
307
+		HomeSetting:         home_setting,
308
+		HomeType:            home_type,
309
+		HomeBigType:         home_big_type,
298 310
 	}
299 311
 	err = service.CreateMacher(addmacher)
300 312
 	if err != nil {
@@ -375,6 +387,11 @@ func (this *MachineApiController) UpdateMachineInfo() {
375 387
 	user_year := dataBody["user_year"].(string)
376 388
 	work_time := dataBody["work_time"].(string)
377 389
 	treat_types := dataBody["treat_type"].([]interface{})
390
+	home_address := dataBody["home_address"].(string)
391
+	home_setting := dataBody["home_setting"].(string)
392
+	home_type := dataBody["home_type"].(string)
393
+
394
+	home_big_type := dataBody["home_big_type"].(string)
378 395
 	ids := make([]int64, 0)
379 396
 	for _, treat := range treat_types {
380 397
 		id := int64(treat.(float64))
@@ -412,6 +429,10 @@ func (this *MachineApiController) UpdateMachineInfo() {
412 429
 		UserYear:            user_year,
413 430
 		WorkTime:            work_time,
414 431
 		ZoneId:              zone_id,
432
+		HomeAddress:         home_address,
433
+		HomeSetting:         home_setting,
434
+		HomeType:            home_type,
435
+		HomeBigType:         home_big_type,
415 436
 	}
416 437
 	err = service.UpdateMachine(id, orgid, &addmacher)
417 438
 	errors := service.UpdateTreatMode(id, orgid, ids)

+ 14 - 3
controllers/manager_center_api_controller.go 查看文件

@@ -172,6 +172,8 @@ func (c *ManagerCenterApiController) CreateBaseDrugLib() {
172 172
 	scan_code := c.GetString("scan_code")
173 173
 	drug_identification_code := c.GetString("drug_identification_code")
174 174
 
175
+	split_of_number, _ := c.GetInt64("split_of_number")
176
+
175 177
 	hans := drug_name // 要转换的汉字字符串
176 178
 
177 179
 	// 创建一个拼音转换器
@@ -266,6 +268,7 @@ func (c *ManagerCenterApiController) CreateBaseDrugLib() {
266 268
 		IsZeroFlag:                  is_zero_flag,
267 269
 		ScanCode:                    scan_code,
268 270
 		DrugIdentificationCode:      drug_identification_code,
271
+		SplitOfNumber:               split_of_number,
269 272
 	}
270 273
 	drugLib.FirstLetter = firstLetter
271 274
 	drugLib.Pinyin = firstLetter
@@ -393,7 +396,7 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
393 396
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
394 397
 	scan_code := c.GetString("scan_code")
395 398
 	drug_identification_code := c.GetString("drug_identification_code")
396
-
399
+	split_of_number, _ := c.GetInt64("split_of_number")
397 400
 	adminInfo := c.GetAdminUserInfo()
398 401
 	drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
399 402
 
@@ -494,6 +497,7 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
494 497
 		IsZeroFlag:                  is_zero_flag,
495 498
 		ScanCode:                    scan_code,
496 499
 		DrugIdentificationCode:      drug_identification_code,
500
+		SplitOfNumber:               split_of_number,
497 501
 	}
498 502
 	if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
499 503
 
@@ -1610,7 +1614,7 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1610 1614
 	good_id, _ := c.GetInt64("good_id", 0)
1611 1615
 	specification_name := c.GetString("specification_name")
1612 1616
 	register_number := c.GetString("register_number")
1613
-
1617
+	register_number_name := c.GetString("register_number_name")
1614 1618
 	good_unit, _ := c.GetInt64("good_unit", -1)
1615 1619
 	buy_price, _ := c.GetFloat("buy_price", 0)
1616 1620
 	sell_price, _ := c.GetFloat("sell_price", 0)
@@ -1661,6 +1665,8 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1661 1665
 	is_show, _ := c.GetInt64("is_show")
1662 1666
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
1663 1667
 
1668
+	split_of_number, _ := c.GetInt64("split_of_number")
1669
+
1664 1670
 	adminUserInfo := c.GetAdminUserInfo()
1665 1671
 
1666 1672
 	totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
@@ -1745,6 +1751,8 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1745 1751
 		Bck01b:                      "55",
1746 1752
 		IsShow:                      is_show,
1747 1753
 		IsZeroFlag:                  is_zero_flag,
1754
+		SplitOfNumber:               split_of_number,
1755
+		RegisterNumberName:          register_number_name,
1748 1756
 	}
1749 1757
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1750 1758
 	if err == nil {
@@ -1816,7 +1824,8 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1816 1824
 	bby01 := c.GetString("bby01")
1817 1825
 	is_show, _ := c.GetInt64("is_show")
1818 1826
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
1819
-
1827
+	split_of_number, _ := c.GetInt64("split_of_number")
1828
+	register_number_name := c.GetString("register_number_name")
1820 1829
 	// 创建一个拼音转换器
1821 1830
 	p := pinyin.NewArgs()
1822 1831
 
@@ -1893,6 +1902,8 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1893 1902
 		Bck01b:                      "55",
1894 1903
 		IsShow:                      is_show,
1895 1904
 		IsZeroFlag:                  is_zero_flag,
1905
+		SplitOfNumber:               split_of_number,
1906
+		RegisterNumberName:          register_number_name,
1896 1907
 	}
1897 1908
 
1898 1909
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)

+ 22 - 18
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -4388,7 +4388,7 @@ func (this *DialysisAPIController) StartDialysis() {
4388 4388
 				}
4389 4389
 			}
4390 4390
 
4391
-			if adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 {
4391
+			if adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 || adminUserInfo.Org.Id == 9478 {
4392 4392
 				if prescription.ModeId == 2 || prescription.ModeId == 13 {
4393 4393
 					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4394 4394
 					if totalMin == 0 {
@@ -5953,25 +5953,8 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5953 5953
 		var displacement_quantity float64
5954 5954
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5955 5955
 
5956
-		//replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5957
-		////乘10 除10是为了保留一位小数
5958 5956
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5959
-		fmt.Println("replacement_rate", replacement_rate)
5960
-		record.ReplacementRate = replacement_rate
5961
-		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5962
-		record.DisplacementQuantity = displacement_quantity
5963
-		//fmt.Println("totalMin", totalMin)
5964
-		//fmt.Println("math.Floor(prescription", math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60))
5965
-		//fmt.Println("replacement_rate", replacement_rate)
5966
-		//fmt.Println("math.Floor", math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600))
5967
-		//fmt.Println("displacement_quantity===================", displacement_quantity)
5968
-	}
5969 5957
 
5970
-	if adminInfo.Org.Id == 9478 {
5971
-		var replacement_rate float64
5972
-		var displacement_quantity float64
5973
-		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5974
-		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5975 5958
 		record.ReplacementRate = replacement_rate
5976 5959
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5977 5960
 		record.DisplacementQuantity = displacement_quantity
@@ -5996,6 +5979,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5996 5979
 		var displacement_quantity float64
5997 5980
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5998 5981
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5982
+
5999 5983
 		record.ReplacementRate = replacement_rate
6000 5984
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
6001 5985
 		record.DisplacementQuantity = displacement_quantity
@@ -6032,6 +6016,22 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
6032 6016
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
6033 6017
 	}
6034 6018
 
6019
+	if adminInfo.Org.Id == 9478 {
6020
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
6021
+		if totalMin == 0 {
6022
+			totalMin = 240
6023
+		}
6024
+		if prescription.DisplaceLiquiValue == 0 {
6025
+			prescription.DisplaceLiquiValue = 15
6026
+		}
6027
+		var replacement_rate float64
6028
+		//乘10 除10是为了保留一位小数
6029
+		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
6030
+
6031
+		fmt.Println("hahahahahhaahahah", replacement_rate)
6032
+		record.ReplacementRate = replacement_rate
6033
+	}
6034
+
6035 6035
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
6036 6036
 
6037 6037
 	fisrtMonitorRecordList, _ := service.GetFisrtMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
@@ -13353,6 +13353,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13353 13353
 
13354 13354
 	dataBody := make(map[string]interface{}, 0)
13355 13355
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
13356
+
13356 13357
 	if err != nil {
13357 13358
 		utils.ErrorLog(err.Error())
13358 13359
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -13360,6 +13361,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13360 13361
 	}
13361 13362
 	orgId := c.GetMobileAdminUserInfo().Org.Id
13362 13363
 	patient_id := int64(dataBody["patient_id"].(float64))
13364
+
13363 13365
 	record_date := int64(dataBody["record_date"].(float64))
13364 13366
 
13365 13367
 	execution_staff := int64(dataBody["execution_staff"].(float64))
@@ -13367,6 +13369,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13367 13369
 	execution_time := dataBody["execution_time"].(string)
13368 13370
 
13369 13371
 	executionTime, parseStartDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", execution_time)
13372
+
13370 13373
 	if parseStartDateErr != nil {
13371 13374
 		c.ErrorLog("时间解析失败:%v", parseStartDateErr)
13372 13375
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -13378,6 +13381,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13378 13381
 	var team_list []int64
13379 13382
 	if dataBody["new_advice_list"] != nil && reflect.TypeOf(dataBody["new_advice_list"]).String() == "[]interface {}" {
13380 13383
 		newAdviceList, _ := dataBody["new_advice_list"].([]interface{})
13384
+
13381 13385
 		if len(newAdviceList) > 0 {
13382 13386
 			for _, item := range newAdviceList {
13383 13387
 				items := item.(map[string]interface{})

+ 6 - 9
controllers/mobile_api_controllers/dialysis_api_controller_extend.go 查看文件

@@ -2,7 +2,6 @@ package mobile_api_controllers
2 2
 
3 3
 import (
4 4
 	"encoding/json"
5
-	"fmt"
6 5
 	"strconv"
7 6
 	"time"
8 7
 
@@ -60,8 +59,6 @@ func (this *DialysisAPIController) AddMonitorRecord() {
60 59
 		operateTime = 0
61 60
 		// recordTime = ""
62 61
 	}
63
-	fmt.Println(date)
64
-	fmt.Println(operateTime)
65 62
 
66 63
 	pulseFrequency, _ := this.GetFloat("pulse_frequency")
67 64
 	//breathingRated, _ := this.GetFloat("breathing_rated")
@@ -267,7 +264,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
267 264
 		AccumulatedBloodVolumeOne:        accumulated_blood_volume_one,
268 265
 	}
269 266
 
270
-	err := service.CreateMonitor(&record)
267
+	service.CreateMonitor(&record)
271 268
 	//记录日志
272 269
 	byterequest, _ := json.Marshal(record)
273 270
 	monitorRecordLog := models.XtMonitorRecordLog{
@@ -297,7 +294,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
297 294
 		PatientId:  patientID,
298 295
 	}
299 296
 
300
-	dialysisFinish, err := service.GetDialysisFinish(record.UserOrgId, record.MonitoringDate, 7, patientID)
297
+	dialysisFinish, _ := service.GetDialysisFinish(record.UserOrgId, record.MonitoringDate, 7, patientID)
301 298
 	if dialysisFinish.ID == 0 {
302 299
 		service.CreateDialysisFinish(finish)
303 300
 	}
@@ -308,10 +305,10 @@ func (this *DialysisAPIController) AddMonitorRecord() {
308 305
 	keyOne := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_record_list_all"
309 306
 	redis.Set(keyOne, "", time.Second)
310 307
 	defer redis.Close()
311
-	if err != nil {
312
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorCreate)
313
-		return
314
-	}
308
+	//if err != nil {
309
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorCreate)
310
+	//	return
311
+	//}
315 312
 
316 313
 	this.ServeSuccessJSON(map[string]interface{}{
317 314
 		"monitor": record,

+ 9 - 9
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -1696,7 +1696,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1696 1696
 
1697 1697
 							if medical.IsUse != 1 {
1698 1698
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1699
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 {
1699
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 && advice.UserOrgId != 10610 {
1700 1700
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1701 1701
 										advice.ExecutionTime = 0
1702 1702
 										advice.ExecutionState = 2
@@ -1712,7 +1712,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1712 1712
 
1713 1713
 								}
1714 1714
 								if prescribing_number_total > total {
1715
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 {
1715
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 && advice.UserOrgId != 10610 {
1716 1716
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1717 1717
 										advice.ExecutionTime = 0
1718 1718
 										advice.ExecutionState = 2
@@ -1739,7 +1739,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1739 1739
 											//查询今日是否出库
1740 1740
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1741 1741
 											if drugOutInfo.ID == 0 {
1742
-												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1742
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1743 1743
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1744 1744
 												}
1745 1745
 
@@ -1749,7 +1749,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1749 1749
 										if pharmacyConfig.IsOpen != 1 {
1750 1750
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1751 1751
 											if drugOutInfo.ID == 0 {
1752
-												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1752
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1753 1753
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1754 1754
 												}
1755 1755
 
@@ -1776,7 +1776,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1776 1776
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1777 1777
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1778 1778
 										if drugOutInfo.ID == 0 {
1779
-											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1779
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1780 1780
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1781 1781
 											}
1782 1782
 
@@ -1800,7 +1800,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1800 1800
 										service.CreateDrugError(drugError)
1801 1801
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1802 1802
 										if drugOutInfo.ID == 0 {
1803
-											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1803
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1804 1804
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1805 1805
 											}
1806 1806
 
@@ -1893,7 +1893,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1893 1893
 									return
1894 1894
 								}
1895 1895
 								if prescribing_number_total > total {
1896
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1896
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1897 1897
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1898 1898
 										advice.ExecutionTime = 0
1899 1899
 										advice.ExecutionState = 2
@@ -1912,7 +1912,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1912 1912
 									//查询今日是否出库
1913 1913
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1914 1914
 									if drugOutInfo.ID == 0 {
1915
-										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1915
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1916 1916
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1917 1917
 										}
1918 1918
 
@@ -1922,7 +1922,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1922 1922
 									//查询今日是否出库
1923 1923
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1924 1924
 									if drugOutInfo.ID == 0 {
1925
-										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1925
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 && item.UserOrgId != 10610 {
1926 1926
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1927 1927
 										}
1928 1928
 

+ 1 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 查看文件

@@ -3068,6 +3068,7 @@ func (this *NewDialysisApiController) GetInspectionGroup() {
3068 3068
 	org_id := this.GetMobileAdminUserInfo().Org.Id
3069 3069
 
3070 3070
 	patient, _ := service.GetPatientDetailTwo(patient_id)
3071
+
3071 3072
 	inspection, _ := service.GetInspectionGroup(patient.BloodId, org_id)
3072 3073
 
3073 3074
 	if len(inspection) > 0 {

+ 11 - 5
controllers/patient_api_controller.go 查看文件

@@ -9146,8 +9146,11 @@ func (this *PatientApiController) GetInspectionByProjectId() {
9146 9146
 
9147 9147
 	inspection, _ := service.GetNewInspectionByProjectId(patient_id, project_id, inspect_date, orgId)
9148 9148
 
9149
+	referenceList, _ := service.GetNewInspectionRefence(orgId, project_id)
9150
+
9149 9151
 	this.ServeSuccessJSON(map[string]interface{}{
9150
-		"inspection": inspection,
9152
+		"inspection":    inspection,
9153
+		"referenceList": referenceList,
9151 9154
 	})
9152 9155
 }
9153 9156
 
@@ -9353,6 +9356,8 @@ func (this *PatientApiController) CheckPatientCount() {
9353 9356
 
9354 9357
 	id, _ := this.GetInt64("id")
9355 9358
 
9359
+	patient_id, _ := this.GetInt64("patient_id")
9360
+
9356 9361
 	db := service.XTWriteDB()
9357 9362
 	// 开始外部循环的事务
9358 9363
 	tx := db.Begin()
@@ -9371,8 +9376,9 @@ func (this *PatientApiController) CheckPatientCount() {
9371 9376
 	warehouseInfo, _ := service.GetPatientCountById(id, tx)
9372 9377
 
9373 9378
 	if warehouseInfo.ID > 0 {
9374
-		service.ModiftyPatientCount(warehouseInfo.Count, warehouseInfo.IsType, warehouseInfo.PatientId, tx)
9375
-		patient, _ := service.GetSfPatientById(tx, warehouseInfo.PatientId)
9379
+
9380
+		service.ModiftyPatientCount(warehouseInfo.Count, warehouseInfo.IsType, patient_id, tx)
9381
+		patient, _ := service.GetSfPatientById(tx, patient_id)
9376 9382
 
9377 9383
 		var over_count int64
9378 9384
 		if warehouseInfo.IsType == 1 {
@@ -9396,7 +9402,7 @@ func (this *PatientApiController) CheckPatientCount() {
9396 9402
 			Count:           warehouseInfo.Count,
9397 9403
 			ModeId:          warehouseInfo.IsType,
9398 9404
 			IsType:          1,
9399
-			PatientId:       warehouseInfo.PatientId,
9405
+			PatientId:       patient_id,
9400 9406
 			Status:          1,
9401 9407
 			Ctime:           time.Now().Unix(),
9402 9408
 			Mtime:           time.Now().Unix(),
@@ -9409,7 +9415,7 @@ func (this *PatientApiController) CheckPatientCount() {
9409 9415
 	}
9410 9416
 
9411 9417
 	checkpatientcount, _ := service.CheckPatientCount(id, tx)
9412
-
9418
+	fmt.Println("checkpatientcount----------------", checkpatientcount)
9413 9419
 	tx.Commit()
9414 9420
 
9415 9421
 	this.ServeSuccessJSON(map[string]interface{}{

+ 9 - 7
controllers/pharmacy_controller.go 查看文件

@@ -1220,6 +1220,8 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1220 1220
 
1221 1221
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
1222 1222
 
1223
+	baseDrug, _ := service.GetBaseDrugMedical(drug_id)
1224
+
1223 1225
 	//盘亏
1224 1226
 	if ord_total > new_total {
1225 1227
 
@@ -1259,7 +1261,7 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1259 1261
 			StockMaxNumber:     stock_max_number,
1260 1262
 			StockMinNumber:     stock_min_number,
1261 1263
 			MinCount:           0,
1262
-			MinUnit:            drugWarehouseInfoOne.MinUnit,
1264
+			MinUnit:            baseDrug.MinUnit,
1263 1265
 			LastStockMaxNumber: last_stock_max_number,
1264 1266
 			LastStockMinNumber: last_stock_min_number,
1265 1267
 			InventoryType:      11,
@@ -1300,8 +1302,8 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1300 1302
 			CancelOutDetailId:       0,
1301 1303
 			ExpireDate:              drugWarehouseInfoOne.ExpiryDate,
1302 1304
 			ProductDate:             0,
1303
-			MaxUnit:                 drugWarehouseInfoOne.MaxUnit,
1304
-			MinUnit:                 drugWarehouseInfoOne.MinUnit,
1305
+			MaxUnit:                 baseDrug.MinUnit,
1306
+			MinUnit:                 baseDrug.MinUnit,
1305 1307
 			StorehouseId:            storehouse_id,
1306 1308
 			OverCount:               sum_count,
1307 1309
 		}
@@ -1320,7 +1322,7 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1320 1322
 		inventory := models.XtDrugInventory{
1321 1323
 			DrugName:           base.DrugName,
1322 1324
 			SpecificationName:  specification_name,
1323
-			WarehousingUnit:    drugWarehouseInfoOne.MaxUnit,
1325
+			WarehousingUnit:    drugWarehouseInfoOne.MinUnit,
1324 1326
 			Count:              consumable_count,
1325 1327
 			LastPrice:          drugWarehouseInfoOne.Price,
1326 1328
 			RetailPrice:        drugWarehouseInfoOne.RetailPrice,
@@ -1351,7 +1353,7 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1351 1353
 			StockMaxNumber:     stock_max_number,
1352 1354
 			StockMinNumber:     stock_min_number,
1353 1355
 			MinCount:           0,
1354
-			MinUnit:            drugWarehouseInfoOne.MinUnit,
1356
+			MinUnit:            baseDrug.MinUnit,
1355 1357
 			LastStockMaxNumber: last_stock_max_number,
1356 1358
 			LastStockMinNumber: last_stock_min_number,
1357 1359
 			InventoryType:      10,
@@ -1392,8 +1394,8 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1392 1394
 			CancelOutDetailId:       0,
1393 1395
 			ExpireDate:              drugWarehouseInfoOne.ExpiryDate,
1394 1396
 			ProductDate:             0,
1395
-			MaxUnit:                 drugWarehouseInfoOne.MaxUnit,
1396
-			MinUnit:                 drugWarehouseInfoOne.MinUnit,
1397
+			MaxUnit:                 baseDrug.MinUnit,
1398
+			MinUnit:                 baseDrug.MinUnit,
1397 1399
 			StorehouseId:            storehouse_id,
1398 1400
 			OverCount:               sum_count,
1399 1401
 		}

+ 33 - 2
controllers/role_controller.go 查看文件

@@ -2,11 +2,12 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"fmt"
5
-	"github.com/jinzhu/gorm"
6 5
 	"strconv"
7 6
 	"strings"
8 7
 	"time"
9 8
 
9
+	"github.com/jinzhu/gorm"
10
+
10 11
 	"XT_New/enums"
11 12
 	"XT_New/models"
12 13
 	"XT_New/service"
@@ -1136,6 +1137,17 @@ func (this *RoleAPIController) AddAdmin() {
1136 1137
 	outpatient_illnessCategory := this.GetString("outpatient_illnessCategory")
1137 1138
 	is_active, _ := this.GetInt64("is_active")
1138 1139
 	active_status, _ := this.GetInt64("active_status")
1140
+
1141
+	birth := this.GetString("birth")
1142
+	theBirthTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", birth+" 00:00:00", loc)
1143
+
1144
+	work_address := this.GetString("work_address")
1145
+
1146
+	work_start_time := this.GetString("work_start_time")
1147
+	workStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", work_start_time+" 00:00:00", loc)
1148
+
1149
+	work_end_time := this.GetString("work_end_time")
1150
+	workEndTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", work_end_time+" 00:00:00", loc)
1139 1151
 	fmt.Println("active_status", active_status)
1140 1152
 	if len(mobile) == 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || len(roleIds) <= 0 {
1141 1153
 
@@ -1150,7 +1162,7 @@ func (this *RoleAPIController) AddAdmin() {
1150 1162
 		return
1151 1163
 	} else {
1152 1164
 		if adminUser == nil { //新增账号和用户
1153
-			_, password, createErr := service.CreateGeneralAdminUserOne(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, department_id, department, sex, age, nation, card_type, id_card, education, study_major_name, work_major_name, role_type, medical_code, doctor_code, licensing, job_number, prescription_qualification_identification, identification_outpatients, theStartTime.Unix(), medical_range_code, medical_level, medical_type_job, pharmacist_registration_number, doctor_range_code, doctor_level, doctor_type_job, doctor_number, outpatient_illnessCategory, is_active, active_status)
1165
+			_, password, createErr := service.CreateGeneralAdminUserOne(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, department_id, department, sex, age, nation, card_type, id_card, education, study_major_name, work_major_name, role_type, medical_code, doctor_code, licensing, job_number, prescription_qualification_identification, identification_outpatients, theStartTime.Unix(), medical_range_code, medical_level, medical_type_job, pharmacist_registration_number, doctor_range_code, doctor_level, doctor_type_job, doctor_number, outpatient_illnessCategory, is_active, active_status, work_address, theBirthTime.Unix(), workStartTime.Unix(), workEndTime.Unix())
1154 1166
 			if createErr != nil {
1155 1167
 				//beego.Error("创建管理员失败:", createErr)
1156 1168
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
@@ -1211,6 +1223,10 @@ func (this *RoleAPIController) AddAdmin() {
1211 1223
 					OutpatientIllnesscategory:               outpatient_illnessCategory,
1212 1224
 					IsActive:                                is_active,
1213 1225
 					ActiveStatus:                            active_status,
1226
+					Birth:                                   theBirthTime.Unix(),
1227
+					WorkAddress:                             work_address,
1228
+					WorkStartTime:                           workStartTime.Unix(),
1229
+					WorkEndTime:                             workEndTime.Unix(),
1214 1230
 				}
1215 1231
 				err := service.CreateUserRole(app_role)
1216 1232
 				if err != nil {
@@ -1348,6 +1364,17 @@ func (this *RoleAPIController) EditAdmin() {
1348 1364
 	is_active, _ := this.GetInt64("is_active")
1349 1365
 	active_status, _ := this.GetInt64("active_status")
1350 1366
 
1367
+	birth := this.GetString("birth")
1368
+	theBirthTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", birth+" 00:00:00", loc)
1369
+
1370
+	work_address := this.GetString("work_address")
1371
+
1372
+	work_start_time := this.GetString("work_start_time")
1373
+	workStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", work_start_time+" 00:00:00", loc)
1374
+
1375
+	work_end_time := this.GetString("work_end_time")
1376
+	workEndTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", work_end_time+" 00:00:00", loc)
1377
+
1351 1378
 	_, titleExist := models.UserTitle[userTitle]
1352 1379
 	fmt.Println(titleExist)
1353 1380
 	if adminUserId <= 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || !titleExist || len(roleIds) <= 0 {
@@ -1405,6 +1432,10 @@ func (this *RoleAPIController) EditAdmin() {
1405 1432
 	appRole.IsActive = is_active
1406 1433
 	appRole.ActiveStatus = active_status
1407 1434
 	appRole.Sex = sex
1435
+	appRole.Birth = theBirthTime.Unix()
1436
+	appRole.WorkStartTime = workStartTime.Unix()
1437
+	appRole.WorkEndTime = workEndTime.Unix()
1438
+	appRole.WorkAddress = work_address
1408 1439
 	saveErr := service.SaveAppRole(appRole)
1409 1440
 	if saveErr != nil {
1410 1441
 		//beego.Error("修改App_Role失败:", saveErr)

+ 29 - 6
controllers/self_drug_api_congtroller.go 查看文件

@@ -203,6 +203,8 @@ func SelfDrugRouters() {
203 203
 
204 204
 	beego.Router("/api/drug/getdrugwarehouseinfoprintlist", &SelfDrugApiController{}, "Get:GetDrugWarehouseInfoPrintList")
205 205
 
206
+	beego.Router("/api/patient/changegoodwarehouseinfo", &SelfDrugApiController{}, "Post:ChangeGoodWarehouseInfo")
207
+
206 208
 }
207 209
 
208 210
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -2960,6 +2962,7 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2960 2962
 	keyword := this.GetString("keyword")
2961 2963
 	page, _ := this.GetInt64("page")
2962 2964
 	limit, _ := this.GetInt64("limit")
2965
+	good_type_id, _ := this.GetInt64("good_type_id")
2963 2966
 
2964 2967
 	// 查询该机构所有耗材入库信息
2965 2968
 	//goodList, _ := service.GetAllGoodListSeven(orgId)
@@ -2983,7 +2986,7 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2983 2986
 		}
2984 2987
 	}
2985 2988
 
2986
-	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids)
2989
+	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids, good_type_id)
2987 2990
 
2988 2991
 	if err != nil {
2989 2992
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取查询信息失败")
@@ -3867,6 +3870,8 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3867 3870
 	start_time := this.GetString("start_time")
3868 3871
 	end_time := this.GetString("end_time")
3869 3872
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3873
+
3874
+	query_type, _ := this.GetInt64("query_type")
3870 3875
 	timeLayout := "2006-01-02"
3871 3876
 	loc, _ := time.LoadLocation("Local")
3872 3877
 	var startTime int64
@@ -3906,10 +3911,10 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3906 3911
 	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
3907 3912
 	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, orgId)
3908 3913
 
3909
-	if orgId == 10265 {
3914
+	if orgId == 10265 || orgId == 10138 {
3910 3915
 		//storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3911 3916
 
3912
-		list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds)
3917
+		list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds, query_type)
3913 3918
 
3914 3919
 		for _, item := range list {
3915 3920
 
@@ -3979,8 +3984,8 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3979 3984
 		})
3980 3985
 	}
3981 3986
 
3982
-	if orgId != 10265 {
3983
-		list, total, err := service.GetGoodNewPurchaseStockQueryOne(good_type, keyword, page, limit, orgId, ids, goodIds)
3987
+	if orgId != 10265 && orgId != 10138 {
3988
+		list, total, err := service.GetGoodNewPurchaseStockQueryOne(good_type, keyword, page, limit, orgId, ids, goodIds, query_type)
3984 3989
 		storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3985 3990
 		for _, item := range list {
3986 3991
 
@@ -4094,6 +4099,8 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
4094 4099
 
4095 4100
 	start_time := this.GetString("start_time")
4096 4101
 	end_time := this.GetString("end_time")
4102
+
4103
+	query_type, _ := this.GetInt64("query_type")
4097 4104
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4098 4105
 	timeLayout := "2006-01-02"
4099 4106
 	loc, _ := time.LoadLocation("Local")
@@ -4130,7 +4137,7 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
4130 4137
 	}
4131 4138
 
4132 4139
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
4133
-	list, total, err := service.GetDrugNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, startTime, endTime, ids, infoIds)
4140
+	list, total, err := service.GetDrugNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, startTime, endTime, ids, infoIds, query_type)
4134 4141
 
4135 4142
 	for _, item := range list {
4136 4143
 
@@ -6910,3 +6917,19 @@ func (this *SelfDrugApiController) GetDrugWarehouseInfoPrintList() {
6910 6917
 	})
6911 6918
 
6912 6919
 }
6920
+
6921
+func (this *SelfDrugApiController) ChangeGoodWarehouseInfo() {
6922
+
6923
+	dataBody := make(map[string]interface{}, 0)
6924
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
6925
+	fmt.Println(err)
6926
+	id := int64(dataBody["id"].(float64))
6927
+	good_code := dataBody["good_code"].(string)
6928
+
6929
+	service.ModifyGoodCodeWarehouseInfo(id, good_code)
6930
+
6931
+	this.ServeSuccessJSON(map[string]interface{}{
6932
+		"msg": "ok",
6933
+	})
6934
+
6935
+}

+ 52 - 1
controllers/stock_in_api_controller.go 查看文件

@@ -7616,6 +7616,31 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7616 7616
 				return
7617 7617
 			}
7618 7618
 
7619
+			goodcodelist := strings.Split(item.GoodCode, ",")
7620
+
7621
+			if len(goodcodelist) > 0 {
7622
+				goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7623
+				for _, it := range goodcodelist {
7624
+					if it != "" {
7625
+						codeInfo := models.XtGoodCodeInfo{
7626
+							GoodId:          item.GoodId,
7627
+							BatchNumber:     item.Number,
7628
+							GoodCode:        it,
7629
+							WarehouseInfoId: item.ID,
7630
+							IsUserCount:     0,
7631
+							IsOutStatus:     2,
7632
+							Status:          1,
7633
+							UserOrgId:       item.OrgId,
7634
+							Ctime:           time.Now().Unix(),
7635
+							Mtime:           time.Now().Unix(),
7636
+							SplitOfNumber:   goodInfo.SplitOfNumber,
7637
+						}
7638
+						service.CreateCodeInfo(codeInfo, tx)
7639
+					}
7640
+
7641
+				}
7642
+			}
7643
+
7619 7644
 		}
7620 7645
 	}
7621 7646
 	if is_success != 1 {
@@ -7657,6 +7682,32 @@ func (this *StockManagerApiController) ReturnCheckWarehouseInfo() {
7657 7682
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCheckGoodParamWrong)
7658 7683
 			return
7659 7684
 		}
7685
+
7686
+		//改变扫码库里面的状态
7687
+		goodcodelist := strings.Split(item.GoodCode, ",")
7688
+
7689
+		if len(goodcodelist) > 0 {
7690
+			goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7691
+			for _, it := range goodcodelist {
7692
+				if it != "" {
7693
+					codeInfo := models.XtGoodCodeInfo{
7694
+						GoodId:          item.GoodId,
7695
+						BatchNumber:     item.Number,
7696
+						GoodCode:        it,
7697
+						WarehouseInfoId: item.ID,
7698
+						IsUserCount:     0,
7699
+						IsOutStatus:     2,
7700
+						Status:          0,
7701
+						UserOrgId:       item.OrgId,
7702
+						Ctime:           time.Now().Unix(),
7703
+						Mtime:           time.Now().Unix(),
7704
+						SplitOfNumber:   goodInfo.SplitOfNumber,
7705
+					}
7706
+					service.UpdateCodeInfo(codeInfo, tx)
7707
+				}
7708
+
7709
+			}
7710
+		}
7660 7711
 	}
7661 7712
 
7662 7713
 	err := service.UpdateNewWarehouseInfoMap(list, warehousing_info_id, orgId, tx)
@@ -8166,7 +8217,7 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8166 8217
 	//	service.UpdateDealerManufacturerOne(item.ID, manufacturer.ManufacturerName)
8167 8218
 	//}
8168 8219
 
8169
-	drugList, _ := service.GetAllBaseDrugListTwentyOne(10726)
8220
+	drugList, _ := service.GetAllBaseDrugListTwentyOne(10265)
8170 8221
 
8171 8222
 	for _, item := range drugList {
8172 8223
 		var drug_spec = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit

+ 8 - 0
models/device_models.go 查看文件

@@ -315,6 +315,10 @@ type DeviceAddmachers struct {
315 315
 	DeviceMode          string `gorm:"column:device_mode" json:"device_mode" form:"device_mode"`
316 316
 	Number              string `gorm:"column:number" json:"number" form:"number"`
317 317
 	EquimentId          int64  `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
318
+	HomeAddress         string `gorm:"column:home_address" json:"home_address" form:"home_address"`
319
+	HomeSetting         string `gorm:"column:home_setting" json:"home_setting" form:"home_setting"`
320
+	HomeType            string `gorm:"column:home_type" json:"home_type" form:"home_type"`
321
+	HomeBigType         string `gorm:"column:home_big_type" json:"home_big_type" form:"home_big_type"`
318 322
 }
319 323
 
320 324
 type DeviceAddmacher struct {
@@ -349,6 +353,10 @@ type DeviceAddmacher struct {
349 353
 	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
350 354
 	ZoneId              int64  `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
351 355
 	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
356
+	HomeAddress         string `gorm:"column:home_address" json:"home_address" form:"home_address"`
357
+	HomeSetting         string `gorm:"column:home_setting" json:"home_setting" form:"home_setting"`
358
+	HomeType            string `gorm:"column:home_type" json:"home_type" form:"home_type"`
359
+	HomeBigType         string `gorm:"column:home_big_type" json:"home_big_type" form:"home_big_type"`
352 360
 }
353 361
 
354 362
 func (DeviceAddmacher) TableName() string {

+ 2 - 0
models/drug.go 查看文件

@@ -94,6 +94,7 @@ type BaseDrugLib struct {
94 94
 	IsZeroFlag             int64  `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
95 95
 	ScanCode               string `gorm:"column:scan_code" json:"scan_code" form:"scan_code"`
96 96
 	DrugIdentificationCode string `gorm:"column:drug_identification_code" json:"drug_identification_code" form:"drug_identification_code"`
97
+	SplitOfNumber          int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
97 98
 }
98 99
 
99 100
 func (BaseDrugLib) TableName() string {
@@ -118,6 +119,7 @@ type BaseDrugLibSeven struct {
118 119
 	IsZeroFlag                  int64  `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
119 120
 	MedicalInsuranceLevel       int64  `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
120 121
 	SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
122
+	SplitOfNumber               int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
121 123
 }
122 124
 
123 125
 func (BaseDrugLibSeven) TableName() string {

+ 4 - 2
models/good_models.go 查看文件

@@ -106,8 +106,9 @@ type GoodInfo struct {
106 106
 	Bby01                       string               `gorm:"column:bby01" json:"bby01" form:"bby01"`
107 107
 	Bck01b                      string               `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
108 108
 	IsZeroFlag                  int64                `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
109
-
110
-	ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
109
+	SplitOfNumber               int64                `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
110
+	ZuobiaoId                   string               `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
111
+	RegisterNumberName          string               `gorm:"column:register_number_name" json:"register_number_name" form:"register_number_name"`
111 112
 
112 113
 	WarehousingInfoOne []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
113 114
 
@@ -330,6 +331,7 @@ type GoodInfoSeven struct {
330 331
 	GoodStatus        string `gorm:"column:good_status" json:"good_status" form:"good_status"`
331 332
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
332 333
 	SumCount          int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
334
+	SplitOfNumber     int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
333 335
 }
334 336
 
335 337
 func (GoodInfoSeven) TableName() string {

+ 11 - 7
models/his_models.go 查看文件

@@ -81,13 +81,17 @@ func (XtHisProjectTeam) TableName() string {
81 81
 }
82 82
 
83 83
 type XtHisDepartment struct {
84
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
85
-	Name        string `gorm:"column:name" json:"name" form:"name"`
86
-	Number      string `gorm:"column:number" json:"number" form:"number"`
87
-	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
88
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
89
-	CreatedTime int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
90
-	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
84
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
85
+	Name           string `gorm:"column:name" json:"name" form:"name"`
86
+	Number         string `gorm:"column:number" json:"number" form:"number"`
87
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
88
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
89
+	CreatedTime    int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
90
+	UpdatedTime    int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
91
+	DepartmentType string `gorm:"column:department_type" json:"department_type" form:"department_type"`
92
+	Lender         string `gorm:"column:lender" json:"lender" form:"lender"`
93
+	Phone          string `gorm:"column:phone" json:"phone" form:"phone"`
94
+	StartTime      string `gorm:"column:start_time" json:"start_time" form:"start_time"`
91 95
 }
92 96
 
93 97
 func (XtHisDepartment) TableName() string {

+ 2 - 0
models/new_stock_models.go 查看文件

@@ -290,6 +290,7 @@ type GoodInfoTwenty struct {
290 290
 	GoodNumber                  string                  `gorm:"column:good_number" json:"good_number" form:"good_number"`
291 291
 	SocialSecurityDirectoryCode string                  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
292 292
 	MedicalInsuranceLevel       int64                   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
293
+	StockWarnCount              int64                   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
293 294
 	StWarehousingInfo           []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
294 295
 	WarehousingInfoOne          []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
295 296
 	WarehousingInfoStart        []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
@@ -428,6 +429,7 @@ type VmBaseDrugTwenty struct {
428 429
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
429 430
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
430 431
 	IsSelfDrug                       int64             `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
432
+	DrugStockLimitCount              int64             `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
431 433
 	MedicalInsuranceNumber           string            `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
432 434
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
433 435
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`

+ 4 - 0
models/role_models.go 查看文件

@@ -90,6 +90,10 @@ type App_Role struct {
90 90
 	OutpatientIllnesscategory               string `gorm:"column:outpatient_illness_category" json:"outpatient_illness_category" form:"outpatient_illness_category"`
91 91
 	IsActive                                int64  `gorm:"column:is_active" json:"is_active" form:"is_active"`
92 92
 	ActiveStatus                            int64  `gorm:"column:active_status" json:"active_status" form:"active_status"`
93
+	Birth                                   int64  `gorm:"column:birth" json:"birth" form:"birth"`
94
+	WorkAddress                             string `gorm:"column:work_address" json:"work_address" form:"work_address"`
95
+	WorkStartTime                           int64  `gorm:"column:work_start_time" json:"work_start_time" form:"work_start_time"`
96
+	WorkEndTime                             int64  `gorm:"column:work_end_time" json:"work_end_time" form:"work_end_time"`
93 97
 }
94 98
 
95 99
 func (App_Role) TableName() string {

+ 39 - 0
models/stock_models.go 查看文件

@@ -1783,6 +1783,7 @@ type XtWarehouseInfoEight struct {
1783 1783
 	IsUpload                  int64   `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1784 1784
 	ManafacturerName          string  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
1785 1785
 	DealerName                string  `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
1786
+	GoodCode                  string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
1786 1787
 }
1787 1788
 
1788 1789
 func (XtWarehouseInfoEight) TableName() string {
@@ -1953,3 +1954,41 @@ type PrintDrugWarehouseInfo struct {
1953 1954
 func (PrintDrugWarehouseInfo) TableName() string {
1954 1955
 	return "xt_drug_warehouse_info"
1955 1956
 }
1957
+
1958
+type XtGoodCodeInfo struct {
1959
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
1960
+	GoodId          int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
1961
+	BatchNumber     string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
1962
+	GoodCode        string `gorm:"column:good_code" json:"good_code" form:"good_code"`
1963
+	WarehouseInfoId int64  `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1964
+	IsUserCount     int64  `gorm:"column:is_user_count" json:"is_user_count" form:"is_user_count"`
1965
+	IsOutStatus     int64  `gorm:"column:is_out_status" json:"is_out_status" form:"is_out_status"`
1966
+	Status          int64  `gorm:"column:status" json:"status" form:"status"`
1967
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1968
+	Ctime           int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1969
+	Mtime           int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1970
+	SplitOfNumber   int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
1971
+}
1972
+
1973
+func (XtGoodCodeInfo) TableName() string {
1974
+	return "xt_good_code_info"
1975
+}
1976
+
1977
+type XtDrugCodeInfo struct {
1978
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
1979
+	DrugId          int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1980
+	BatchNumber     string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
1981
+	DrugCode        string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
1982
+	WarehouseInfoId int64  `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1983
+	IsUserCount     int64  `gorm:"column:is_user_count" json:"is_user_count" form:"is_user_count"`
1984
+	IsOutStatus     int64  `gorm:"column:is_out_status" json:"is_out_status" form:"is_out_status"`
1985
+	Status          int64  `gorm:"column:status" json:"status" form:"status"`
1986
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1987
+	Ctime           int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1988
+	Mtime           int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1989
+	SplitOfNumber   int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
1990
+}
1991
+
1992
+func (XtDrugCodeInfo) TableName() string {
1993
+	return "xt_drug_code_info"
1994
+}

+ 3 - 3
service/common_service.go 查看文件

@@ -2493,7 +2493,7 @@ func GetMonthProjectListThree(orgid int64, lapseto int64, modetype int64, januar
2493 2493
 func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int64, page int64, limit int64) (inspection []*models.PatientInspectionCount, total int64, err error) {
2494 2494
 
2495 2495
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2496
-	table := readDb.Table("xt_patients as s")
2496
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2497 2497
 	fmt.Println(table)
2498 2498
 	d := readDb.Table(" xt_inspection_reference as r")
2499 2499
 	fmt.Println(d)
@@ -2557,7 +2557,7 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
2557 2557
 func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, err error) {
2558 2558
 
2559 2559
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2560
-	table := readDb.Table("xt_patients as s")
2560
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2561 2561
 	//fmt.Println(table)
2562 2562
 	d := readDb.Table(" xt_inspection_reference as r")
2563 2563
 	fmt.Println(d)
@@ -2673,7 +2673,7 @@ func GetInfectiousPatientsControl(orgid int64, lapstor int64, startime int64, en
2673 2673
 
2674 2674
 func GetInfectiousControl(orgid int64, lapstor int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, err error) {
2675 2675
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2676
-	table := readDb.Table("xt_patients as s")
2676
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2677 2677
 	fmt.Println(table)
2678 2678
 	d := readDb.Table(" xt_inspection_reference as r")
2679 2679
 	fmt.Println(d)

+ 1 - 1
service/device_service.go 查看文件

@@ -725,7 +725,7 @@ func GetMachineDetail(id int64, orgid int64) (models.DeviceAddmachers, error) {
725 725
 	db := readUserDb.Table("xt_device_addmacher as a").Where("a.status =1")
726 726
 	d := readUserDb.Table("xt_device_mode as d")
727 727
 	fmt.Print("d", d)
728
-	err := db.Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type as device_mode,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.zone_id,a.bed_id").Joins("left join xt_device_mode as d on d.id = a.unit_type ").Where("a.id = ? and a.user_org_id = ?", id, orgid).Find(&addmacher).Error
728
+	err := db.Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type as device_mode,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.zone_id,a.bed_id,a.home_address,a.home_setting,a.home_type,a.home_big_type").Joins("left join xt_device_mode as d on d.id = a.unit_type ").Where("a.id = ? and a.user_org_id = ?", id, orgid).Find(&addmacher).Error
729 729
 	return addmacher, err
730 730
 }
731 731
 

+ 2 - 2
service/doctor_advice_service.go 查看文件

@@ -550,7 +550,7 @@ func GetDoctorAdivceMonthList(user_org_id int64, start_time int64, end_time int6
550 550
 		db = db.Where("advice_date<=?", end_time)
551 551
 	}
552 552
 
553
-	err = db.Find(&list).Error
553
+	err = db.Order("advice_name").Find(&list).Error
554 554
 
555 555
 	return list, err
556 556
 }
@@ -569,7 +569,7 @@ func GetHisDoctorAdivceMonthList(user_org_id int64, start_time int64, end_time i
569 569
 		db = db.Where("advice_date<=?", end_time)
570 570
 	}
571 571
 
572
-	err = db.Preload("Drug", "status=1 and org_id = ?", user_org_id).Find(&list).Error
572
+	err = db.Preload("Drug", "status=1 and org_id = ?", user_org_id).Order("advice_name").Find(&list).Error
573 573
 
574 574
 	return list, err
575 575
 }

+ 1 - 1
service/his_project_service.go 查看文件

@@ -148,7 +148,7 @@ func GetDepartMentDetail(id int64) (models.XtHisDepartment, error) {
148 148
 
149 149
 func UpdatedDepartment(id int64, department *models.XtHisDepartment) error {
150 150
 
151
-	err := XTWriteDB().Model(&department).Where("id=? and status = 1", id).Updates(map[string]interface{}{"name": department.Name, "number": department.Number, "updated_time": time.Now().Unix()}).Error
151
+	err := XTWriteDB().Model(&department).Where("id=? and status = 1", id).Updates(map[string]interface{}{"name": department.Name, "number": department.Number, "updated_time": time.Now().Unix(), "department_type": department.DepartmentType, "lender": department.Lender, "phone": department.Phone, "start_time": department.StartTime}).Error
152 152
 	return err
153 153
 }
154 154
 

+ 66 - 0
service/his_service.go 查看文件

@@ -3117,6 +3117,72 @@ func GetGoodByIdIsStop(good_id int64, org_id int64) (models.GoodInfoSeven, error
3117 3117
 	return goodInfoSeven, err
3118 3118
 }
3119 3119
 
3120
+func GetNewGoodByIdIsStop(good_id int64, org_id int64, tx *gorm.DB) (models.GoodInfoSeven, error) {
3121
+
3122
+	goodInfoSeven := models.GoodInfoSeven{}
3123
+	err = tx.Where("org_id = ? and status = 1  and id =?", org_id, good_id).Find(&goodInfoSeven).Error
3124
+	if err != gorm.ErrRecordNotFound {
3125
+		if err != nil {
3126
+			tx.Rollback()
3127
+			return goodInfoSeven, err
3128
+		}
3129
+	}
3130
+	return goodInfoSeven, err
3131
+}
3132
+
3133
+func GetNewDrugByIdIsStop(good_id int64, org_id int64, tx *gorm.DB) (models.BaseDrugLibSeven, error) {
3134
+
3135
+	goodInfoSeven := models.BaseDrugLibSeven{}
3136
+	err = tx.Where("org_id = ? and status = 1  and id =?", org_id, good_id).Find(&goodInfoSeven).Error
3137
+	if err != gorm.ErrRecordNotFound {
3138
+		if err != nil {
3139
+			tx.Rollback()
3140
+			return goodInfoSeven, err
3141
+		}
3142
+	}
3143
+	return goodInfoSeven, err
3144
+}
3145
+
3146
+func CreateCodeInfo(info models.XtGoodCodeInfo, tx *gorm.DB) error {
3147
+
3148
+	err := tx.Create(&info).Error
3149
+	if err != nil {
3150
+		tx.Rollback()
3151
+		return err
3152
+	}
3153
+	return err
3154
+}
3155
+
3156
+func CreateDrugCodeInfo(info models.XtDrugCodeInfo, tx *gorm.DB) error {
3157
+
3158
+	err := tx.Create(&info).Error
3159
+	if err != nil {
3160
+		tx.Rollback()
3161
+		return err
3162
+	}
3163
+	return err
3164
+}
3165
+
3166
+func UpdateCodeInfo(info models.XtGoodCodeInfo, tx *gorm.DB) error {
3167
+
3168
+	err := tx.Model(&info).Where("warehouse_info_id = ? and good_code =? and status=1 and user_org_id =?", info.WarehouseInfoId, info.GoodCode, info.UserOrgId).Updates(map[string]interface{}{"status": 0}).Error
3169
+	if err != nil {
3170
+		tx.Rollback()
3171
+		return err
3172
+	}
3173
+	return err
3174
+}
3175
+
3176
+func UpdateDrugCodeInfo(info models.XtDrugCodeInfo, tx *gorm.DB) error {
3177
+
3178
+	err := tx.Model(&info).Where("warehouse_info_id = ? and drug_code =? and status=1 and user_org_id =?", info.WarehouseInfoId, info.DrugCode, info.UserOrgId).Updates(map[string]interface{}{"status": 0}).Error
3179
+	if err != nil {
3180
+		tx.Rollback()
3181
+		return err
3182
+	}
3183
+	return err
3184
+}
3185
+
3120 3186
 func GetHisPrescriptionByBatchNumber(org_id int64, number string) (prescription []*models.HisPrescription, err error) {
3121 3187
 	err = readDb.Model(&models.HisPrescription{}).
3122 3188
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {

+ 9 - 0
service/manage_center_service.go 查看文件

@@ -1140,3 +1140,12 @@ func UpdateHisAdviceListTemplate(id int64, price float64) error {
1140 1140
 	err := XTWriteDB().Model(&models.HisPrescriptionAdviceTemplate{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"price": price}).Error
1141 1141
 	return err
1142 1142
 }
1143
+
1144
+func ModifyGoodCodeWarehouseInfo(id int64, good_code string) (models.XtWarehouseInfoEight, error) {
1145
+
1146
+	info := models.XtWarehouseInfoEight{}
1147
+
1148
+	err := XTWriteDB().Model(&info).Where("id = ? and status=1", id).Updates(map[string]interface{}{"good_code": good_code}).Error
1149
+
1150
+	return info, err
1151
+}

+ 1 - 1
service/manage_service.go 查看文件

@@ -54,7 +54,7 @@ func CreateMacher(machers *models.DeviceAddmacher) error {
54 54
 
55 55
 func UpdateMachine(id int64, orgid int64, addmacher *models.DeviceAddmacher) error {
56 56
 
57
-	err := writeUserDb.Model(&addmacher).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Updates(map[string]interface{}{"serial_number": addmacher.SerialNumber, "device_type": addmacher.DeviceType, "bed_number": addmacher.BedNumber, "device_name": addmacher.DeviceName, "manufacture_factory": addmacher.ManufactureFactory, "service_manufacturer": addmacher.ServiceManufacturer, "unit_type": addmacher.UnitType, "use_section": addmacher.UseSection, "section_number": addmacher.SectionNumber, "buy_date": addmacher.BuyDate, "install_date": addmacher.InstallDate, "start_date": addmacher.StartDate, "maintenace_engineer": addmacher.MaintenaceEngineer, "telephone": addmacher.Telephone, "guarantee_date": addmacher.GuaranteeDate, "machine_status": addmacher.MachineStatus, "user_total": addmacher.UserTotal, "remarks": addmacher.Remarks, "rubbish_date": addmacher.RubbishDate, "rubbish_reason": addmacher.RubbishReason, "user_year": addmacher.UserYear, "work_time": addmacher.WorkTime, "bed_id": addmacher.BedId, "disinfection_mode": addmacher.DisinfectionMode, "revers_mode": addmacher.ReversMode, "mtime": time.Now().Unix(), "zone_id": addmacher.ZoneId}).Error
57
+	err := writeUserDb.Model(&addmacher).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Updates(map[string]interface{}{"serial_number": addmacher.SerialNumber, "device_type": addmacher.DeviceType, "bed_number": addmacher.BedNumber, "device_name": addmacher.DeviceName, "manufacture_factory": addmacher.ManufactureFactory, "service_manufacturer": addmacher.ServiceManufacturer, "unit_type": addmacher.UnitType, "use_section": addmacher.UseSection, "section_number": addmacher.SectionNumber, "buy_date": addmacher.BuyDate, "install_date": addmacher.InstallDate, "start_date": addmacher.StartDate, "maintenace_engineer": addmacher.MaintenaceEngineer, "telephone": addmacher.Telephone, "guarantee_date": addmacher.GuaranteeDate, "machine_status": addmacher.MachineStatus, "user_total": addmacher.UserTotal, "remarks": addmacher.Remarks, "rubbish_date": addmacher.RubbishDate, "rubbish_reason": addmacher.RubbishReason, "user_year": addmacher.UserYear, "work_time": addmacher.WorkTime, "bed_id": addmacher.BedId, "disinfection_mode": addmacher.DisinfectionMode, "revers_mode": addmacher.ReversMode, "mtime": time.Now().Unix(), "zone_id": addmacher.ZoneId, "home_address": addmacher.HomeAddress, "home_setting": addmacher.HomeSetting, "home_type": addmacher.HomeType, "home_big_type": addmacher.HomeBigType}).Error
58 58
 
59 59
 	return err
60 60
 

+ 6 - 2
service/new_stock_service.go 查看文件

@@ -110,14 +110,18 @@ func CreateGoodErrcode(errcode models.XtGoodErrcode) error {
110 110
 	return err
111 111
 }
112 112
 
113
-func GetGoodStockList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64) (good []*models.GoodInformation, total int64, err error) {
113
+func GetGoodStockList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64, good_type_id int64) (good []*models.GoodInformation, total int64, err error) {
114 114
 	offset := (page - 1) * limit
115 115
 	likeKey := "%" + keyword + "%"
116 116
 
117 117
 	db := XTReadDB().Table("xt_good_information as x").Where("x.status = 1  and x.org_id =? and find_in_set('停用',x.good_status) = 0", orgId)
118 118
 
119
+	if good_type_id > 0 {
120
+		db = db.Where("x.good_type_id = ?", good_type_id)
121
+	}
122
+
119 123
 	if good_type == 2 {
120
-		db = db.Where(" x.total_count<=x.stock_warn_count")
124
+		db = db.Where(" x.sum_count<=x.stock_warn_count")
121 125
 	}
122 126
 
123 127
 	if good_type == 3 {

+ 8 - 1
service/patient_service.go 查看文件

@@ -5051,6 +5051,13 @@ func GetNewInspectionByProjectId(patient_id int64, project_id int64, inspect_dat
5051 5051
 	return inspection, err
5052 5052
 }
5053 5053
 
5054
+func GetNewInspectionRefence(org_id int64, project_id int64) (reference []*models.XtInspectionReference, err error) {
5055
+
5056
+	err = XTReadDB().Where("(org_id = ? or org_id = 0) and project_id = ?", org_id, project_id).Find(&reference).Error
5057
+
5058
+	return reference, err
5059
+}
5060
+
5054 5061
 func GetSelfDrugOutInfo(patient_id int64, sys_record_time int64, drug_id int64) (outInfo []*models.XtSelfDrugWarehouseOutInfo, err error) {
5055 5062
 
5056 5063
 	err = XTReadDB().Where("patient_id = ? and sys_record_time = ? and drug_id = ? and status=1", patient_id, sys_record_time, drug_id).Find(&outInfo).Error
@@ -5280,7 +5287,7 @@ func GetPatientCountById(id int64, tx *gorm.DB) (models.SfPatientInCount, error)
5280 5287
 
5281 5288
 	patientInCount := models.SfPatientInCount{}
5282 5289
 
5283
-	err := tx.Where("id = ?", id).Find(&patientInCount).Error
5290
+	err := tx.Where("id = ? and status=1", id).Find(&patientInCount).Error
5284 5291
 	if err != nil {
5285 5292
 		tx.Rollback()
5286 5293
 		return patientInCount, err

+ 9 - 3
service/role_service.go 查看文件

@@ -1,8 +1,6 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"database/sql"
7 5
 	"encoding/json"
8 6
 	"fmt"
@@ -10,6 +8,9 @@ import (
10 8
 	"strings"
11 9
 	"time"
12 10
 
11
+	"XT_New/models"
12
+	"XT_New/utils"
13
+
13 14
 	"github.com/jinzhu/gorm"
14 15
 )
15 16
 
@@ -328,7 +329,7 @@ func IsUserSuperAdminWithMobile(mobile string) (bool, error) {
328 329
 	return user.IsSuperAdmin, nil
329 330
 }
330 331
 
331
-func CreateGeneralAdminUserOne(orgID int64, appID int64, mobile string, name string, userTitle string, roleIds string, user_type int, user_title int, department_id int64, deapartment_name string, sex int64, age int64, nation string, card_type int64, idCard string, education int64, studyMajorName string, workMajorName string, roletype int64, medicalCode string, doctorcode string, licensing int64, jobnumber string, prescriptionQualificationIdentification int64, identificationOutpatients int64, startime int64, medicalRangeCode int64, medicalLevel int64, medicalTypeJob int64, pharmacistRegistrationNumber string, doctorRangeCode int64, doctorLevel int64, doctorTypeJob int64, doctorNumber string, outpatientIllnessCategory string, isActive int64, activeStatus int64) (*models.AdminUser, string, error) {
332
+func CreateGeneralAdminUserOne(orgID int64, appID int64, mobile string, name string, userTitle string, roleIds string, user_type int, user_title int, department_id int64, deapartment_name string, sex int64, age int64, nation string, card_type int64, idCard string, education int64, studyMajorName string, workMajorName string, roletype int64, medicalCode string, doctorcode string, licensing int64, jobnumber string, prescriptionQualificationIdentification int64, identificationOutpatients int64, startime int64, medicalRangeCode int64, medicalLevel int64, medicalTypeJob int64, pharmacistRegistrationNumber string, doctorRangeCode int64, doctorLevel int64, doctorTypeJob int64, doctorNumber string, outpatientIllnessCategory string, isActive int64, activeStatus int64, word_address string, birth int64, word_start_time int64, work_end_time int64) (*models.AdminUser, string, error) {
332 333
 	now := time.Now().Unix()
333 334
 	tx := writeUserDb.Begin()
334 335
 	var adminUser models.AdminUser
@@ -345,6 +346,7 @@ func CreateGeneralAdminUserOne(orgID int64, appID int64, mobile string, name str
345 346
 			adminUser.Status = 1
346 347
 			adminUser.CreateTime = now
347 348
 			adminUser.ModifyTime = now
349
+
348 350
 			if createErr := tx.Create(&adminUser).Error; createErr != nil {
349 351
 				tx.Rollback()
350 352
 				return nil, "", createErr
@@ -394,6 +396,10 @@ func CreateGeneralAdminUserOne(orgID int64, appID int64, mobile string, name str
394 396
 		DoctorRangeCode:                         doctorRangeCode,
395 397
 		DoctorTypeJob:                           doctorTypeJob,
396 398
 		DoctorLevel:                             doctorLevel,
399
+		WorkStartTime:                           word_start_time,
400
+		Birth:                                   birth,
401
+		WorkEndTime:                             work_end_time,
402
+		WorkAddress:                             word_address,
397 403
 	}
398 404
 	if createApp_RoleErr := tx.Create(&app_role).Error; createApp_RoleErr != nil {
399 405
 		tx.Rollback()

+ 36 - 3
service/self_drug_service.go 查看文件

@@ -2858,7 +2858,7 @@ func CreateDrugStockCount(stockCount models.XtDrugStockCount) error {
2858 2858
 	return err
2859 2859
 }
2860 2860
 
2861
-func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2861
+func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64, query_type int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2862 2862
 
2863 2863
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2864 2864
 	offset := (page - 1) * limit
@@ -2870,6 +2870,17 @@ func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2870 2870
 	if orgid > 0 {
2871 2871
 		db = db.Where("org_id = ?", orgid)
2872 2872
 	}
2873
+
2874
+	if query_type == 2 {
2875
+		db = db.Where("sum_count<=stock_warn_count")
2876
+	}
2877
+	if query_type == 3 {
2878
+		db = db.Where("sum_count = 0")
2879
+	}
2880
+
2881
+	if query_type == 4 {
2882
+		db = db.Where("sum_count > 0")
2883
+	}
2873 2884
 	//if len(ids) > 0 {
2874 2885
 	//	db = db.Where("id in(?)", goodIds)
2875 2886
 	//}
@@ -2881,7 +2892,7 @@ func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2881 2892
 	return goodinfo, total, err
2882 2893
 }
2883 2894
 
2884
-func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2895
+func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64, query_type int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2885 2896
 
2886 2897
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2887 2898
 	if orgid == 10697 || orgid == 10644 {
@@ -2893,6 +2904,17 @@ func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64
2893 2904
 		db = db.Where("good_type_id = ?", good_type)
2894 2905
 	}
2895 2906
 
2907
+	if query_type == 2 {
2908
+		db = db.Where("sum_count<=stock_warn_count")
2909
+	}
2910
+	if query_type == 3 {
2911
+		db = db.Where("sum_count = 0")
2912
+	}
2913
+
2914
+	if query_type == 4 {
2915
+		db = db.Where("sum_count > 0")
2916
+	}
2917
+
2896 2918
 	if orgid > 0 {
2897 2919
 		db = db.Where("org_id = ?", orgid)
2898 2920
 	}
@@ -2942,7 +2964,7 @@ func GetGoodWarehosueInfo(id int64) (models.WarehousingInfo, error) {
2942 2964
 	return info, err
2943 2965
 }
2944 2966
 
2945
-func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2967
+func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64, query_type int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2946 2968
 
2947 2969
 	db := XTReadDB().Model(&druginfo).Where("status = 1 and is_self_drug!=1")
2948 2970
 	offset := (page - 1) * limit
@@ -2954,6 +2976,17 @@ func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2954 2976
 		db = db.Where("find_in_set('停用',drug_status) = 0")
2955 2977
 	}
2956 2978
 
2979
+	if query_type == 2 {
2980
+		db = db.Where("sum_count<=drug_stock_limit_count")
2981
+	}
2982
+	if query_type == 3 {
2983
+		db = db.Where("sum_count = 0")
2984
+	}
2985
+
2986
+	if query_type == 4 {
2987
+		db = db.Where("sum_count > 0")
2988
+	}
2989
+
2957 2990
 	if orgid > 0 {
2958 2991
 		db = db.Where("org_id = ?", orgid)
2959 2992
 	}

+ 2 - 0
service/stock_service.go 查看文件

@@ -280,6 +280,8 @@ func ModifyGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
280 280
 		"first_letter":                   goodInfo.FirstLetter,
281 281
 		"is_show":                        goodInfo.IsShow,
282 282
 		"is_zero_flag":                   goodInfo.IsZeroFlag,
283
+		"split_of_number":                goodInfo.SplitOfNumber,
284
+		"register_number_name":           goodInfo.RegisterNumberName,
283 285
 	}).Error
284 286
 
285 287
 	writeDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND org_id = ?", goodInfo.ID, goodInfo.OrgId).Updates(map[string]interface{}{"good_type_id": goodInfo.GoodTypeId})

+ 1 - 1
service/user_service.go 查看文件

@@ -100,7 +100,7 @@ func GetAllAdminUsersTwo(orgId int64) (list []*AdminUserList, err error) {
100 100
 
101 101
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and uar.org_id=?  and ua.status=1", orgId).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error
102 102
 
103
-	if orgId == 10724 {
103
+	if orgId == 10724 || orgId == 10653 {
104 104
 		err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=?", orgId).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error
105 105
 	} else {
106 106
 		err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and uar.org_id=?  and ua.status=1", orgId).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error