test_user 2 years ago
parent
commit
151c29c654
3 changed files with 24 additions and 21 deletions
  1. 1 1
      conf/app.conf
  2. 19 14
      controllers/coordinate/coordinate_controller.go
  3. 4 6
      service/coordinate_service.go

+ 1 - 1
conf/app.conf View File

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 10387
48
+org_id = 10340
49
 mobile_token_expiration_second = 86400
49
 mobile_token_expiration_second = 86400
50
 httpdomain = https://api.xt.kuyicloud.com
50
 httpdomain = https://api.xt.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com

+ 19 - 14
controllers/coordinate/coordinate_controller.go View File

40
 	Result []struct {
40
 	Result []struct {
41
 		Type      string `json:"type"`
41
 		Type      string `json:"type"`
42
 		Name      string `json:"name"`
42
 		Name      string `json:"name"`
43
-		Vaa01     int    `json:"vaa01"`
44
-		Vaa07     int    `json:"vaa07"`
43
+		Vaa01     int64  `json:"vaa01"`
44
+		Vaa07     int64  `json:"vaa07"`
45
 		Visittime string `json:"visittime"`
45
 		Visittime string `json:"visittime"`
46
 	} `json:"result"`
46
 	} `json:"result"`
47
 	Code string `json:"code"`
47
 	Code string `json:"code"`
226
 			info.Diag = append(info.Diag, &diag)
226
 			info.Diag = append(info.Diag, &diag)
227
 		}
227
 		}
228
 		var presInfos []*models.PresInfo
228
 		var presInfos []*models.PresInfo
229
-		var presDetails []*models.PresDetail
229
+
230
 		for index, item := range prescriptions {
230
 		for index, item := range prescriptions {
231
+			var presDetails []*models.PresDetail
231
 			var presDetail models.PresDetail
232
 			var presDetail models.PresDetail
232
 			var presInfo models.PresInfo
233
 			var presInfo models.PresInfo
233
 			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
234
 			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
238
 			}
239
 			}
239
 
240
 
240
 			if item.Type == 1 {
241
 			if item.Type == 1 {
241
-				presInfo.Cbm07 = item.MedType
242
+				presInfo.Cbm07 = ""
242
 			} else {
243
 			} else {
243
-				presInfo.Cbm07 = item.MedType
244
+				presInfo.Cbm07 = ""
244
 			}
245
 			}
245
 
246
 
246
 			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
247
 			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
251
 				var infoItem models.Item
252
 				var infoItem models.Item
252
 				infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
253
 				infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
253
 				infoItem.Vaf11 = "2"
254
 				infoItem.Vaf11 = "2"
254
-				infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
255
+				infoItem.Vaf36 = time.Unix(subItem.StartTime, 0).Format("2006-01-02 15:04:05")
255
 				infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
256
 				infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
256
 				infoItem.Bda01 = "1"
257
 				infoItem.Bda01 = "1"
257
 				infoItem.Bby01 = ""
258
 				infoItem.Bby01 = ""
261
 				infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
262
 				infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
262
 				infoItem.Bdi01 = ef.Code
263
 				infoItem.Bdi01 = ef.Code
263
 				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
264
 				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
265
+				infoItem.Vaf18 = fmt.Sprintf("%.2f", subItem.SingleDose)
266
+
264
 				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
267
 				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
265
 				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
268
 				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
266
 				infoItem.Vaf35 = "0"
269
 				infoItem.Vaf35 = "0"
275
 				//ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
278
 				//ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
276
 
279
 
277
 				if subItem.Type == 2 {
280
 				if subItem.Type == 2 {
278
-					if subItem.HisProject.CostClassify == 10 {
281
+					fmt.Println(subItem.HisProject.CostClassify)
282
+					if subItem.HisProject.CostClassify == 100 {
279
 						var infoItem models.Item
283
 						var infoItem models.Item
280
 						infoItem.Rownr = "0"
284
 						infoItem.Rownr = "0"
281
 						infoItem.Vaf11 = "2"
285
 						infoItem.Vaf11 = "2"
282
-						infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
286
+						infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
283
 						infoItem.Bbx01 = subItem.HisProject.MedicalCode
287
 						infoItem.Bbx01 = subItem.HisProject.MedicalCode
284
 						infoItem.Bda01 = "Z"
288
 						infoItem.Bda01 = "Z"
285
 						infoItem.Bby01 = ""
289
 						infoItem.Bby01 = ""
286
 						infoItem.Vaf14 = subItem.HisProject.ProjectName
290
 						infoItem.Vaf14 = subItem.HisProject.ProjectName
287
 						infoItem.Vaf15 = subItem.HisProject.ProjectName
291
 						infoItem.Vaf15 = subItem.HisProject.ProjectName
288
 						infoItem.Bdi01 = "160"
292
 						infoItem.Bdi01 = "160"
289
-						infoItem.Vaf17 = subItem.Day
293
+						infoItem.Vaf17 = "1"
290
 						infoItem.Vaf20 = subItem.SingleDose
294
 						infoItem.Vaf20 = subItem.SingleDose
291
 						infoItem.Vaf21 = subItem.Count
295
 						infoItem.Vaf21 = subItem.Count
292
 						infoItem.Vaf35 = "0"
296
 						infoItem.Vaf35 = "0"
293
-						infoItem.Vaf18 = 0
297
+						infoItem.Vaf18 = ""
294
 						infoItem.Vaf32 = "1"
298
 						infoItem.Vaf32 = "1"
295
 						infoItem.Bck01b = departmwnt.Number
299
 						infoItem.Bck01b = departmwnt.Number
296
 						infoItem.Bck01d = departmwnt.Number
300
 						infoItem.Bck01d = departmwnt.Number
303
 						var infoItem models.Item
307
 						var infoItem models.Item
304
 						infoItem.Rownr = "0"
308
 						infoItem.Rownr = "0"
305
 						infoItem.Vaf11 = "1"
309
 						infoItem.Vaf11 = "1"
306
-						infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
310
+						infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
307
 						infoItem.Bbx01 = subItem.HisProject.MedicalCode
311
 						infoItem.Bbx01 = subItem.HisProject.MedicalCode
308
 
312
 
309
 						if subItem.HisProject.CostClassify == 2 {
313
 						if subItem.HisProject.CostClassify == 2 {
321
 						infoItem.Vaf20 = subItem.SingleDose
325
 						infoItem.Vaf20 = subItem.SingleDose
322
 						infoItem.Vaf21 = subItem.Count
326
 						infoItem.Vaf21 = subItem.Count
323
 						infoItem.Vaf35 = "0"
327
 						infoItem.Vaf35 = "0"
324
-						infoItem.Vaf18 = 0
328
+						infoItem.Vaf18 = fmt.Sprintf("%.2f", subItem.SingleDose)
325
 						infoItem.Vaf32 = "0"
329
 						infoItem.Vaf32 = "0"
326
 						infoItem.Bck01b = departmwnt.Number
330
 						infoItem.Bck01b = departmwnt.Number
327
 						infoItem.Bck01d = departmwnt.Number
331
 						infoItem.Bck01d = departmwnt.Number
335
 					var infoItem models.Item
339
 					var infoItem models.Item
336
 					infoItem.Rownr = "0"
340
 					infoItem.Rownr = "0"
337
 					infoItem.Vaf11 = "1"
341
 					infoItem.Vaf11 = "1"
338
-					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
342
+					infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
339
 					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
343
 					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
340
 					infoItem.Bda01 = "M"
344
 					infoItem.Bda01 = "M"
341
 					infoItem.Bby01 = ""
345
 					infoItem.Bby01 = ""
355
 				}
359
 				}
356
 
360
 
357
 			}
361
 			}
362
+
358
 			presDetail.Item = infoItems
363
 			presDetail.Item = infoItems
359
 			presDetails = append(presDetails, &presDetail)
364
 			presDetails = append(presDetails, &presDetail)
360
 			presInfo.PresDetail = presDetails
365
 			presInfo.PresDetail = presDetails
447
 			}
452
 			}
448
 			err = service.CreateOrder(order)
453
 			err = service.CreateOrder(order)
449
 			if err != nil {
454
 			if err != nil {
450
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
455
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderExceptionT)
451
 				return
456
 				return
452
 			}
457
 			}
453
 
458
 

+ 4 - 6
service/coordinate_service.go View File

21
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
21
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
22
 		}).
22
 		}).
23
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
23
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
24
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
24
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
25
 		}).
25
 		}).
26
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
26
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
27
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
28
-		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
29
-		return db.Where("status = 1 AND user_org_id = ? AND order_status <> 3  AND order_status <> 2  ", org_id)
30
-	}).
27
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
28
+		}).
31
 		Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 and order_status <> 5  AND p_type = ?", org_id, record_date, patient_id, p_type).
29
 		Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 and order_status <> 5  AND p_type = ?", org_id, record_date, patient_id, p_type).
32
 		Find(&prescription).Error
30
 		Find(&prescription).Error
33
 	return
31
 	return
374
 }
372
 }
375
 
373
 
376
 func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
374
 func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
377
-	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
375
+	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("(org_id = ? OR org_id = 0) AND name = ?", org_id, name).First(&ef).Error
378
 	return
376
 	return
379
 }
377
 }