Ver código fonte

提交代码

陈少旭 11 meses atrás
pai
commit
dbfa2c8db6
1 arquivos alterados com 150 adições e 94 exclusões
  1. 150 94
      controllers/his_hospital_api_controller.go

+ 150 - 94
controllers/his_hospital_api_controller.go Ver arquivo

@@ -42,7 +42,31 @@ func HisHospitalManagerApiRegistRouters() {
42 42
 
43 43
 	beego.Router("/api/hospital/inhopitalcheck/list", &HisHospitalApiController{}, "get:GetZHInHospitalCheckList")
44 44
 
45
+	beego.Router("/api/fapiao/modifytwo", &HisHospitalApiController{}, "post:ModifyFaPiaoCode")
46
+
45 47
 }
48
+func (this *HisHospitalApiController) ModifyFaPiaoCode() {
49
+	order_id, _ := this.GetInt64("id")
50
+	fapiao_code := this.GetString("fapiao_code")
51
+
52
+	order, _ := service.GetHisOrderByID(order_id)
53
+	if order.ID == 0 {
54
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
55
+		return
56
+	}
57
+
58
+	order.FaPiaoCode = fapiao_code
59
+	err := service.SaveOrderTwo(&order)
60
+	if err != nil {
61
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
62
+		return
63
+	}
64
+	this.ServeSuccessJSON(map[string]interface{}{
65
+		"order": order,
66
+		"msg":   "修改成功",
67
+	})
68
+}
69
+
46 70
 func (this *HisHospitalApiController) GetZHInHospitalCheckList() {
47 71
 	timeLayout := "2006-01-02"
48 72
 	loc, _ := time.LoadLocation("Local")
@@ -185,6 +209,11 @@ func (c *HisHospitalApiController) GetUploadInfo() {
185 209
 				//if subItem.Drug.IsUser != 1 {
186 210
 				//var randNum int
187 211
 				//randNum = rand.Intn(10000) + 1000
212
+				if len(subItem.FeedetlSn) == 0 {
213
+					fmt.Println("drug")
214
+					fmt.Println(subItem.ID)
215
+				}
216
+
188 217
 				cus := &models.NewCustom{
189 218
 					DetItemFeeSumamt: subItem.Price * subItem.PrescribingNumber,
190 219
 					Cut:              subItem.PrescribingNumber,
@@ -202,7 +231,12 @@ func (c *HisHospitalApiController) GetUploadInfo() {
202 231
 
203 232
 		if item.Type == 2 { //项目
204 233
 			for _, subItem := range item.HisPrescriptionProject {
234
+
205 235
 				if subItem.Type == 2 {
236
+					if len(subItem.FeedetlSn) == 0 {
237
+						fmt.Println("project")
238
+						fmt.Println(subItem.ID)
239
+					}
206 240
 					//if len(subItem.HisProject.MedicalCode) > 0 {
207 241
 					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
208 242
 					cus := &models.NewCustom{
@@ -217,6 +251,10 @@ func (c *HisHospitalApiController) GetUploadInfo() {
217 251
 					customs = append(customs, cus)
218 252
 					//}/* *//**/
219 253
 				} else if subItem.Type == 3 {
254
+					if len(subItem.FeedetlSn) == 0 {
255
+						fmt.Println("good")
256
+						fmt.Println(subItem.ID)
257
+					}
220 258
 					//if subItem.GoodInfo.IsUser != 1 {
221 259
 					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
222 260
 
@@ -242,65 +280,67 @@ func (c *HisHospitalApiController) GetUploadInfo() {
242 280
 	if settle_accounts_type == 1 {
243 281
 		fmt.Println(customs)
244 282
 		for _, subItem := range customs {
245
-			temp := strings.Split(subItem.FeedetlSn, "-")
246
-			var advice_id int64 = 0
247
-			var project_id int64 = 0
248
-			var types int64 = 0
249
-
250
-			id, _ := strconv.ParseInt(temp[2], 10, 64)
251
-			types, _ = strconv.ParseInt(temp[1], 10, 64)
252
-
253
-			if temp[1] == "1" {
254
-				advice_id = id
255
-				project_id = 0
256
-			} else if temp[1] == "2" {
257
-				advice_id = 0
258
-				project_id = id
259
-			}
260
-			info := &models.HisOrderInfo{
261
-				OrderNumber:      record.Number,
262
-				FeedetlSn:        subItem.FeedetlSn,
263
-				UploadDate:       recordDateTime,
264
-				AdviceId:         advice_id,
265
-				DetItemFeeSumamt: subItem.DetItemFeeSumamt,
266
-				Cnt:              subItem.Cut,
267
-				Pric:             float64(subItem.Price),
268
-				PatientId:        record.PatientId,
269
-				PricUplmtAmt:     0,
270
-				SelfpayProp:      0,
271
-				FulamtOwnpayAmt:  0,
272
-				OverlmtAmt:       0,
273
-				PreselfpayAmt:    0,
274
-				Status:           1,
275
-				Mtime:            time.Now().Unix(),
276
-				Ctime:            time.Now().Unix(),
277
-				UserOrgId:        adminUser.CurrentOrgId,
278
-				HisPatientId:     record.ID,
279
-				OrderId:          0,
280
-				ProjectId:        project_id,
281
-				Type:             types,
282
-				SettleType:       settle_accounts_type,
283
-			}
284
-			if info.AdviceId > 0 && info.ProjectId == 0 {
285
-				info.MedChrgitmType = "09"
286
-			} else if info.AdviceId == 0 && info.ProjectId > 0 {
287
-				p, _ := service.GetHisPrescriptionProjectByIDTwo(info.ProjectId)
288
-				if p.Type == 2 {
289
-					if p.HisProject.CostClassify == 3 {
290
-						info.MedChrgitmType = "04"
291
-					}
292
-					if p.HisProject.CostClassify == 2 {
293
-						info.MedChrgitmType = "05"
294
-					}
295
-					if p.HisProject.CostClassify == 8 {
296
-						info.MedChrgitmType = "03"
297
-					}
298
-				} else {
299
-					info.MedChrgitmType = "08"
283
+			if len(subItem.FeedetlSn) > 0 {
284
+				temp := strings.Split(subItem.FeedetlSn, "-")
285
+				var advice_id int64 = 0
286
+				var project_id int64 = 0
287
+				var types int64 = 0
288
+
289
+				id, _ := strconv.ParseInt(temp[2], 10, 64)
290
+				types, _ = strconv.ParseInt(temp[1], 10, 64)
291
+
292
+				if temp[1] == "1" {
293
+					advice_id = id
294
+					project_id = 0
295
+				} else if temp[1] == "2" {
296
+					advice_id = 0
297
+					project_id = id
298
+				}
299
+				info := &models.HisOrderInfo{
300
+					OrderNumber:      record.Number,
301
+					FeedetlSn:        subItem.FeedetlSn,
302
+					UploadDate:       recordDateTime,
303
+					AdviceId:         advice_id,
304
+					DetItemFeeSumamt: subItem.DetItemFeeSumamt,
305
+					Cnt:              subItem.Cut,
306
+					Pric:             float64(subItem.Price),
307
+					PatientId:        record.PatientId,
308
+					PricUplmtAmt:     0,
309
+					SelfpayProp:      0,
310
+					FulamtOwnpayAmt:  0,
311
+					OverlmtAmt:       0,
312
+					PreselfpayAmt:    0,
313
+					Status:           1,
314
+					Mtime:            time.Now().Unix(),
315
+					Ctime:            time.Now().Unix(),
316
+					UserOrgId:        adminUser.CurrentOrgId,
317
+					HisPatientId:     record.ID,
318
+					OrderId:          0,
319
+					ProjectId:        project_id,
320
+					Type:             types,
321
+					SettleType:       settle_accounts_type,
322
+				}
323
+				if info.AdviceId > 0 && info.ProjectId == 0 {
324
+					info.MedChrgitmType = "09"
325
+				} else if info.AdviceId == 0 && info.ProjectId > 0 {
326
+					p, _ := service.GetHisPrescriptionProjectByIDTwo(info.ProjectId)
327
+					if p.Type == 2 {
328
+						if p.HisProject.CostClassify == 3 {
329
+							info.MedChrgitmType = "04"
330
+						}
331
+						if p.HisProject.CostClassify == 2 {
332
+							info.MedChrgitmType = "05"
333
+						}
334
+						if p.HisProject.CostClassify == 8 {
335
+							info.MedChrgitmType = "03"
336
+						}
337
+					} else {
338
+						info.MedChrgitmType = "08"
300 339
 
340
+					}
301 341
 				}
342
+				service.CreateOrderInfo(info)
302 343
 			}
303
-			service.CreateOrderInfo(info)
304 344
 		}
305 345
 
306 346
 		err := service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)
@@ -319,46 +359,62 @@ func (c *HisHospitalApiController) GetUploadInfo() {
319 359
 	} else {
320 360
 
321 361
 		for _, subItem := range customs {
322
-			temp := strings.Split(subItem.FeedetlSn, "-")
323
-			var advice_id int64 = 0
324
-			var project_id int64 = 0
325
-			var types int64 = 0
326
-
327
-			id, _ := strconv.ParseInt(temp[2], 10, 64)
328
-			types, _ = strconv.ParseInt(temp[1], 10, 64)
329
-
330
-			if temp[1] == "1" {
331
-				advice_id = id
332
-				project_id = 0
333
-			} else if temp[1] == "2" {
334
-				advice_id = 0
335
-				project_id = id
362
+			if len(subItem.FeedetlSn) == 0 {
363
+				fmt.Println("1111111")
364
+				fmt.Println(subItem.FeedetlSn)
365
+				fmt.Println("1111111")
366
+
336 367
 			}
337
-			info := &models.HisOrderInfo{
338
-				OrderNumber:      record.Number,
339
-				FeedetlSn:        subItem.FeedetlSn,
340
-				UploadDate:       recordDateTime,
341
-				AdviceId:         advice_id,
342
-				DetItemFeeSumamt: subItem.DetItemFeeSumamt,
343
-				Cnt:              subItem.Cut,
344
-				Pric:             float64(subItem.Price),
345
-				PatientId:        record.PatientId,
346
-				PricUplmtAmt:     0,
347
-				SelfpayProp:      0,
348
-				FulamtOwnpayAmt:  0,
349
-				OverlmtAmt:       0,
350
-				PreselfpayAmt:    0,
351
-				Status:           1,
352
-				Mtime:            time.Now().Unix(),
353
-				Ctime:            time.Now().Unix(),
354
-				UserOrgId:        adminUser.CurrentOrgId,
355
-				HisPatientId:     record.ID,
356
-				OrderId:          0,
357
-				ProjectId:        project_id,
358
-				Type:             types,
359
-				SettleType:       settle_accounts_type,
368
+			if len(subItem.FeedetlSn) > 0 {
369
+				fmt.Println(subItem.FeedetlSn)
370
+				temp := strings.Split(subItem.FeedetlSn, "-")
371
+				var advice_id int64 = 0
372
+				var project_id int64 = 0
373
+				var types int64 = 0
374
+
375
+				fmt.Println("~~~~")
376
+
377
+				fmt.Println(temp)
378
+				fmt.Println("~~~~~")
379
+
380
+				id, _ := strconv.ParseInt(temp[2], 10, 64)
381
+				types, _ = strconv.ParseInt(temp[1], 10, 64)
382
+
383
+				if temp[1] == "1" {
384
+					advice_id = id
385
+					project_id = 0
386
+				} else if temp[1] == "2" {
387
+					advice_id = 0
388
+					project_id = id
389
+				}
390
+				info := &models.HisOrderInfo{
391
+					OrderNumber:      record.Number,
392
+					FeedetlSn:        subItem.FeedetlSn,
393
+					UploadDate:       recordDateTime,
394
+					AdviceId:         advice_id,
395
+					DetItemFeeSumamt: subItem.DetItemFeeSumamt,
396
+					Cnt:              subItem.Cut,
397
+					Pric:             float64(subItem.Price),
398
+					PatientId:        record.PatientId,
399
+					PricUplmtAmt:     0,
400
+					SelfpayProp:      0,
401
+					FulamtOwnpayAmt:  0,
402
+					OverlmtAmt:       0,
403
+					PreselfpayAmt:    0,
404
+					Status:           1,
405
+					Mtime:            time.Now().Unix(),
406
+					Ctime:            time.Now().Unix(),
407
+					UserOrgId:        adminUser.CurrentOrgId,
408
+					HisPatientId:     record.ID,
409
+					OrderId:          0,
410
+					ProjectId:        project_id,
411
+					Type:             types,
412
+					SettleType:       settle_accounts_type,
413
+				}
414
+				service.CreateOrderInfo(info)
415
+
360 416
 			}
361
-			service.CreateOrderInfo(info)
417
+
362 418
 		}
363 419
 
364 420
 		service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)