소스 검색

11月8日库存管理

XMLWAN 2 년 전
부모
커밋
edd54b5066
1개의 변경된 파일35개의 추가작업 그리고 3개의 파일을 삭제
  1. 35 3
      controllers/dialysis_api_controller.go

+ 35 - 3
controllers/dialysis_api_controller.go 파일 보기

64
 	beego.Router("/api/queue/update", &DialysisApiController{}, "Get:UpdateQueueCall")
64
 	beego.Router("/api/queue/update", &DialysisApiController{}, "Get:UpdateQueueCall")
65
 
65
 
66
 	beego.Router("/api/get/getrolelist", &DialysisApiController{}, "Get:GetRoleList")
66
 	beego.Router("/api/get/getrolelist", &DialysisApiController{}, "Get:GetRoleList")
67
+
68
+	beego.Router("/api/getinitprintdata", &DialysisApiController{}, "Get:GetInitPrintData")
67
 }
69
 }
68
 
70
 
69
 func (c *DialysisApiController) GetQueueCall() {
71
 func (c *DialysisApiController) GetQueueCall() {
3749
 
3751
 
3750
 	patient_id, _ := c.GetInt64("patient_id")
3752
 	patient_id, _ := c.GetInt64("patient_id")
3751
 
3753
 
3754
+	good_type, _ := c.GetInt64("good_type")
3755
+
3752
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
3756
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
3753
 	if parseDateErr != nil && len(schedualDate) != 0 {
3757
 	if parseDateErr != nil && len(schedualDate) != 0 {
3754
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3758
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3771
 	goodTypes, _ := service.FindAllGoodType(adminUser.CurrentOrgId)
3775
 	goodTypes, _ := service.FindAllGoodType(adminUser.CurrentOrgId)
3772
 
3776
 
3773
 	if err == gorm.ErrRecordNotFound {
3777
 	if err == gorm.ErrRecordNotFound {
3778
+		list, _ := service.GetDialysisGood(adminUser.CurrentOrgId, date.Unix())
3779
+		var ids []int64
3780
+		for _, item := range list {
3781
+			ids = append(ids, item.PatientId)
3782
+		}
3774
 
3783
 
3775
-		dialysisGoods, _, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate)
3784
+		dialysisGoods, _, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate, good_type, ids)
3776
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3785
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3777
-
3778
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3786
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3779
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3787
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3780
 			item.LastAutomaticReduceDetail = goodUser
3788
 			item.LastAutomaticReduceDetail = goodUser
3789
 
3797
 
3790
 	} else if err == nil {
3798
 	} else if err == nil {
3791
 		//获取当天排班的每个患者的库存使用情况
3799
 		//获取当天排班的每个患者的库存使用情况
3792
-		dialysisGoods, err, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate)
3800
+		list, _ := service.GetDialysisGood(adminUser.CurrentOrgId, date.Unix())
3801
+		var ids []int64
3802
+		for _, item := range list {
3803
+			ids = append(ids, item.PatientId)
3804
+		}
3805
+
3806
+		dialysisGoods, err, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate, good_type, ids)
3793
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3807
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3794
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3808
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3795
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3809
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3873
 		return
3887
 		return
3874
 	}
3888
 	}
3875
 }
3889
 }
3890
+
3891
+func (c *DialysisApiController) GetInitPrintData() {
3892
+
3893
+	patient_id, _ := c.GetInt64("patient_id")
3894
+	record_date, _ := c.GetInt64("record_date")
3895
+	orgId := c.GetAdminUserInfo().CurrentOrgId
3896
+	list, err := service.GetInitPrintData(patient_id, record_date, orgId)
3897
+	if err == nil {
3898
+		c.ServeSuccessJSON(map[string]interface{}{
3899
+			"list": list,
3900
+		})
3901
+		return
3902
+
3903
+	} else {
3904
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3905
+		return
3906
+	}
3907
+}