瀏覽代碼

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 年之前
父節點
當前提交
c5c7e61ba5
共有 3 個文件被更改,包括 131 次插入52 次删除
  1. 101 41
      controllers/his_api_controller.go
  2. 10 0
      models/his_models.go
  3. 20 11
      service/his_service.go

+ 101 - 41
controllers/his_api_controller.go 查看文件

1254
 	id, _ := c.GetInt64("id")
1254
 	id, _ := c.GetInt64("id")
1255
 	record_time := c.GetString("record_time")
1255
 	record_time := c.GetString("record_time")
1256
 
1256
 
1257
+	name := c.GetString("name")
1258
+	gender, _ := c.GetInt64("gender")
1259
+	age, _ := c.GetInt64("age")
1260
+	birthday := c.GetString("birthday")
1261
+	phone := c.GetString("phone")
1262
+	medical_care, _ := c.GetInt64("medical_care")
1263
+	id_card := c.GetString("id_card")
1264
+	register_type, _ := c.GetInt64("register_type")
1265
+	registration_fee, _ := c.GetFloat("registration_fee")
1266
+	medical_expenses, _ := c.GetFloat("medical_expenses")
1267
+	certificates, _ := c.GetInt64("certificates")
1268
+	settlementValue, _ := c.GetInt64("settlement_value")
1269
+	social_type, _ := c.GetInt64("social_type")
1270
+	medical_insurance_card := c.GetString("medical_insurance_card")
1257
 	timeLayout := "2006-01-02"
1271
 	timeLayout := "2006-01-02"
1258
 	loc, _ := time.LoadLocation("Local")
1272
 	loc, _ := time.LoadLocation("Local")
1273
+	birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
1274
+	birthUnix := birthdays.Unix()
1259
 
1275
 
1260
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1276
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1261
 	if err != nil {
1277
 	if err != nil {
1454
 		}
1470
 		}
1455
 
1471
 
1456
 	} else {
1472
 	} else {
1473
+		timeStr := time.Now().Format("2006-01-02")
1474
+		timeArr := strings.Split(timeStr, "-")
1475
+		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
1457
 
1476
 
1458
 		his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1477
 		his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1478
+		var hisPatient models.XtHisPatient
1459
 		if err == gorm.ErrRecordNotFound || his.ID == 0 {
1479
 		if err == gorm.ErrRecordNotFound || his.ID == 0 {
1460
-			patient := models.XtHisPatient{
1461
-				Age:         patient.Age,
1462
-				Birthday:    patient.Birthday,
1463
-				AdminUserId: adminInfo.AdminUser.Id,
1464
-				IdCardNo:    patient.IdCardNo,
1465
-				Name:        patient.Name,
1466
-				Gender:      patient.Gender,
1467
-				UserOrgId:   adminInfo.CurrentOrgId,
1468
-				Status:      1,
1469
-				RecordDate:  recordDateTime,
1470
-				IsReturn:    1,
1471
-				PatientId:   patient.ID,
1472
-				Ctime:       time.Now().Unix(),
1473
-				Mtime:       time.Now().Unix(),
1480
+			hisPatient = models.XtHisPatient{
1481
+				Name:                   name,
1482
+				Age:                    age,
1483
+				Gender:                 gender,
1484
+				Birthday:               birthUnix,
1485
+				Phone:                  phone,
1486
+				MedicalTreatmentType:   medical_care,
1487
+				IdType:                 certificates,
1488
+				IdCardNo:               id_card,
1489
+				BalanceAccountsType:    settlementValue,
1490
+				SocialType:             social_type,
1491
+				MedicalInsuranceNumber: medical_insurance_card,
1492
+				RegisterType:           register_type,
1493
+				RegisterCost:           registration_fee,
1494
+				TreatmentCost:          medical_expenses,
1495
+				AdminUserId:            adminInfo.AdminUser.Id,
1496
+				UserOrgId:              adminInfo.CurrentOrgId,
1497
+				Status:                 1,
1498
+				RecordDate:             recordDateTime,
1499
+				IsReturn:               1,
1500
+				PatientId:              patient.ID,
1501
+				Ctime:                  time.Now().Unix(),
1502
+				Mtime:                  time.Now().Unix(),
1503
+				Number:                 str,
1474
 			}
1504
 			}
1475
-			service.CreateHisPatient(&patient)
1505
+			service.CreateHisPatient(&hisPatient)
1506
+
1476
 		}
1507
 		}
1477
 		c.ServeSuccessJSON(map[string]interface{}{
1508
 		c.ServeSuccessJSON(map[string]interface{}{
1478
-			"his_info": patient,
1509
+			"his_info": hisPatient,
1479
 		})
1510
 		})
1480
 
1511
 
1481
 	}
1512
 	}
1486
 func (c *HisApiController) GetUploadInfo() {
1517
 func (c *HisApiController) GetUploadInfo() {
1487
 	id, _ := c.GetInt64("id")
1518
 	id, _ := c.GetInt64("id")
1488
 	record_time := c.GetString("record_time")
1519
 	record_time := c.GetString("record_time")
1520
+
1521
+	pay_way, _ := c.GetInt64("pay_way")
1522
+	pay_price, _ := c.GetFloat("pay_price")
1523
+	pay_card_no := c.GetString("pay_card_no")
1524
+	discount_price, _ := c.GetFloat("discount_price")
1525
+	preferential_price, _ := c.GetFloat("preferential_price")
1526
+	reality_price, _ := c.GetFloat("reality_price")
1527
+	found_price, _ := c.GetFloat("found_price")
1528
+	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1529
+	private_price, _ := c.GetFloat("private_price")
1530
+
1489
 	timeLayout := "2006-01-02"
1531
 	timeLayout := "2006-01-02"
1490
 	loc, _ := time.LoadLocation("Local")
1532
 	loc, _ := time.LoadLocation("Local")
1491
 
1533
 
1560
 
1602
 
1561
 		if res.Infcode == 0 {
1603
 		if res.Infcode == 0 {
1562
 			order := &models.HisOrder{
1604
 			order := &models.HisOrder{
1563
-				UserOrgId:          adminUser.CurrentOrgId,
1564
-				HisPatientId:       his.ID,
1565
-				PatientId:          his.PatientId,
1566
-				SettleAccountsDate: recordDateTime,
1567
-				Ctime:              time.Now().Unix(),
1568
-				Mtime:              time.Now().Unix(),
1569
-				Status:             1,
1570
-				Number:             chrg_bchno,
1571
-				Infcode:            res.Infcode,
1572
-				WarnMsg:            res.WarnMsg,
1573
-				Cainfo:             res.Cainfo,
1574
-				ErrMsg:             res.ErrMsg,
1575
-				RespondTime:        res.RefmsgTime,
1576
-				InfRefmsgid:        res.InfRefmsgid,
1577
-				OrderStatus:        1,
1605
+				UserOrgId:             adminUser.CurrentOrgId,
1606
+				HisPatientId:          his.ID,
1607
+				PatientId:             his.PatientId,
1608
+				SettleAccountsDate:    recordDateTime,
1609
+				Ctime:                 time.Now().Unix(),
1610
+				Mtime:                 time.Now().Unix(),
1611
+				Status:                1,
1612
+				Number:                chrg_bchno,
1613
+				Infcode:               res.Infcode,
1614
+				WarnMsg:               res.WarnMsg,
1615
+				Cainfo:                res.Cainfo,
1616
+				ErrMsg:                res.ErrMsg,
1617
+				RespondTime:           res.RefmsgTime,
1618
+				InfRefmsgid:           res.InfRefmsgid,
1619
+				OrderStatus:           1,
1620
+				PayWay:                pay_way,
1621
+				PayPrice:              pay_price,
1622
+				PayCardNo:             pay_card_no,
1623
+				DiscountPrice:         discount_price,
1624
+				PreferentialPrice:     preferential_price,
1625
+				RealityPrice:          reality_price,
1626
+				FoundPrice:            found_price,
1627
+				MedicalInsurancePrice: medical_insurance_price,
1628
+				PrivatePrice:          private_price,
1578
 			}
1629
 			}
1579
 			err = service.CreateOrder(order)
1630
 			err = service.CreateOrder(order)
1580
 			if err != nil {
1631
 			if err != nil {
1788
 		allTotal := fmt.Sprintf("%.2f", total)
1839
 		allTotal := fmt.Sprintf("%.2f", total)
1789
 		totals, _ := strconv.ParseFloat(allTotal, 64)
1840
 		totals, _ := strconv.ParseFloat(allTotal, 64)
1790
 		order := &models.HisOrder{
1841
 		order := &models.HisOrder{
1791
-			UserOrgId:          adminUser.CurrentOrgId,
1792
-			HisPatientId:       his.ID,
1793
-			PatientId:          id,
1794
-			SettleAccountsDate: recordDateTime,
1795
-			Ctime:              time.Now().Unix(),
1796
-			Mtime:              time.Now().Unix(),
1797
-			Status:             1,
1798
-			OrderStatus:        2,
1799
-			Number:             chrg_bchno,
1800
-			MedfeeSumamt:       totals,
1842
+			UserOrgId:             adminUser.CurrentOrgId,
1843
+			HisPatientId:          his.ID,
1844
+			PatientId:             id,
1845
+			SettleAccountsDate:    recordDateTime,
1846
+			Ctime:                 time.Now().Unix(),
1847
+			Mtime:                 time.Now().Unix(),
1848
+			Status:                1,
1849
+			OrderStatus:           2,
1850
+			Number:                chrg_bchno,
1851
+			MedfeeSumamt:          totals,
1852
+			PayWay:                pay_way,
1853
+			PayPrice:              pay_price,
1854
+			PayCardNo:             pay_card_no,
1855
+			DiscountPrice:         discount_price,
1856
+			PreferentialPrice:     preferential_price,
1857
+			RealityPrice:          reality_price,
1858
+			FoundPrice:            found_price,
1859
+			MedicalInsurancePrice: medical_insurance_price,
1860
+			PrivatePrice:          private_price,
1801
 		}
1861
 		}
1802
 		err = service.CreateOrder(order)
1862
 		err = service.CreateOrder(order)
1803
 		if err != nil {
1863
 		if err != nil {

+ 10 - 0
models/his_models.go 查看文件

619
 	ClrType            string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
619
 	ClrType            string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
620
 	SetlDetail         string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
620
 	SetlDetail         string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
621
 
621
 
622
+	PayWay                int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
623
+	PayPrice              float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
624
+	PayCardNo             string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
625
+	DiscountPrice         float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
626
+	PreferentialPrice     float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
627
+	RealityPrice          float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
628
+	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
629
+	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
630
+	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
631
+
622
 	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
632
 	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
623
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
633
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
624
 	HisPatient          HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
634
 	HisPatient          HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`

+ 20 - 11
service/his_service.go 查看文件

458
 }
458
 }
459
 
459
 
460
 type HisOrder struct {
460
 type HisOrder struct {
461
-	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
462
-	UserOrgId          int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
463
-	HisPatientId       int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
464
-	SettleAccountsDate int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
465
-	Ctime              int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
466
-	Mtime              int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
467
-	Status             int64   `gorm:"column:status" json:"status" form:"status"`
468
-	Number             string  `gorm:"column:number" json:"number" form:"number"`
469
-	PatientId          int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
470
-	MedfeeSumamt       float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
471
-	OrderStatus        float64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
461
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
462
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
463
+	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
464
+	SettleAccountsDate    int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
465
+	Ctime                 int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
466
+	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
467
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
468
+	Number                string  `gorm:"column:number" json:"number" form:"number"`
469
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
470
+	MedfeeSumamt          float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
471
+	OrderStatus           float64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
472
+	PayWay                int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
473
+	PayPrice              float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
474
+	PayCardNo             string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
475
+	DiscountPrice         float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
476
+	PreferentialPrice     float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
477
+	RealityPrice          float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
478
+	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
479
+	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
480
+	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
472
 
481
 
473
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
482
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
474
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
483
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`