Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
040dbe7a0a
2 changed files with 33 additions and 788 deletions
  1. 32 788
      controllers/secondary_order_api_contorller.go
  2. 1 0
      service/mobile_dialysis_service.go

+ 32 - 788
controllers/secondary_order_api_contorller.go View File

@@ -40,6 +40,37 @@ func SecondaryOrderApiRegistRouters() {
40 40
 	beego.Router("/api/secondary/byliinit", &SecondaryOrderApiController{}, "get:Byliinit")                         //初始化旧数据
41 41
 	beego.Router("/api/secondary/getcreaterid", &SecondaryOrderApiController{}, "get:GetCreaterId")                 //获取当前登录的人的id
42 42
 
43
+	beego.Router("/api/secondary/getcode", &SecondaryOrderApiController{}, "get:GetStoreCode")                      //获取仓库编码
44
+	beego.Router("/api/secondary/updatestatus", &SecondaryOrderApiController{}, "get:UpdateStatus")                 //修改仓库状态
45
+	beego.Router("/api/secondary/deletestorehouse", &SecondaryOrderApiController{}, "get:DeleteStorehouse")         //删除仓库
46
+	beego.Router("/api/secondary/isstorehousename", &SecondaryOrderApiController{}, "get:IsStorehouseName")         //仓库名称是否重复
47
+	beego.Router("/api/secondary/isstorehouseaddress", &SecondaryOrderApiController{}, "get:IsStorehouseAddress")   //仓库地址是否重复
48
+	beego.Router("/api/secondary/storehouselist", &SecondaryOrderApiController{}, "get:StorehouseList")             //分页
49
+	beego.Router("/api/secondary/addstorehouse", &SecondaryOrderApiController{}, "post:AddStorehouse")              //新增仓库
50
+	beego.Router("/api/secondary/updatestorehouse", &SecondaryOrderApiController{}, "post:UpdateStorehouse")        //修改
51
+	beego.Router("/api/secondary/getonestorehouse", &SecondaryOrderApiController{}, "get:GetOneStorehouse")         //查一条仓库的信息
52
+	beego.Router("/api/secondary/getallstorehousename", &SecondaryOrderApiController{}, "get:GetAllStorehouseName") //获取当前机构的所有可用仓库名称
53
+	beego.Router("/api/secondary/findstorehouseconfig", &SecondaryOrderApiController{}, "get:FindStorehouseConfig") //查询该机构的仓库配置
54
+	beego.Router("/api/secondary/updateinfo", &SecondaryOrderApiController{}, "get:UpdateInfo")                     //更改耗材自动入库仓库
55
+	beego.Router("/api/secondary/updateoutinfo", &SecondaryOrderApiController{}, "get:UpdateOutInfo")               //更改耗材自动出库仓库
56
+	beego.Router("/api/secondary/updatedruginfo", &SecondaryOrderApiController{}, "get:UpdateDrugInfo")             //更改药品自动入库仓库
57
+	beego.Router("/api/secondary/updatedrugout", &SecondaryOrderApiController{}, "get:UpdateDrugOut")               //更改药品自动出库仓库
58
+	beego.Router("/api/secondary/getusername", &SecondaryOrderApiController{}, "get:GetuserName")                   //获取仓库管理员信息
59
+	beego.Router("/api/secondary/byliinit", &SecondaryOrderApiController{}, "get:Byliinit")                         //初始化旧数据
60
+	beego.Router("/api/secondary/getcreaterid", &SecondaryOrderApiController{}, "get:GetCreaterId")
61
+
62
+	beego.Router("/api/seconde/getsencondegoodlist", &SecondaryOrderApiController{}, "Get:GetSencondeGoodList")
63
+	beego.Router("/api/senconde/savesencondorder", &SecondaryOrderApiController{}, "Post:SaveSencondOrder")
64
+	beego.Router("/api/senconde/getallsecondeorderlist", &SecondaryOrderApiController{}, "Get:GetAllSecondeOrderList")
65
+	beego.Router("/api/senconde/getsencondorderdetail", &SecondaryOrderApiController{}, "Get:GetSencondOrderDetail")
66
+	beego.Router("/api/senconde/updatesencondorder", &SecondaryOrderApiController{}, "Post:UpdateSencondOrder")
67
+	beego.Router("/api/sencond/getsecondorderbyid", &SecondaryOrderApiController{}, "Get:GetSecondOrderById")
68
+	beego.Router("/api/sencond/checksecondorder", &SecondaryOrderApiController{}, "Get:CheckSecondOrer")
69
+	beego.Router("/api/sencond/deletestorehouselist", &SecondaryOrderApiController{}, "Get:DeleteStorehouseList")
70
+	beego.Router("/api/sencond/returnchecksecondeorder", &SecondaryOrderApiController{}, "Get:ReturnCheckSecondOrder")
71
+	beego.Router("/api/second/getstorehousegoodlist", &SecondaryOrderApiController{}, "Get:GetStoreHouseGoodList")
72
+	beego.Router("/api/second/getsumsecondecount", &SecondaryOrderApiController{}, "Get:GetSumSecondCount")
73
+	beego.Router("/api/second/deletesecondorderinfo", &SecondaryOrderApiController{}, "Get:DeleteSecondOrderInfo")
43 74
 }
44 75
 
45 76
 //获取仓库编码
@@ -428,804 +459,16 @@ func (this *SecondaryOrderApiController) UpdateStorehouse() {
428 459
 	})
429 460
 	return
430 461
 
431
-	beego.Router("/api/secondary/getcode", &SecondaryOrderApiController{}, "get:GetStoreCode")                      //获取仓库编码
432
-	beego.Router("/api/secondary/updatestatus", &SecondaryOrderApiController{}, "get:UpdateStatus")                 //修改仓库状态
433
-	beego.Router("/api/secondary/deletestorehouse", &SecondaryOrderApiController{}, "get:DeleteStorehouse")         //删除仓库
434
-	beego.Router("/api/secondary/isstorehousename", &SecondaryOrderApiController{}, "get:IsStorehouseName")         //仓库名称是否重复
435
-	beego.Router("/api/secondary/isstorehouseaddress", &SecondaryOrderApiController{}, "get:IsStorehouseAddress")   //仓库地址是否重复
436
-	beego.Router("/api/secondary/storehouselist", &SecondaryOrderApiController{}, "get:StorehouseList")             //分页
437
-	beego.Router("/api/secondary/addstorehouse", &SecondaryOrderApiController{}, "post:AddStorehouse")              //新增仓库
438
-	beego.Router("/api/secondary/updatestorehouse", &SecondaryOrderApiController{}, "post:UpdateStorehouse")        //修改
439
-	beego.Router("/api/secondary/getonestorehouse", &SecondaryOrderApiController{}, "get:GetOneStorehouse")         //查一条仓库的信息
440
-	beego.Router("/api/secondary/getallstorehousename", &SecondaryOrderApiController{}, "get:GetAllStorehouseName") //获取当前机构的所有可用仓库名称
441
-	beego.Router("/api/secondary/findstorehouseconfig", &SecondaryOrderApiController{}, "get:FindStorehouseConfig") //查询该机构的仓库配置
442
-	beego.Router("/api/secondary/updateinfo", &SecondaryOrderApiController{}, "get:UpdateInfo")                     //更改耗材自动入库仓库
443
-	beego.Router("/api/secondary/updateoutinfo", &SecondaryOrderApiController{}, "get:UpdateOutInfo")               //更改耗材自动出库仓库
444
-	beego.Router("/api/secondary/updatedruginfo", &SecondaryOrderApiController{}, "get:UpdateDrugInfo")             //更改药品自动入库仓库
445
-	beego.Router("/api/secondary/updatedrugout", &SecondaryOrderApiController{}, "get:UpdateDrugOut")               //更改药品自动出库仓库
446
-	beego.Router("/api/secondary/getusername", &SecondaryOrderApiController{}, "get:GetuserName")                   //获取仓库管理员信息
447
-	beego.Router("/api/secondary/byliinit", &SecondaryOrderApiController{}, "get:Byliinit")                         //初始化旧数据
448
-	beego.Router("/api/secondary/getcreaterid", &SecondaryOrderApiController{}, "get:GetCreaterId")
449
-
450
-	beego.Router("/api/seconde/getsencondegoodlist", &SecondaryOrderApiController{}, "Get:GetSencondeGoodList")
451
-	beego.Router("/api/senconde/savesencondorder", &SecondaryOrderApiController{}, "Post:SaveSencondOrder")
452
-	beego.Router("/api/senconde/getallsecondeorderlist", &SecondaryOrderApiController{}, "Get:GetAllSecondeOrderList")
453
-	beego.Router("/api/senconde/getsencondorderdetail", &SecondaryOrderApiController{}, "Get:GetSencondOrderDetail")
454
-	beego.Router("/api/senconde/updatesencondorder", &SecondaryOrderApiController{}, "Post:UpdateSencondOrder")
455
-	beego.Router("/api/sencond/getsecondorderbyid", &SecondaryOrderApiController{}, "Get:GetSecondOrderById")
456
-	beego.Router("/api/sencond/checksecondorder", &SecondaryOrderApiController{}, "Get:CheckSecondOrer")
457
-	beego.Router("/api/sencond/deletestorehouselist", &SecondaryOrderApiController{}, "Get:DeleteStorehouseList")
458
-	beego.Router("/api/sencond/returnchecksecondeorder", &SecondaryOrderApiController{}, "Get:ReturnCheckSecondOrder")
459
-	beego.Router("/api/second/getstorehousegoodlist", &SecondaryOrderApiController{}, "Get:GetStoreHouseGoodList")
460
-	beego.Router("/api/second/getsumsecondecount", &SecondaryOrderApiController{}, "Get:GetSumSecondCount")
461
-	beego.Router("/api/second/deletesecondorderinfo", &SecondaryOrderApiController{}, "Get:DeleteSecondOrderInfo")
462 462
 }
463 463
 
464
-//获取仓库编码
465
-//func (this *SecondaryOrderApiController) GetStoreCode() {
466
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
467
-//	var code string
468
-//	for a := true; a == true; {
469
-//		code = service.CreateCode()
470
-//		tmp := service.FindStorehouseCode(orgId, code)
471
-//		//如果没有重复的编码结束循环
472
-//		if tmp == false {
473
-//			a = false
474
-//		}
475
-//	}
476
-//	this.ServeSuccessJSON(map[string]interface{}{
477
-//		"list": code,
478
-//	})
479
-//	return
480
-//}
481
-
482
-//修改仓库状态
483
-//func (this *SecondaryOrderApiController) UpdateStatus() {
484
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
485
-//	check := map[string][]string{
486
-//		"id": {"must", "int", "id"},
487
-//	}
488
-//	_, err := checkParams(this, &check)
489
-//	if err != nil {
490
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
491
-//		return
492
-//	}
493
-//	id, _ := this.GetInt64("id")
494
-//	//判断该仓库的库存是否为零
495
-//	boolean := service.IsStorehouseNil(id, orgId)
496
-//	if boolean == false {
497
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库库存不为0,不支持该操作")
498
-//		return
499
-//	}
500
-//	//判断该仓库是否在仓库配置表中
501
-//	boolean = service.IsInConfig(orgId, id)
502
-//	if boolean == true {
503
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "当前仓库是自动出入库仓库,请先取消自动出入库之后才能进行此操作")
504
-//		return
505
-//	}
506
-//	//修改仓库状态
507
-//	err = service.UpdateStorehouseStatus(id)
508
-//	if err != nil {
509
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
510
-//		return
511
-//	}
512
-//	this.ServeSuccessJSON(map[string]interface{}{
513
-//		"list": "修改成功",
514
-//	})
515
-//	return
516
-//}
517
-
518
-//删除仓库
519
-//func (this *SecondaryOrderApiController) DeleteStorehouse() {
520
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
521
-//	check := map[string][]string{
522
-//		"id": {"must", "int", "id"},
523
-//	}
524
-//	_, err := checkParams(this, &check)
525
-//	if err != nil {
526
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
527
-//		return
528
-//	}
529
-//	id, _ := this.GetInt64("id")
530
-//	//判断该仓库的库存是否为零
531
-//	boolean := service.IsStorehouseNil(id, orgId)
532
-//	if boolean == false {
533
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库库存不为0,不支持该操作")
534
-//		return
535
-//	}
536
-//	//判断该仓库是否在仓库配置表中
537
-//	boolean = service.IsInConfig(orgId, id)
538
-//	if boolean == true {
539
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "当前仓库是自动出入库仓库,请先取消自动出入库之后才能进行此操作")
540
-//		return
541
-//	}
542
-//	err = service.DeleteStorehouse(id)
543
-//	if err != nil {
544
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
545
-//		return
546
-//	}
547
-//	this.ServeSuccessJSON(map[string]interface{}{
548
-//		"list": "删除成功",
549
-//	})
550
-//	return
551
-//}
552
-
553
-//仓库名称是否重复
554
-//func (this *SecondaryOrderApiController) IsStorehouseName() {
555
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
556
-//	storehouse_name := this.GetString("storehouse_name")
557
-//	check := map[string][]string{
558
-//		"storehouse_name": {"must", "string", "storehouse_name"},
559
-//	}
560
-//	_, err := checkParams(this, &check)
561
-//	if err != nil {
562
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
563
-//		return
564
-//	}
565
-//	var bo bool
566
-//	bo, err = service.IsStorehouseName(orgId, storehouse_name)
567
-//	if bo == true {
568
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库已存在,请重新输入")
569
-//		return
570
-//	}
571
-//	this.ServeSuccessJSON(map[string]interface{}{
572
-//		"list": "ok",
573
-//	})
574
-//	return
575
-//
576
-//}
577
-
578
-//仓库地址是否重复
579
-//func (this *SecondaryOrderApiController) IsStorehouseAddress() {
580
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
581
-//	storehouse_address := this.GetString("storehouse_address")
582
-//	check := map[string][]string{
583
-//		"storehouse_address": {"must", "string", "storehouse_address"},
584
-//	}
585
-//	_, err := checkParams(this, &check)
586
-//	if err != nil {
587
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
588
-//		return
589
-//	}
590
-//	var bo bool
591
-//	bo, err = service.IsStorehouseAddress(orgId, storehouse_address)
592
-//	if bo == true {
593
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该地址已存在,请重新输入")
594
-//		return
595
-//	}
596
-//	this.ServeSuccessJSON(map[string]interface{}{
597
-//		"list": "ok",
598
-//	})
599
-//	return
600
-//
601
-//}
602
-
603
-//分页
604
-//func (this *SecondaryOrderApiController) StorehouseList() {
605
-//	adminUserInfo := this.GetAdminUserInfo()
606
-//	page, _ := this.GetInt64("page")   //页码
607
-//	limit, _ := this.GetInt64("limit") //每一页查出来的条数
608
-//	check := map[string][]string{
609
-//		"page":  {"must", "string", "page"},
610
-//		"limit": {"must", "string", "limit"},
611
-//	}
612
-//	_, err := checkParams(this, &check)
613
-//	keyword := this.GetString("keyword")
614
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
615
-//	if err != nil {
616
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
617
-//	}
618
-//	namemap := make(map[int64]string)
619
-//	//根据管理员id获取管理员
620
-//	viewModels, _, _ := service.GetAdminUsersAndLoginInfo(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, 1, 100)
621
-//	for _, v := range viewModels {
622
-//		namemap[int64(v.AdminUserId)] = v.UserName
623
-//	}
624
-//	slicekey := make([]int64, 0)
625
-//	if len(keyword) > 0 {
626
-//		for k, v := range namemap {
627
-//			res := strings.Contains(v, keyword)
628
-//			if res == true {
629
-//				slicekey = append(slicekey, k)
630
-//			}
631
-//		}
632
-//	}
633
-//	//获取分页的数据
634
-//	list, total, err := service.StorehouseList(page, limit, orgId, keyword, slicekey)
635
-//
636
-//	//分页
637
-//	type Storehouselist struct {
638
-//		ID                  int64
639
-//		StorehouseCode      string //仓库编号
640
-//		StorehouseName      string //仓库名称
641
-//		StorehouseAddress   string //仓库地址
642
-//		StorehouseStatus    int64  //仓库状态
643
-//		Status              int64  //数据状态
644
-//		StorehouseAdminId   int64  //仓库管理员id
645
-//		StorehouseAdminName string //仓库管理员名字
646
-//		UserOrgId           int64
647
-//	}
648
-//	//初始化该结构体
649
-//	tmplist := []*Storehouselist{}
650
-//	for i := 0; i < len(list); i++ {
651
-//		tlist := &Storehouselist{
652
-//			list[i].ID,
653
-//			list[i].StorehouseCode,
654
-//			list[i].StorehouseName,
655
-//			list[i].StorehouseAddress,
656
-//			list[i].StorehouseStatus,
657
-//			list[i].Status,
658
-//			list[i].StorehouseAdminId,
659
-//			"",
660
-//			list[i].UserOrgId,
661
-//		}
662
-//		tmplist = append(tmplist, tlist)
663
-//	}
664
-//	for _, v := range tmplist {
665
-//		if k, ok := namemap[v.StorehouseAdminId]; ok {
666
-//			v.StorehouseAdminName = k
667
-//		} else {
668
-//			v.StorehouseAdminName = "超级管理员"
669
-//		}
670
-//	}
671
-//	this.ServeSuccessJSON(map[string]interface{}{
672
-//		"list":  tmplist,
673
-//		"total": total,
674
-//	})
675
-//}
676
-
677
-//新增仓库
678
-//func (this *SecondaryOrderApiController) AddStorehouse() {
679
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
680
-//	dataBody := make(map[string]interface{}, 0)
681
-//	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
682
-//	if err != nil {
683
-//		utils.ErrorLog(err.Error())
684
-//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
685
-//		return
686
-//	}
687
-//	var storehouse_status, admin_id int64
688
-//	tmpstatus := dataBody["storehouse_status"]
689
-//	tmpid := dataBody["storehouse_admin_id"] //管理员id
690
-//	if tmpstatus == nil {
691
-//		storehouse_status = 1
692
-//	} else {
693
-//		storehouse_status = int64(dataBody["storehouse_status"].(float64)) //状态
694
-//	}
695
-//	if tmpid == nil {
696
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "管理员id不能为空")
697
-//		return
698
-//	} else {
699
-//		admin_id = int64(dataBody["storehouse_admin_id"].(float64)) //管理员id
700
-//	}
701
-//	switch {
702
-//	case dataBody["storehouse_code"] == nil:
703
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库编号不能为空")
704
-//		return
705
-//	case dataBody["storehouse_name"] == nil:
706
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库名称不能为空")
707
-//		return
708
-//	case dataBody["storehouse_address"] == nil:
709
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库地址不能为空")
710
-//		return
711
-//	}
712
-//	code := dataBody["storehouse_code"].(string)       //仓库编号
713
-//	name := dataBody["storehouse_name"].(string)       //仓库名称
714
-//	address := dataBody["storehouse_address"].(string) //地址
715
-//	switch {
716
-//	case name == "":
717
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库名称不能为空")
718
-//		return
719
-//	case address == "":
720
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库地址不能为空")
721
-//		return
722
-//	}
723
-//
724
-//	//判断仓库名称是否重复
725
-//	var bo bool
726
-//	bo, err = service.IsStorehouseName(orgId, name)
727
-//	if bo == true {
728
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库已存在,请重新输入")
729
-//		return
730
-//	}
731
-//	//判断仓库地址是否重复
732
-//	bo, err = service.IsStorehouseAddress(orgId, address)
733
-//	if bo == true {
734
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该地址已存在,请重新输入")
735
-//		return
736
-//	}
737
-//
738
-//	storehouse := models.Storehouse{
739
-//		StorehouseCode:    code,
740
-//		StorehouseName:    name,
741
-//		StorehouseAddress: address,
742
-//		StorehouseStatus:  storehouse_status,
743
-//		UserOrgId:         orgId,
744
-//		Status:            1,
745
-//		StorehouseAdminId: admin_id,
746
-//		Ctime:             time.Now().Unix(),
747
-//	}
748
-//	err = service.AddStroehouse(storehouse)
749
-//	if err != nil {
750
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "保存失败")
751
-//		return
752
-//	}
753
-//	this.ServeSuccessJSON(map[string]interface{}{
754
-//		"list": "保存成功",
755
-//	})
756
-//	return
757
-//}
758
-
759
-//修改仓库
760
-//func (this *SecondaryOrderApiController) UpdateStorehouse() {
761
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
762
-//	dataBody := make(map[string]interface{}, 0)
763
-//	//orgId := this.GetAdminUserInfo().CurrentOrgId
764
-//	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
765
-//	if err != nil {
766
-//		utils.ErrorLog(err.Error())
767
-//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
768
-//		return
769
-//	}
770
-//	var storehouse_status, admin_id int64
771
-//	tmpstatus := dataBody["storehouse_status"]
772
-//	tmpid := dataBody["storehouse_admin_id"]
773
-//	if tmpstatus == nil {
774
-//		storehouse_status = 1
775
-//	} else {
776
-//		storehouse_status = int64(dataBody["storehouse_status"].(float64)) //状态
777
-//	}
778
-//	if tmpid == nil {
779
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "管理员id不能为空")
780
-//		return
781
-//	} else {
782
-//		admin_id = int64(dataBody["storehouse_admin_id"].(float64)) //管理员id
783
-//	}
784
-//
785
-//	switch {
786
-//	case dataBody["id"] == nil:
787
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库id不能为空")
788
-//		return
789
-//	case dataBody["storehouse_name"] == nil:
790
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库名称不能为空")
791
-//		return
792
-//	case dataBody["storehouse_address"] == nil:
793
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "仓库地址不能为空")
794
-//		return
795
-//	}
796
-//	id := int64(dataBody["id"].(float64))
797
-//	name := dataBody["storehouse_name"].(string)       //仓库名称
798
-//	address := dataBody["storehouse_address"].(string) //地址
799
-//	//查询当前仓库状态,根据当前状态判断是否需要更改
800
-//	list, errs := service.GetOneStorehouse(id, orgId)
801
-//	if errs != nil {
802
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
803
-//		return
804
-//	}
805
-//	if storehouse_status != list.StorehouseStatus && storehouse_status == 0 {
806
-//		//判断该仓库的库存是否为零
807
-//		boolean := service.IsStorehouseNil(id, orgId)
808
-//		if boolean == false {
809
-//			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库库存不为0,不支持该操作")
810
-//			return
811
-//		}
812
-//		//判断该仓库是否在仓库配置表中
813
-//		boolean = service.IsInConfig(orgId, id)
814
-//		if boolean == true {
815
-//			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "当前仓库是自动出入库仓库,请先取消自动出入库之后才能进行此操作")
816
-//			return
817
-//		}
818
-//	}
819
-//	//判断仓库名称是否重复
820
-//	var bo bool
821
-//	bo, err = service.IsStorehouseName(orgId, name)
822
-//	if bo == true {
823
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库已存在,请重新输入")
824
-//		return
825
-//	}
826
-//	//判断仓库地址是否重复
827
-//	bo, err = service.IsStorehouseAddress(orgId, address)
828
-//	if bo == true {
829
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该地址已存在,请重新输入")
830
-//		return
831
-//	}
832
-//	storehouse := models.Storehouse{
833
-//		ID:                id,
834
-//		StorehouseName:    name,
835
-//		StorehouseAddress: address,
836
-//		StorehouseStatus:  storehouse_status,
837
-//		StorehouseAdminId: admin_id,
838
-//		Mtime:             time.Now().Unix(),
839
-//	}
840
-//	err = service.UpdateStroehouse(storehouse)
841
-//	if err != nil {
842
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "保存失败")
843
-//		return
844
-//	}
845
-//	this.ServeSuccessJSON(map[string]interface{}{
846
-//		"list": "保存成功",
847
-//	})
848
-//	return
849
-//
850
-//}
851
-
852
-//查询一条仓库信息
853
-//func (this *SecondaryOrderApiController) GetOneStorehouse() {
854
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
855
-//	check := map[string][]string{
856
-//		"id": {"must", "int", "id"},
857
-//	}
858
-//	_, err := checkParams(this, &check)
859
-//	if err != nil {
860
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
861
-//		return
862
-//	}
863
-//	id, _ := this.GetInt64("id")
864
-//	var list models.Storehouse
865
-//	list, err = service.GetOneStorehouse(id, orgId)
866
-//	if err != nil {
867
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
868
-//		return
869
-//	}
870
-//	this.ServeSuccessJSON(map[string]interface{}{
871
-//		"list": list,
872
-//	})
873
-//	return
874
-//}
875
-
876
-//获取当前机构所有可用仓库的名字
877
-//func (this *SecondaryOrderApiController) GetAllStorehouseName() {
878
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
879
-//	list, err := service.GetAllStorehouseName(orgId)
880
-//	if err != nil {
881
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
882
-//		return
883
-//	}
884
-//	this.ServeSuccessJSON(map[string]interface{}{
885
-//		"list": list,
886
-//	})
887
-//
888
-//}
889
-
890
-//根据机构id查询仓库配置
891
-//func (this *SecondaryOrderApiController) FindStorehouseConfig() {
892
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
893
-//	storehouse, err := service.FindStorehouseConfig(orgId)
894
-//	//如果没有仓库配置信息就新建一个
895
-//	if err == gorm.ErrRecordNotFound {
896
-//		err := service.GetDefaultStorehouse(orgId)
897
-//		if err != nil {
898
-//			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
899
-//			return
900
-//		}
901
-//		storehouse, err = service.FindStorehouseConfig(orgId)
902
-//		if err != nil {
903
-//			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
904
-//			return
905
-//		}
906
-//	}
907
-//	if err != nil && err.Error() != "record not found" {
908
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
909
-//		return
910
-//	}
911
-//	var storehouse_info, storehouse_out_info, drug_storehouse_info, drug_storehouse_out models.Storehouse
912
-//	storehouse_info, err = service.FindStorehouseName(storehouse.StorehouseInfo)
913
-//	if err != nil {
914
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
915
-//		return
916
-//	}
917
-//	storehouse_out_info, err = service.FindStorehouseName(storehouse.StorehouseOutInfo)
918
-//	if err != nil {
919
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
920
-//		return
921
-//	}
922
-//	drug_storehouse_info, err = service.FindStorehouseName(storehouse.DrugStorehouseInfo)
923
-//	if err != nil {
924
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
925
-//		return
926
-//	}
927
-//	drug_storehouse_out, err = service.FindStorehouseName(storehouse.DrugStorehouseOut)
928
-//	if err != nil {
929
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
930
-//		return
931
-//	}
932
-//	this.ServeSuccessJSON(map[string]interface{}{
933
-//		"storehouse_info":      storehouse_info.StorehouseName,
934
-//		"storehouse_out_info":  storehouse_out_info.StorehouseName,
935
-//		"drug_storehouse_info": drug_storehouse_info.StorehouseName,
936
-//		"drug_storehouse_out":  drug_storehouse_out.StorehouseName,
937
-//	})
938
-//	return
939
-//}
940
-
941
-//更改耗材自动入库仓库
942
-//func (this *SecondaryOrderApiController) UpdateInfo() {
943
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
944
-//	check := map[string][]string{
945
-//		"id": {"must", "int", "id"},
946
-//	}
947
-//	_, err := checkParams(this, &check)
948
-//	if err != nil {
949
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
950
-//		return
951
-//	}
952
-//	id, _ := this.GetInt64("id")
953
-//	err = service.UpdateInfo(orgId, id)
954
-//
955
-//	//查询默认仓库
956
-//	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
957
-//
958
-//	list, _ := service.GetAllGoodList(orgId)
959
-//
960
-//	for _, item := range list {
961
-//		var sum_count int64
962
-//		var sum_in_count int64
963
-//		goodList, _ := service.GetGoodSumCountByStoreId(houseConfig.StorehouseOutInfo, item.ID, orgId)
964
-//		for _, it := range goodList {
965
-//			sum_count += it.StockCount
966
-//			sum_in_count += it.WarehousingCount
967
-//		}
968
-//		service.UpdateGoodByGoodId(item.ID, sum_count, sum_in_count, orgId)
969
-//	}
970
-//
971
-//	if err != nil {
972
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
973
-//		return
974
-//	}
975
-//	this.ServeSuccessJSON(map[string]interface{}{
976
-//		"list": "修改成功",
977
-//	})
978
-//	return
979
-//
980
-//}
981
-
982
-//更改耗材自动出库仓库
983
-//func (this *SecondaryOrderApiController) UpdateOutInfo() {
984
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
985
-//	check := map[string][]string{
986
-//		"id": {"must", "int", "id"},
987
-//	}
988
-//	_, err := checkParams(this, &check)
989
-//	if err != nil {
990
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
991
-//		return
992
-//	}
993
-//	id, _ := this.GetInt64("id")
994
-//	err = service.UpdateOutInfo(orgId, id)
995
-//
996
-//	//查询默认仓库
997
-//	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
998
-//
999
-//	list, _ := service.GetAllGoodList(orgId)
1000
-//	for _, item := range list {
1001
-//		var sum_count int64
1002
-//		var sum_in_count int64
1003
-//		goodList, _ := service.GetGoodSumCountByStoreId(houseConfig.StorehouseOutInfo, item.ID, orgId)
1004
-//		for _, it := range goodList {
1005
-//			sum_count += it.StockCount
1006
-//			sum_in_count += it.WarehousingCount
1007
-//		}
1008
-//		service.UpdateGoodByGoodId(item.ID, sum_count, sum_in_count, orgId)
1009
-//	}
1010
-//
1011
-//	if err != nil {
1012
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1013
-//		return
1014
-//	}
1015
-//	this.ServeSuccessJSON(map[string]interface{}{
1016
-//		"list": "修改成功",
1017
-//	})
1018
-//	return
1019
-//
1020
-//}
1021
-
1022
-//更改药品自动入库仓库
1023
-//func (this *SecondaryOrderApiController) UpdateDrugInfo() {
1024
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
1025
-//	check := map[string][]string{
1026
-//		"id": {"must", "int", "id"},
1027
-//	}
1028
-//	_, err := checkParams(this, &check)
1029
-//	if err != nil {
1030
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1031
-//		return
1032
-//	}
1033
-//	id, _ := this.GetInt64("id")
1034
-//	err = service.UpdateDrugInfo2(orgId, id)
1035
-//
1036
-//	//查询默认仓库
1037
-//	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
1038
-//	baseDrug, _ := service.GetAllBaseDrugList(orgId)
1039
-//
1040
-//	for _, item := range baseDrug {
1041
-//		var sum_drug_count int64
1042
-//		var sum_drug_in_count int64
1043
-//
1044
-//		//查询默认仓库剩余多少库存
1045
-//		list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgId, item.ID)
1046
-//		for _, it := range list {
1047
-//			if it.MaxUnit == item.MaxUnit {
1048
-//				it.StockMaxNumber = it.StockMaxNumber * item.MinNumber
1049
-//				it.WarehousingCount = it.WarehousingCount * item.MinNumber
1050
-//			}
1051
-//			sum_drug_count += it.StockMaxNumber + it.StockMinNumber
1052
-//			sum_drug_in_count += it.WarehousingCount
1053
-//		}
1054
-//		service.UpdateMedicalSumCount(item.ID, sum_drug_count, sum_drug_in_count, orgId)
1055
-//	}
1056
-//
1057
-//	if err != nil {
1058
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1059
-//		return
1060
-//	}
1061
-//	this.ServeSuccessJSON(map[string]interface{}{
1062
-//		"list": "修改成功",
1063
-//	})
1064
-//	return
1065
-//
1066
-//}
1067
-
1068
-//更改药品自动出库仓库
1069
-//func (this *SecondaryOrderApiController) UpdateDrugOut() {
1070
-//	orgId := this.GetAdminUserInfo().CurrentOrgId
1071
-//	check := map[string][]string{
1072
-//		"id": {"must", "int", "id"},
1073
-//	}
1074
-//	_, err := checkParams(this, &check)
1075
-//	if err != nil {
1076
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1077
-//		return
1078
-//	}
1079
-//	id, _ := this.GetInt64("id")
1080
-//	err = service.UpdateDrugOut(orgId, id)
1081
-//	//查询默认仓库
1082
-//	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
1083
-//
1084
-//	baseDrug, _ := service.GetAllBaseDrugList(orgId)
1085
-//
1086
-//	for _, item := range baseDrug {
1087
-//		var sum_drug_count int64
1088
-//		var sum_drug_in_count int64
1089
-//		//查询默认仓库剩余多少库存
1090
-//		list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgId, item.ID)
1091
-//		for _, it := range list {
1092
-//			if it.MaxUnit == item.MaxUnit {
1093
-//				it.StockMaxNumber = it.StockMaxNumber * item.MinNumber
1094
-//				it.WarehousingCount = it.WarehousingCount * item.MinNumber
1095
-//			}
1096
-//			sum_drug_count += it.StockMaxNumber + it.StockMinNumber
1097
-//			sum_drug_in_count += it.WarehousingCount
1098
-//		}
1099
-//		service.UpdateMedicalSumCount(item.ID, sum_drug_count, sum_drug_in_count, orgId)
1100
-//	}
1101
-//
1102
-//	if err != nil {
1103
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1104
-//		return
1105
-//	}
1106
-//	this.ServeSuccessJSON(map[string]interface{}{
1107
-//		"list": "修改成功",
1108
-//	})
1109
-//	return
1110
-//
1111
-//}
1112
-
1113
-////判断前端参数是否为空
1114
-//func checkParams(this *SecondaryOrderApiController, m *map[string][]string) (map[string]string, error) {
1115
-//	tmp := make(map[string]string)
1116
-//	for k, v := range *m {
1117
-//		t := this.GetString(k)
1118
-//		if v[0] == "must" && t == "" {
1119
-//			return nil, fmt.Errorf(v[2] + "不能为空")
1120
-//		}
1121
-//		tmp[k] = t
1122
-//	}
1123
-//	return tmp, nil
1124
-//}
1125
-//
1126
-////兼容旧数据
1127
-//func (this *SecondaryOrderApiController) Byliinit() {
1128
-//	err := service.Byliinit()
1129
-//	if err != nil {
1130
-//		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1131
-//		return
1132
-//	}
1133
-//	this.ServeSuccessJSON(map[string]interface{}{
1134
-//		"list": "初始化成功",
1135
-//	})
1136
-//	return
1137
-//}
1138
-
1139
-//查询机构所属管理员
1140
-//func (this *SecondaryOrderApiController) GetuserName() {
1141
-//	adminUserInfo := this.GetAdminUserInfo()
1142
-//	viewModels, _, _ := service.GetAdminUsersAndLoginInfo(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, 1, 100)
1143
-//	c, _ := service.Getcreateid(adminUserInfo.CurrentOrgId)
1144
-//	//c.Creator
1145
-//	admin := []*service.AdminUserManageViewModel{} //记录当前管理员的信息
1146
-//	//去除禁用的角色
1147
-//	tmp := []*service.AdminUserManageViewModel{}
1148
-//	for i := 0; i < len(viewModels); i++ {
1149
-//		if viewModels[i].Status == 1 {
1150
-//			tmp = append(tmp, viewModels[i])
1151
-//		}
1152
-//		if int64(viewModels[i].AdminUserId) == c.Creator {
1153
-//			admin = append(admin, viewModels[i])
1154
-//		}
1155
-//	}
1156
-//	roles := service.FindRoles(adminUserInfo.CurrentOrgId)
1157
-//	//去除没有权限的角色
1158
-//	tmplist := []*service.AdminUserManageViewModel{}
1159
-//	if roles == nil || len(roles) == 0 {
1160
-//		this.ServeSuccessJSON(map[string]interface{}{
1161
-//			"list": tmplist,
1162
-//		})
1163
-//		return
1164
-//	}
1165
-//	for i := 0; i < len(tmp); i++ {
1166
-//		boolean := false
1167
-//		//获取并解析当前用户的角色
1168
-//		tmproles := strings.Split(tmp[i].RoleIds, ",")
1169
-//		for j := 0; j < len(tmproles); j++ {
1170
-//			//判断这些角色是否有权限
1171
-//			if _, ok := roles[tmproles[j]]; ok {
1172
-//				boolean = true
1173
-//			}
1174
-//		}
1175
-//		if boolean {
1176
-//			tmplist = append(tmplist, tmp[i])
1177
-//		}
1178
-//	}
1179
-//	isappend := true //判断结果中是否添加机构创建者,true添加,false不添加
1180
-//	if len(tmplist) > 0 {
1181
-//		for i := 0; i < len(tmplist); i++ {
1182
-//			if int64(tmplist[i].AdminUserId) == c.Creator {
1183
-//				isappend = false
1184
-//			}
1185
-//		}
1186
-//	}
1187
-//	if isappend {
1188
-//		tmplist = append(tmplist, admin...)
1189
-//	}
1190
-//	this.ServeSuccessJSON(map[string]interface{}{
1191
-//		"list": tmplist,
1192
-//	})
1193
-//	return
1194
-//}
1195
-//
1196
-//func (this *SecondaryOrderApiController) GetCreaterId() {
1197
-//	creater := this.GetAdminUserInfo().AdminUser.Id
1198
-//	this.ServeSuccessJSON(map[string]interface{}{
1199
-//		"list": creater,
1200
-//	})
1201
-//}
1202
-
1203
-//
1204 464
 func (this *SecondaryOrderApiController) GetSencondeGoodList() {
1205 465
 
1206 466
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1207 467
 
1208
-	//houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
1209
-	////获取药品库数据
1210
-	//baseList, _ := service.GetSupplyDrugListOne(orgId,houseConfig.DrugStorehouseOut)
1211
-	//
1212
-	//goodList, _ := service.GetSupplyGoodListOne(orgId,houseConfig.StorehouseOutInfo)
1213
-	//
1214
-	//goodTypeList, _ := service.GetAllGoodType(orgId)
1215
-
1216 468
 	houseList, _ := service.GetAllStoreHouseListThree(orgId)
1217 469
 
1218
-	//configlist, _ := service.GetAllStoreHouseConfig(orgId)
1219
-	//var drugType = "药品类型"
1220
-	//drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
1221
-	//drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
1222 470
 	this.ServeSuccessJSON(map[string]interface{}{
1223
-		//"drugList":        baseList,
1224
-		//"goodList":        goodList,
1225
-		//"goodTypeList":    goodTypeList,
1226
-		//"drugTypeList":    drugTypeList,
1227 471
 		"houseList": houseList,
1228
-		//"configlist":configlist,
1229 472
 	})
1230 473
 	return
1231 474
 }
@@ -1421,6 +664,7 @@ func (this *SecondaryOrderApiController) SaveSencondOrder() {
1421 664
 func (this *SecondaryOrderApiController) GetAllSecondeOrderList() {
1422 665
 
1423 666
 	check_id, _ := this.GetInt64("check_id")
667
+	fmt.Println("checkd_id3232323233233223", check_id)
1424 668
 	start_time := this.GetString("start_time")
1425 669
 	timeLayout := "2006-01-02"
1426 670
 	loc, _ := time.LoadLocation("Local")

+ 1 - 0
service/mobile_dialysis_service.go View File

@@ -164,6 +164,7 @@ type MSchedualPatientVMList struct {
164 164
 	Name               string `gorm:"column:name" json:"name" form:"name"`
165 165
 	IdCardNo           string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
166 166
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
167
+	TrobleShoot        int64  `gorm:"column:troble_shoot" json:"troble_shoot" form:"troble_shoot"`
167 168
 }
168 169
 
169 170
 func (MSchedualPatientVMList) TableName() string {