|
@@ -5225,6 +5225,15 @@ func (c *HisApiController) PreSettle() {
|
5225
|
5225
|
}
|
5226
|
5226
|
}
|
5227
|
5227
|
|
|
5228
|
+type CustomOrderInfo struct {
|
|
5229
|
+ Name string
|
|
5230
|
+ Spec string
|
|
5231
|
+ Unit string
|
|
5232
|
+ Count float64
|
|
5233
|
+ Price float64
|
|
5234
|
+ Total float64
|
|
5235
|
+}
|
|
5236
|
+
|
5228
|
5237
|
func (c *HisApiController) GetPrivateExpensesInfo() {
|
5229
|
5238
|
order_id, _ := c.GetInt64("id", 0)
|
5230
|
5239
|
his_patient_id, _ := c.GetInt64("his_patient_id", 0)
|
|
@@ -5238,16 +5247,56 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
|
5238
|
5247
|
his, _ := service.GetHisPatientByIdThree(his_patient_id)
|
5239
|
5248
|
org_id := c.GetAdminUserInfo().CurrentOrgId
|
5240
|
5249
|
adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
|
5241
|
|
- order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
|
|
5250
|
+ //order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
|
|
5251
|
+
|
|
5252
|
+ orderInfos, _ := service.GetHisOrderInfoByNumberOne(order.Number)
|
|
5253
|
+ orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
|
|
5254
|
+ orderInfos_three, _ := service.GetHisOrderInfoByNumberThree(order.Number)
|
|
5255
|
+
|
|
5256
|
+ var orderInfos_four []*models.HisOrderInfoTwo
|
|
5257
|
+ for _, item := range orderInfos_three {
|
|
5258
|
+ if item.HisPrescriptionProject.HisProject.CostClassify == 3 {
|
|
5259
|
+ item.HisPrescriptionProject.IsCheckTeam = 1
|
|
5260
|
+ orderInfos_four = append(orderInfos_four, item)
|
|
5261
|
+
|
|
5262
|
+ }
|
|
5263
|
+ if item.HisPrescriptionProject.HisProject.CostClassify != 3 {
|
|
5264
|
+ item.HisPrescriptionProject.IsCheckTeam = 2
|
|
5265
|
+ orderInfos_two = append(orderInfos_two, item)
|
|
5266
|
+ }
|
|
5267
|
+ }
|
|
5268
|
+
|
|
5269
|
+ new_order_info := RemoveRepeatedTeam(orderInfos_four)
|
|
5270
|
+ var cus_slice []CustomOrderInfo
|
|
5271
|
+ for _, item := range new_order_info {
|
|
5272
|
+ var cus CustomOrderInfo
|
|
5273
|
+ cus.Name = item.HisPrescriptionProject.XtHisProjectTeam.ProjectTeam
|
|
5274
|
+ cus.Unit = ""
|
|
5275
|
+ cus.Spec = ""
|
|
5276
|
+ var total float64
|
|
5277
|
+ for _, subItem := range orderInfos_four {
|
|
5278
|
+ if item.HisPrescriptionProject.TeamId == subItem.HisPrescriptionProject.TeamId {
|
|
5279
|
+ total = total + subItem.DetItemFeeSumamt
|
|
5280
|
+ fmt.Println(subItem.DetItemFeeSumamt)
|
|
5281
|
+ }
|
|
5282
|
+ }
|
|
5283
|
+ cus.Count = 1
|
|
5284
|
+ cus.Total = total
|
|
5285
|
+ cus_slice = append(cus_slice, cus)
|
|
5286
|
+ }
|
|
5287
|
+
|
|
5288
|
+ orderInfos = append(orderInfos, orderInfos_two...)
|
|
5289
|
+
|
5242
|
5290
|
patient, _ := service.GetPatientByID(org_id, order.PatientId)
|
5243
|
5291
|
c.ServeSuccessJSON(map[string]interface{}{
|
5244
|
|
- "order": order,
|
5245
|
|
- "order_info": order_info,
|
5246
|
|
- "patient": patient,
|
5247
|
|
- "admin_info": adminInfo,
|
5248
|
|
- "his": his,
|
5249
|
|
- "current_admin": role,
|
5250
|
|
- "org_config": miConfig,
|
|
5292
|
+ "order": order,
|
|
5293
|
+ "order_info": orderInfos,
|
|
5294
|
+ "patient": patient,
|
|
5295
|
+ "admin_info": adminInfo,
|
|
5296
|
+ "his": his,
|
|
5297
|
+ "current_admin": role,
|
|
5298
|
+ "org_config": miConfig,
|
|
5299
|
+ "new_order_info": cus_slice,
|
5251
|
5300
|
})
|
5252
|
5301
|
|
5253
|
5302
|
}
|
|
@@ -5411,3 +5460,20 @@ func (c *HisApiController) GetAllOrder() {
|
5411
|
5460
|
return
|
5412
|
5461
|
|
5413
|
5462
|
}
|
|
5463
|
+
|
|
5464
|
+func RemoveRepeatedTeam(arr []*models.HisOrderInfoTwo) (newArr []*models.HisOrderInfoTwo) {
|
|
5465
|
+ newArr = make([]*models.HisOrderInfoTwo, 0)
|
|
5466
|
+ for i := 0; i < len(arr); i++ {
|
|
5467
|
+ repeat := false
|
|
5468
|
+ for j := i + 1; j < len(arr); j++ {
|
|
5469
|
+ if arr[i].HisPrescriptionProject.TeamId == arr[j].HisPrescriptionProject.TeamId {
|
|
5470
|
+ repeat = true
|
|
5471
|
+ break
|
|
5472
|
+ }
|
|
5473
|
+ }
|
|
5474
|
+ if !repeat {
|
|
5475
|
+ newArr = append(newArr, arr[i])
|
|
5476
|
+ }
|
|
5477
|
+ }
|
|
5478
|
+ return
|
|
5479
|
+}
|