test_user 1 year 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,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10387
48
+org_id = 10340
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com

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

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

+ 4 - 6
service/coordinate_service.go View File

@@ -21,13 +21,11 @@ func GetUnSettleHisPrescriptionFiveTen(org_id int64, patient_id int64, record_da
21 21
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
22 22
 		}).
23 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 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 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 30
 		Find(&prescription).Error
33 31
 	return
@@ -374,6 +372,6 @@ func UpdataOrderStatusThreeTen(number string, user_org_id int64) (err error) {
374 372
 }
375 373
 
376 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 376
 	return
379 377
 }