XMLWAN преди 2 години
родител
ревизия
0b8d674ddf
променени са 3 файла, в които са добавени 76 реда и са изтрити 0 реда
  1. 40 0
      controllers/his_summary_controller.go
  2. 3 0
      controllers/stock_in_api_controller.go
  3. 33 0
      service/his_summary_service.go

+ 40 - 0
controllers/his_summary_controller.go Целия файл

14
 func HisSummaryApiRegistRouters() {
14
 func HisSummaryApiRegistRouters() {
15
 
15
 
16
 	beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
16
 	beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
17
+	beego.Router("/api/his/getgatherdetailist", &HisSummaryApiController{}, "Get:GetGatherDetaiList")
17
 
18
 
18
 }
19
 }
19
 
20
 
52
 
53
 
53
 	}
54
 	}
54
 }
55
 }
56
+
57
+func (this *HisSummaryApiController) GetGatherDetaiList() {
58
+
59
+	start_time := this.GetString("start_time")
60
+	end_time := this.GetString("end_time")
61
+	keyword := this.GetString("keyword")
62
+	item_type, _ := this.GetInt64("type")
63
+	patient_id, _ := this.GetInt64("patient_id")
64
+	adminUser := this.GetAdminUserInfo()
65
+
66
+	timeLayout := "2006-01-02"
67
+	loc, _ := time.LoadLocation("Local")
68
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
69
+	if err != nil {
70
+
71
+	}
72
+	startRecordDateTime := startTime.Unix()
73
+
74
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
75
+	if err != nil {
76
+
77
+	}
78
+	endRecordDateTime := endTime.Unix()
79
+
80
+	list, err := service.GetAdviceGatherDetaiList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
81
+
82
+	detailList, _ := service.GetProjectGatherDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
83
+	if err == nil {
84
+		this.ServeSuccessJSON(map[string]interface{}{
85
+			"detailList": detailList,
86
+			"list":       list,
87
+		})
88
+		return
89
+	} else {
90
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
91
+		return
92
+
93
+	}
94
+}

+ 3 - 0
controllers/stock_in_api_controller.go Целия файл

5565
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5565
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5566
 	list, total, _ := service.GetStockListById(id, orgId, limit, page, startTime, endTime)
5566
 	list, total, _ := service.GetStockListById(id, orgId, limit, page, startTime, endTime)
5567
 	houseList, _ := service.GetAllStoreHouseList(orgId)
5567
 	houseList, _ := service.GetAllStoreHouseList(orgId)
5568
+	good, _ := service.GetGoodInformationByGoodId(id)
5568
 	this.ServeSuccessJSON(map[string]interface{}{
5569
 	this.ServeSuccessJSON(map[string]interface{}{
5569
 		"list":             list,
5570
 		"list":             list,
5570
 		"total":            total,
5571
 		"total":            total,
5571
 		"manufacturerList": manufacturerList,
5572
 		"manufacturerList": manufacturerList,
5572
 		"houseList":        houseList,
5573
 		"houseList":        houseList,
5574
+		"good":             good,
5573
 	})
5575
 	})
5574
 
5576
 
5575
 }
5577
 }
5856
 	}
5858
 	}
5857
 
5859
 
5858
 	list, total, _ := service.GetStockFlowList(limit, page, consumable_type, orgId, startTime, endTime, good_id)
5860
 	list, total, _ := service.GetStockFlowList(limit, page, consumable_type, orgId, startTime, endTime, good_id)
5861
+	fmt.Println("list233223323233233232323232323233232322323233223", list)
5859
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5862
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5860
 	good, _ := service.GetGoodInformationByGoodId(good_id)
5863
 	good, _ := service.GetGoodInformationByGoodId(good_id)
5861
 	houseList, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
5864
 	houseList, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)

+ 33 - 0
service/his_summary_service.go Целия файл

263
 	err = writeDb.Model(&models.HisPrescriptionProjectModeTemplate{}).Where("user_org_id = ? AND prescription_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
263
 	err = writeDb.Model(&models.HisPrescriptionProjectModeTemplate{}).Where("user_org_id = ? AND prescription_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
264
 	return
264
 	return
265
 }
265
 }
266
+
267
+func GetAdviceGatherDetaiList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.HisOrderInfo, err error) {
268
+
269
+	db := XTReadDB().Model(&orderInfo).Where("status = 1")
270
+
271
+	if org_id > 0 {
272
+		db = db.Where("user_org_id = ?", org_id)
273
+	}
274
+	if start_time > 0 {
275
+		db = db.Where("ctime >=?", start_time)
276
+	}
277
+	if end_time > 0 {
278
+		db = db.Where("ctime <=?", end_time)
279
+	}
280
+	err = db.Group("advice_id").Find(&orderInfo).Error
281
+	return orderInfo, err
282
+}
283
+
284
+func GetProjectGatherDetailList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.HisOrderInfo, err error) {
285
+	db := XTReadDB().Model(&orderInfo).Where("status = 1")
286
+
287
+	if org_id > 0 {
288
+		db = db.Where("user_org_id = ?", org_id)
289
+	}
290
+	if start_time > 0 {
291
+		db = db.Where("ctime >=?", start_time)
292
+	}
293
+	if end_time > 0 {
294
+		db = db.Where("ctime <=?", end_time)
295
+	}
296
+	err = db.Group("project_id").Find(&orderInfo).Error
297
+	return orderInfo, err
298
+}