Bladeren bron

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 jaren geleden
bovenliggende
commit
fa68eb7860
1 gewijzigde bestanden met toevoegingen van 287 en 289 verwijderingen
  1. 287 289
      controllers/zh/zh_his_api_controller.go

+ 287 - 289
controllers/zh/zh_his_api_controller.go Bestand weergeven

@@ -1,7 +1,6 @@
1 1
 package zh
2 2
 
3 3
 import (
4
-	"bytes"
5 4
 	"encoding/json"
6 5
 	"fmt"
7 6
 	"gdyb/controllers"
@@ -10,8 +9,6 @@ import (
10 9
 	"gdyb/service"
11 10
 	"gdyb/utils"
12 11
 	"github.com/astaxie/beego"
13
-	"io/ioutil"
14
-	"math"
15 12
 	"math/rand"
16 13
 	"net/http"
17 14
 	"strconv"
@@ -1390,12 +1387,12 @@ func (c *ZHHisApiController) GetUploadInfo() {
1390 1387
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1391 1388
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1392 1389
 
1393
-		var pagesize int = 100
1394
-		var start int = 1
1395
-		var stop int
1396
-		var pagecount int
1397
-		var curpage int
1398
-		var isSuccess bool = true
1390
+		//var pagesize int = 100
1391
+		//var start int = 1
1392
+		//var stop int
1393
+		//var pagecount int
1394
+		//var curpage int
1395
+		//var isSuccess bool = true
1399 1396
 
1400 1397
 		var customs []*models.NewCustom
1401 1398
 
@@ -1454,287 +1451,288 @@ func (c *ZHHisApiController) GetUploadInfo() {
1454 1451
 				}
1455 1452
 			}
1456 1453
 
1457
-			for _, subItem := range item.HisAdditionalCharge {
1458
-				if len(subItem.XtHisAddtionConfig.Code) > 0 {
1459
-					cus := &models.NewCustom{
1460
-						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
1461
-						Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
1462
-						FeedetlSn:        subItem.FeedetlSn,
1463
-						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
1464
-						MedListCodg:      subItem.XtHisAddtionConfig.Code,
1465
-						HospApprFlag:     -1,
1466
-					}
1467
-					customs = append(customs, cus)
1468
-				}
1469
-			}
1470
-		}
1471
-
1472
-		//总页数,向上取整,注意除之前要先转换类型为float64
1473
-		pagecount = int(math.Ceil(float64(len(customs)) / float64(pagesize)))
1474
-		var ress []*ResultFour
1475
-		for curpage = 1; curpage <= pagecount; curpage++ {
1476
-			if curpage == 1 {
1477
-				start = 1
1478
-			} else {
1479
-				start = (curpage-1)*pagesize + 1
1480
-			}
1481
-			stop = curpage * pagesize
1482
-			if stop > len(customs) {
1483
-				stop = len(customs)
1484
-			}
1485
-
1486
-			data["pre"] = customs[start-1 : stop]
1487
-			bytesData, _ := json.Marshal(data)
1488
-			req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/zh/five", bytes.NewReader(bytesData))
1489
-			resp, _ := client.Do(req)
1490
-			defer resp.Body.Close()
1491
-			body, ioErr := ioutil.ReadAll(resp.Body)
1492
-			if ioErr != nil {
1493
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1494
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1495
-				return
1496
-			}
1497
-			var respJSON map[string]interface{}
1498
-			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1499
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1500
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1501
-				return
1502
-			}
1503
-
1504
-			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1505
-			userJSONBytes, _ := json.Marshal(respJSON)
1506
-			var res ResultFour
1507
-			var resFour10265 ResultFour10265
1508
-			if miConfig.Code == "H15049901371" {
1509
-				if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
1510
-					utils.ErrorLog("解析失败:%v", err)
1511
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1512
-					return
1513
-				}
1514
-				res.WarnMsg = resFour10265.WarnMsg
1515
-				res.Output = resFour10265.Output
1516
-				res.ErrMsg = resFour10265.ErrMsg
1517
-				res.RespondTime = resFour10265.RespondTime
1518
-				res.InfRefmsgid = resFour10265.InfRefmsgid
1519
-				Infcode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
1520
-				res.Infcode = Infcode
1521
-
1522
-			} else {
1523
-				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1524
-					utils.ErrorLog("解析失败:%v", err)
1525
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1526
-					return
1527
-				}
1528
-			}
1529
-
1530
-			if res.Infcode == 0 {
1531
-				ress = append(ress, &res)
1532
-			} else {
1533
-				isSuccess = false
1534
-				errlog := &models.HisOrderError{
1535
-					UserOrgId:  adminUser.CurrentOrgId,
1536
-					Ctime:      time.Now().Unix(),
1537
-					Mtime:      time.Now().Unix(),
1538
-					Number:     chrg_bchno,
1539
-					ErrMsg:     "",
1540
-					Status:     1,
1541
-					PatientId:  id,
1542
-					RecordTime: recordDateTime,
1543
-					Stage:      4,
1544
-				}
1545
-				service.CreateErrMsgLog(errlog)
1546
-				c.ServeSuccessJSON(map[string]interface{}{
1547
-					"failed_code": -10,
1548
-					"msg":         "上传明细错误,请联系his厂商",
1549
-				})
1550
-				return
1551
-			}
1552
-		}
1553
-
1554
-		if isSuccess == true {
1555
-			if settle_accounts_type == 1 {
1556
-				for _, subItem := range ress {
1557
-					for _, item := range subItem.Output.Result {
1558
-						temp := strings.Split(item.FeedetlSn, "-")
1559
-						var advice_id int64 = 0
1560
-						var project_id int64 = 0
1561
-						var types int64 = 0
1562
-
1563
-						id, _ := strconv.ParseInt(temp[2], 10, 64)
1564
-						types, _ = strconv.ParseInt(temp[1], 10, 64)
1565
-
1566
-						if temp[1] == "1" {
1567
-							advice_id = id
1568
-							project_id = 0
1569
-						} else if temp[1] == "2" {
1570
-							advice_id = 0
1571
-							project_id = id
1572
-						}
1573
-						info := &models.HisOrderInfo{
1574
-							OrderNumber:      record.Number,
1575
-							FeedetlSn:        item.FeedetlSn,
1576
-							UploadDate:       time.Now().Unix(),
1577
-							AdviceId:         advice_id,
1578
-							DetItemFeeSumamt: item.DetItemFeeSumamt,
1579
-							Cnt:              item.Cnt,
1580
-							Pric:             float64(item.Pric),
1581
-							PatientId:        record.PatientId,
1582
-							PricUplmtAmt:     item.PricUplmtAmt,
1583
-							SelfpayProp:      item.SelfpayProp,
1584
-							FulamtOwnpayAmt:  item.FulamtOwnpayAmt,
1585
-							OverlmtAmt:       item.OverlmtAmt,
1586
-							PreselfpayAmt:    item.PreselfpayAmt,
1587
-							BasMednFlag:      item.BasMednFlag,
1588
-							MedChrgitmType:   item.MedChrgitmType,
1589
-							HiNegoDrugFlag:   item.HiNegoDrugFlag,
1590
-							Status:           1,
1591
-							Memo:             item.Memo,
1592
-							Mtime:            time.Now().Unix(),
1593
-							InscpScpAmt:      item.InscpScpAmt,
1594
-							DrtReimFlag:      item.DrtReimFlag,
1595
-							Ctime:            time.Now().Unix(),
1596
-							ListSpItemFlag:   item.ListSpItemFlag,
1597
-							ChldMedcFlag:     item.ChldMedcFlag,
1598
-							LmtUsedFlag:      item.LmtUsedFlag,
1599
-							ChrgitmLv:        item.ChrgitmLv,
1600
-							UserOrgId:        adminUser.CurrentOrgId,
1601
-							HisPatientId:     record.ID,
1602
-							OrderId:          0,
1603
-							ProjectId:        project_id,
1604
-							Type:             types,
1605
-							SettleType:       settle_accounts_type,
1606
-						}
1607
-						service.CreateOrderInfo(info)
1608
-					}
1609
-				}
1610
-				err := service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)
1611
-				if err == nil {
1612
-					c.ServeSuccessJSON(map[string]interface{}{
1613
-						"msg": "上传费用明细成功",
1614
-					})
1615
-					return
1616
-				} else {
1617
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1618
-					return
1619
-				}
1620
-
1621
-			} else {
1622
-				var total float64
1623
-				for _, item := range prescriptions {
1624
-					if item.Type == 1 { //药品
1625
-						for _, subItem := range item.HisDoctorAdviceInfo {
1626
-							total = total + (subItem.Price * subItem.PrescribingNumber)
1627
-						}
1628
-					}
1629
-					if item.Type == 2 { //项目
1630
-						for _, subItem := range item.HisPrescriptionProject {
1631
-							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
1632
-							total = total + (subItem.Price * cnt)
1633
-						}
1634
-					}
1635
-				}
1636
-				for _, item := range prescriptions {
1637
-					for _, subItem := range item.HisAdditionalCharge {
1638
-						total = total + (subItem.Price * float64(subItem.Count))
1639
-					}
1640
-				}
1641
-				allTotal := fmt.Sprintf("%.2f", total)
1642
-				totals, _ := strconv.ParseFloat(allTotal, 64)
1643
-
1644
-				order := &models.HisOrder{
1645
-					UserOrgId:           adminUser.CurrentOrgId,
1646
-					HisPatientId:        record.ID,
1647
-					PatientId:           record.PatientId,
1648
-					SettleAccountsDate:  recordDateTime,
1649
-					Ctime:               time.Now().Unix(),
1650
-					Mtime:               time.Now().Unix(),
1651
-					Status:              1,
1652
-					Number:              record.Number,
1653
-					Infcode:             0,
1654
-					WarnMsg:             "",
1655
-					Cainfo:              "",
1656
-					ErrMsg:              "",
1657
-					RespondTime:         "",
1658
-					InfRefmsgid:         "",
1659
-					OrderStatus:         1,
1660
-					MdtrtId:             record.Number,
1661
-					IsMedicineInsurance: 1,
1662
-					SettleType:          settle_accounts_type,
1663
-					SettleStartTime:     start_time,
1664
-					SettleEndTime:       end_time,
1665
-					Creator:             roles.AdminUserId,
1666
-					Modify:              roles.AdminUserId,
1667
-					PType:               1,
1668
-					MedfeeSumamt:        totals,
1669
-				}
1670
-				err = service.CreateOrder(order)
1671
-				if err != nil {
1672
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
1673
-					return
1674
-				}
1675
-				for _, subItem := range ress {
1676
-					for _, item := range subItem.Output.Result {
1677
-						temp := strings.Split(item.FeedetlSn, "-")
1678
-						var advice_id int64 = 0
1679
-						var project_id int64 = 0
1680
-						var types int64 = 0
1681
-
1682
-						id, _ := strconv.ParseInt(temp[2], 10, 64)
1683
-						types, _ = strconv.ParseInt(temp[1], 10, 64)
1684
-
1685
-						if temp[1] == "1" {
1686
-							advice_id = id
1687
-							project_id = 0
1688
-						} else if temp[1] == "2" {
1689
-							advice_id = 0
1690
-							project_id = id
1691
-						}
1692
-						info := &models.HisOrderInfo{
1693
-							OrderNumber:      order.Number,
1694
-							FeedetlSn:        item.FeedetlSn,
1695
-							UploadDate:       time.Now().Unix(),
1696
-							AdviceId:         advice_id,
1697
-							DetItemFeeSumamt: item.DetItemFeeSumamt,
1698
-							Cnt:              item.Cnt,
1699
-							Pric:             float64(item.Pric),
1700
-							PatientId:        record.PatientId,
1701
-							PricUplmtAmt:     item.PricUplmtAmt,
1702
-							SelfpayProp:      item.SelfpayProp,
1703
-							FulamtOwnpayAmt:  item.FulamtOwnpayAmt,
1704
-							OverlmtAmt:       item.OverlmtAmt,
1705
-							PreselfpayAmt:    item.PreselfpayAmt,
1706
-							BasMednFlag:      item.BasMednFlag,
1707
-							MedChrgitmType:   item.MedChrgitmType,
1708
-							HiNegoDrugFlag:   item.HiNegoDrugFlag,
1709
-							Status:           1,
1710
-							Memo:             item.Memo,
1711
-							Mtime:            time.Now().Unix(),
1712
-							InscpScpAmt:      item.InscpScpAmt,
1713
-							DrtReimFlag:      item.DrtReimFlag,
1714
-							Ctime:            time.Now().Unix(),
1715
-							ListSpItemFlag:   item.ListSpItemFlag,
1716
-							ChldMedcFlag:     item.ChldMedcFlag,
1717
-							LmtUsedFlag:      item.LmtUsedFlag,
1718
-							ChrgitmLv:        item.ChrgitmLv,
1719
-							UserOrgId:        adminUser.CurrentOrgId,
1720
-							HisPatientId:     record.ID,
1721
-							OrderId:          order.ID,
1722
-							ProjectId:        project_id,
1723
-							Type:             types,
1724
-							SettleType:       settle_accounts_type,
1725
-						}
1726
-						service.CreateOrderInfo(info)
1727
-					}
1728
-				}
1729
-				service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, record.Number)
1730
-				service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, record.Number, recordDateTime)
1731
-				c.ServeSuccessJSON(map[string]interface{}{
1732
-					"msg": "上传费用明细成功",
1733
-				})
1734
-
1735
-			}
1736
-
1454
+			//for _, subItem := range item.HisAdditionalCharge {
1455
+			//	if len(subItem.XtHisAddtionConfig.Code) > 0 {
1456
+			//		cus := &models.NewCustom{
1457
+			//			DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
1458
+			//			Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
1459
+			//			FeedetlSn:        subItem.FeedetlSn,
1460
+			//			Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
1461
+			//			MedListCodg:      subItem.XtHisAddtionConfig.Code,
1462
+			//			HospApprFlag:     -1,
1463
+			//		}
1464
+			//		customs = append(customs, cus)
1465
+			//	}
1466
+			//}
1737 1467
 		}
1468
+		fmt.Println(customs)
1469
+
1470
+		////总页数,向上取整,注意除之前要先转换类型为float64
1471
+		//pagecount = int(math.Ceil(float64(len(customs)) / float64(pagesize)))
1472
+		//var ress []*ResultFour
1473
+		//for curpage = 1; curpage <= pagecount; curpage++ {
1474
+		//	if curpage == 1 {
1475
+		//		start = 1
1476
+		//	} else {
1477
+		//		start = (curpage-1)*pagesize + 1
1478
+		//	}
1479
+		//	stop = curpage * pagesize
1480
+		//	if stop > len(customs) {
1481
+		//		stop = len(customs)
1482
+		//	}
1483
+		//
1484
+		//	data["pre"] = customs[start-1 : stop]
1485
+		//	bytesData, _ := json.Marshal(data)
1486
+		//	req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/zh/five", bytes.NewReader(bytesData))
1487
+		//	resp, _ := client.Do(req)
1488
+		//	defer resp.Body.Close()
1489
+		//	body, ioErr := ioutil.ReadAll(resp.Body)
1490
+		//	if ioErr != nil {
1491
+		//		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1492
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1493
+		//		return
1494
+		//	}
1495
+		//	var respJSON map[string]interface{}
1496
+		//	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1497
+		//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1498
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1499
+		//		return
1500
+		//	}
1501
+		//
1502
+		//	respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1503
+		//	userJSONBytes, _ := json.Marshal(respJSON)
1504
+		//	var res ResultFour
1505
+		//	var resFour10265 ResultFour10265
1506
+		//	if miConfig.Code == "H15049901371" {
1507
+		//		if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
1508
+		//			utils.ErrorLog("解析失败:%v", err)
1509
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1510
+		//			return
1511
+		//		}
1512
+		//		res.WarnMsg = resFour10265.WarnMsg
1513
+		//		res.Output = resFour10265.Output
1514
+		//		res.ErrMsg = resFour10265.ErrMsg
1515
+		//		res.RespondTime = resFour10265.RespondTime
1516
+		//		res.InfRefmsgid = resFour10265.InfRefmsgid
1517
+		//		Infcode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
1518
+		//		res.Infcode = Infcode
1519
+		//
1520
+		//	} else {
1521
+		//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1522
+		//			utils.ErrorLog("解析失败:%v", err)
1523
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1524
+		//			return
1525
+		//		}
1526
+		//	}
1527
+		//
1528
+		//	if res.Infcode == 0 {
1529
+		//		ress = append(ress, &res)
1530
+		//	} else {
1531
+		//		isSuccess = false
1532
+		//		errlog := &models.HisOrderError{
1533
+		//			UserOrgId:  adminUser.CurrentOrgId,
1534
+		//			Ctime:      time.Now().Unix(),
1535
+		//			Mtime:      time.Now().Unix(),
1536
+		//			Number:     chrg_bchno,
1537
+		//			ErrMsg:     "",
1538
+		//			Status:     1,
1539
+		//			PatientId:  id,
1540
+		//			RecordTime: recordDateTime,
1541
+		//			Stage:      4,
1542
+		//		}
1543
+		//		service.CreateErrMsgLog(errlog)
1544
+		//		c.ServeSuccessJSON(map[string]interface{}{
1545
+		//			"failed_code": -10,
1546
+		//			"msg":         "上传明细错误,请联系his厂商",
1547
+		//		})
1548
+		//		return
1549
+		//	}
1550
+		//}
1551
+		//
1552
+		//if isSuccess == true {
1553
+		//	if settle_accounts_type == 1 {
1554
+		//		for _, subItem := range ress {
1555
+		//			for _, item := range subItem.Output.Result {
1556
+		//				temp := strings.Split(item.FeedetlSn, "-")
1557
+		//				var advice_id int64 = 0
1558
+		//				var project_id int64 = 0
1559
+		//				var types int64 = 0
1560
+		//
1561
+		//				id, _ := strconv.ParseInt(temp[2], 10, 64)
1562
+		//				types, _ = strconv.ParseInt(temp[1], 10, 64)
1563
+		//
1564
+		//				if temp[1] == "1" {
1565
+		//					advice_id = id
1566
+		//					project_id = 0
1567
+		//				} else if temp[1] == "2" {
1568
+		//					advice_id = 0
1569
+		//					project_id = id
1570
+		//				}
1571
+		//				info := &models.HisOrderInfo{
1572
+		//					OrderNumber:      record.Number,
1573
+		//					FeedetlSn:        item.FeedetlSn,
1574
+		//					UploadDate:       time.Now().Unix(),
1575
+		//					AdviceId:         advice_id,
1576
+		//					DetItemFeeSumamt: item.DetItemFeeSumamt,
1577
+		//					Cnt:              item.Cnt,
1578
+		//					Pric:             float64(item.Pric),
1579
+		//					PatientId:        record.PatientId,
1580
+		//					PricUplmtAmt:     item.PricUplmtAmt,
1581
+		//					SelfpayProp:      item.SelfpayProp,
1582
+		//					FulamtOwnpayAmt:  item.FulamtOwnpayAmt,
1583
+		//					OverlmtAmt:       item.OverlmtAmt,
1584
+		//					PreselfpayAmt:    item.PreselfpayAmt,
1585
+		//					BasMednFlag:      item.BasMednFlag,
1586
+		//					MedChrgitmType:   item.MedChrgitmType,
1587
+		//					HiNegoDrugFlag:   item.HiNegoDrugFlag,
1588
+		//					Status:           1,
1589
+		//					Memo:             item.Memo,
1590
+		//					Mtime:            time.Now().Unix(),
1591
+		//					InscpScpAmt:      item.InscpScpAmt,
1592
+		//					DrtReimFlag:      item.DrtReimFlag,
1593
+		//					Ctime:            time.Now().Unix(),
1594
+		//					ListSpItemFlag:   item.ListSpItemFlag,
1595
+		//					ChldMedcFlag:     item.ChldMedcFlag,
1596
+		//					LmtUsedFlag:      item.LmtUsedFlag,
1597
+		//					ChrgitmLv:        item.ChrgitmLv,
1598
+		//					UserOrgId:        adminUser.CurrentOrgId,
1599
+		//					HisPatientId:     record.ID,
1600
+		//					OrderId:          0,
1601
+		//					ProjectId:        project_id,
1602
+		//					Type:             types,
1603
+		//					SettleType:       settle_accounts_type,
1604
+		//				}
1605
+		//				service.CreateOrderInfo(info)
1606
+		//			}
1607
+		//		}
1608
+		//		err := service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)
1609
+		//		if err == nil {
1610
+		//			c.ServeSuccessJSON(map[string]interface{}{
1611
+		//				"msg": "上传费用明细成功",
1612
+		//			})
1613
+		//			return
1614
+		//		} else {
1615
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1616
+		//			return
1617
+		//		}
1618
+		//
1619
+		//	} else {
1620
+		//		var total float64
1621
+		//		for _, item := range prescriptions {
1622
+		//			if item.Type == 1 { //药品
1623
+		//				for _, subItem := range item.HisDoctorAdviceInfo {
1624
+		//					total = total + (subItem.Price * subItem.PrescribingNumber)
1625
+		//				}
1626
+		//			}
1627
+		//			if item.Type == 2 { //项目
1628
+		//				for _, subItem := range item.HisPrescriptionProject {
1629
+		//					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
1630
+		//					total = total + (subItem.Price * cnt)
1631
+		//				}
1632
+		//			}
1633
+		//		}
1634
+		//		for _, item := range prescriptions {
1635
+		//			for _, subItem := range item.HisAdditionalCharge {
1636
+		//				total = total + (subItem.Price * float64(subItem.Count))
1637
+		//			}
1638
+		//		}
1639
+		//		allTotal := fmt.Sprintf("%.2f", total)
1640
+		//		totals, _ := strconv.ParseFloat(allTotal, 64)
1641
+		//
1642
+		//		order := &models.HisOrder{
1643
+		//			UserOrgId:           adminUser.CurrentOrgId,
1644
+		//			HisPatientId:        record.ID,
1645
+		//			PatientId:           record.PatientId,
1646
+		//			SettleAccountsDate:  recordDateTime,
1647
+		//			Ctime:               time.Now().Unix(),
1648
+		//			Mtime:               time.Now().Unix(),
1649
+		//			Status:              1,
1650
+		//			Number:              record.Number,
1651
+		//			Infcode:             0,
1652
+		//			WarnMsg:             "",
1653
+		//			Cainfo:              "",
1654
+		//			ErrMsg:              "",
1655
+		//			RespondTime:         "",
1656
+		//			InfRefmsgid:         "",
1657
+		//			OrderStatus:         1,
1658
+		//			MdtrtId:             record.Number,
1659
+		//			IsMedicineInsurance: 1,
1660
+		//			SettleType:          settle_accounts_type,
1661
+		//			SettleStartTime:     start_time,
1662
+		//			SettleEndTime:       end_time,
1663
+		//			Creator:             roles.AdminUserId,
1664
+		//			Modify:              roles.AdminUserId,
1665
+		//			PType:               1,
1666
+		//			MedfeeSumamt:        totals,
1667
+		//		}
1668
+		//		err = service.CreateOrder(order)
1669
+		//		if err != nil {
1670
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
1671
+		//			return
1672
+		//		}
1673
+		//		for _, subItem := range ress {
1674
+		//			for _, item := range subItem.Output.Result {
1675
+		//				temp := strings.Split(item.FeedetlSn, "-")
1676
+		//				var advice_id int64 = 0
1677
+		//				var project_id int64 = 0
1678
+		//				var types int64 = 0
1679
+		//
1680
+		//				id, _ := strconv.ParseInt(temp[2], 10, 64)
1681
+		//				types, _ = strconv.ParseInt(temp[1], 10, 64)
1682
+		//
1683
+		//				if temp[1] == "1" {
1684
+		//					advice_id = id
1685
+		//					project_id = 0
1686
+		//				} else if temp[1] == "2" {
1687
+		//					advice_id = 0
1688
+		//					project_id = id
1689
+		//				}
1690
+		//				info := &models.HisOrderInfo{
1691
+		//					OrderNumber:      order.Number,
1692
+		//					FeedetlSn:        item.FeedetlSn,
1693
+		//					UploadDate:       time.Now().Unix(),
1694
+		//					AdviceId:         advice_id,
1695
+		//					DetItemFeeSumamt: item.DetItemFeeSumamt,
1696
+		//					Cnt:              item.Cnt,
1697
+		//					Pric:             float64(item.Pric),
1698
+		//					PatientId:        record.PatientId,
1699
+		//					PricUplmtAmt:     item.PricUplmtAmt,
1700
+		//					SelfpayProp:      item.SelfpayProp,
1701
+		//					FulamtOwnpayAmt:  item.FulamtOwnpayAmt,
1702
+		//					OverlmtAmt:       item.OverlmtAmt,
1703
+		//					PreselfpayAmt:    item.PreselfpayAmt,
1704
+		//					BasMednFlag:      item.BasMednFlag,
1705
+		//					MedChrgitmType:   item.MedChrgitmType,
1706
+		//					HiNegoDrugFlag:   item.HiNegoDrugFlag,
1707
+		//					Status:           1,
1708
+		//					Memo:             item.Memo,
1709
+		//					Mtime:            time.Now().Unix(),
1710
+		//					InscpScpAmt:      item.InscpScpAmt,
1711
+		//					DrtReimFlag:      item.DrtReimFlag,
1712
+		//					Ctime:            time.Now().Unix(),
1713
+		//					ListSpItemFlag:   item.ListSpItemFlag,
1714
+		//					ChldMedcFlag:     item.ChldMedcFlag,
1715
+		//					LmtUsedFlag:      item.LmtUsedFlag,
1716
+		//					ChrgitmLv:        item.ChrgitmLv,
1717
+		//					UserOrgId:        adminUser.CurrentOrgId,
1718
+		//					HisPatientId:     record.ID,
1719
+		//					OrderId:          order.ID,
1720
+		//					ProjectId:        project_id,
1721
+		//					Type:             types,
1722
+		//					SettleType:       settle_accounts_type,
1723
+		//				}
1724
+		//				service.CreateOrderInfo(info)
1725
+		//			}
1726
+		//		}
1727
+		//		service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, record.Number)
1728
+		//		service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, record.Number, recordDateTime)
1729
+		//		c.ServeSuccessJSON(map[string]interface{}{
1730
+		//			"msg": "上传费用明细成功",
1731
+		//		})
1732
+		//
1733
+		//	}
1734
+		//
1735
+		//}
1738 1736
 
1739 1737
 	}
1740 1738
 }