ソースを参照

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

XMLWAN 4 年 前
コミット
14d6844bb5
共有5 個のファイルを変更した294 個の追加168 個の削除を含む
  1. 42 9
      controllers/gdyb_controller.go
  2. 116 45
      controllers/his_api_controller.go
  3. 24 11
      models/his_models.go
  4. 92 92
      service/gdyb_service.go
  5. 20 11
      service/his_service.go

+ 42 - 9
controllers/gdyb_controller.go ファイルの表示

@@ -72,7 +72,12 @@ func (c *GdybController) PostOne() {
72 72
 	doctor := c.GetString("doctor")
73 73
 	fixmedins_code := c.GetString("fixmedins_code")
74 74
 
75
-	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code)
75
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
76
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
77
+
78
+	secret_key := c.GetString("secret_key")
79
+
80
+	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
76 81
 
77 82
 	var dat map[string]interface{}
78 83
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -94,7 +99,15 @@ func (c *GdybController) PostTwo() {
94 99
 	dept := c.GetString("dept")
95 100
 	fixmedins_code := c.GetString("fixmedins_code")
96 101
 
97
-	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code)
102
+	dept_code := c.GetString("dept_code")
103
+	doctor_id := c.GetString("doctor_id")
104
+
105
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
106
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
107
+
108
+	secret_key := c.GetString("secret_key")
109
+
110
+	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key)
98 111
 
99 112
 	var dat map[string]interface{}
100 113
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -113,8 +126,12 @@ func (c *GdybController) PostThree() {
113 126
 	iptOtpNo := c.GetString("ipt_otp_no")
114 127
 	org_name := c.GetString("org_name")
115 128
 	doctor := c.GetString("doctor")
129
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
130
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
116 131
 
117
-	result := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor)
132
+	secret_key := c.GetString("secret_key")
133
+
134
+	result := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key)
118 135
 	c.ServeSuccessJSON(map[string]interface{}{
119 136
 		"pre": result,
120 137
 	})
@@ -131,7 +148,12 @@ func (c *GdybController) PostFour() {
131 148
 	doctor_id, _ := c.GetInt64("doctor_id", 0)
132 149
 	fixmedins_code := c.GetString("fixmedins_code")
133 150
 
134
-	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code)
151
+	diag_code := c.GetString("diag_code")
152
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
153
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
154
+	secret_key := c.GetString("secret_key")
155
+
156
+	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
135 157
 	var dat map[string]interface{}
136 158
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
137 159
 	} else {
@@ -179,7 +201,8 @@ func (c *GdybController) PostFive() {
179 201
 		return
180 202
 	}
181 203
 
182
-	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string), respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string))
204
+	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
205
+		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string))
183 206
 
184 207
 	var dat map[string]interface{}
185 208
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -199,7 +222,12 @@ func (c *GdybController) PostSix() {
199 222
 	org_name := c.GetString("org_name")
200 223
 	doctor := c.GetString("doctor")
201 224
 
202
-	result := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor)
225
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
226
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
227
+
228
+	secret_key := c.GetString("secret_key")
229
+
230
+	result := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key)
203 231
 
204 232
 	c.ServeSuccessJSON(map[string]interface{}{
205 233
 		"pre": result,
@@ -215,8 +243,9 @@ func (c *GdybController) PostSeven() {
215 243
 	total := c.GetString("total")
216 244
 	org_name := c.GetString("org_name")
217 245
 	doctor := c.GetString("doctor")
246
+	secret_key := c.GetString("secret_key")
218 247
 
219
-	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor)
248
+	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, secret_key)
220 249
 	var dat map[string]interface{}
221 250
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
222 251
 		fmt.Println(dat)
@@ -238,8 +267,11 @@ func (c *GdybController) PostEight() {
238 267
 	org_name := c.GetString("org_name")
239 268
 	doctor := c.GetString("doctor")
240 269
 	fixmedins_code := c.GetString("fixmedins_code")
270
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
271
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
272
+	secret_key := c.GetString("secret_key")
241 273
 
242
-	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code)
274
+	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
243 275
 	var dat map[string]interface{}
244 276
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
245 277
 		fmt.Println(dat)
@@ -258,8 +290,9 @@ func (c *GdybController) PostNine() {
258 290
 	setlId := c.GetString("setl_id")
259 291
 	org_name := c.GetString("org_name")
260 292
 	doctor := c.GetString("doctor")
293
+	secret_key := c.GetString("secret_key")
261 294
 
262
-	result := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor)
295
+	result := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key)
263 296
 	c.ServeSuccessJSON(map[string]interface{}{
264 297
 		"pre": result,
265 298
 	})

+ 116 - 45
controllers/his_api_controller.go ファイルの表示

@@ -1258,8 +1258,24 @@ func (c *HisApiController) GetRegisterInfo() {
1258 1258
 	id, _ := c.GetInt64("id")
1259 1259
 	record_time := c.GetString("record_time")
1260 1260
 
1261
+	name := c.GetString("name")
1262
+	gender, _ := c.GetInt64("gender")
1263
+	age, _ := c.GetInt64("age")
1264
+	birthday := c.GetString("birthday")
1265
+	phone := c.GetString("phone")
1266
+	medical_care, _ := c.GetInt64("medical_care")
1267
+	id_card := c.GetString("id_card")
1268
+	register_type, _ := c.GetInt64("register_type")
1269
+	registration_fee, _ := c.GetFloat("registration_fee")
1270
+	medical_expenses, _ := c.GetFloat("medical_expenses")
1271
+	certificates, _ := c.GetInt64("certificates")
1272
+	settlementValue, _ := c.GetInt64("settlement_value")
1273
+	social_type, _ := c.GetInt64("social_type")
1274
+	medical_insurance_card := c.GetString("medical_insurance_card")
1261 1275
 	timeLayout := "2006-01-02"
1262 1276
 	loc, _ := time.LoadLocation("Local")
1277
+	birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
1278
+	birthUnix := birthdays.Unix()
1263 1279
 
1264 1280
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1265 1281
 	if err != nil {
@@ -1288,7 +1304,7 @@ func (c *HisApiController) GetRegisterInfo() {
1288 1304
 
1289 1305
 	if config.IsOpen == 1 {
1290 1306
 
1291
-		api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code
1307
+		api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1292 1308
 		resp, requestErr := http.Get(api)
1293 1309
 
1294 1310
 		if requestErr != nil {
@@ -1354,11 +1370,14 @@ func (c *HisApiController) GetRegisterInfo() {
1354 1370
 
1355 1371
 		department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
1356 1372
 
1373
+		//department_id := strconv.FormatInt(department.ID, 10)
1374
+		doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
1375
+
1357 1376
 		if count <= 0 {
1358 1377
 			api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
1359 1378
 				res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
1360 1379
 				"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
1361
-				"&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code
1380
+				"&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code + "&dept_code=" + department.Number + "&doctor_id=" + doctor_id + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1362 1381
 			resp, requestErr := http.Get(api)
1363 1382
 			if requestErr != nil {
1364 1383
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -1412,7 +1431,8 @@ func (c *HisApiController) GetRegisterInfo() {
1412 1431
 			if err == nil {
1413 1432
 				api := "http://127.0.0.1:9531/" + "gdyb/four?psn_no=" + his.PsnNo +
1414 1433
 					"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
1415
-					"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code
1434
+					"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
1435
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1416 1436
 				resp, requestErr := http.Get(api)
1417 1437
 				if requestErr != nil {
1418 1438
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -1458,27 +1478,43 @@ func (c *HisApiController) GetRegisterInfo() {
1458 1478
 		}
1459 1479
 
1460 1480
 	} else {
1481
+		timeStr := time.Now().Format("2006-01-02")
1482
+		timeArr := strings.Split(timeStr, "-")
1483
+		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
1484
+
1461 1485
 		his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1486
+		var hisPatient models.XtHisPatient
1462 1487
 		if err == gorm.ErrRecordNotFound || his.ID == 0 {
1463
-			patient := models.XtHisPatient{
1464
-				Age:         patient.Age,
1465
-				Birthday:    patient.Birthday,
1466
-				AdminUserId: adminInfo.AdminUser.Id,
1467
-				IdCardNo:    patient.IdCardNo,
1468
-				Name:        patient.Name,
1469
-				Gender:      patient.Gender,
1470
-				UserOrgId:   adminInfo.CurrentOrgId,
1471
-				Status:      1,
1472
-				RecordDate:  recordDateTime,
1473
-				IsReturn:    1,
1474
-				PatientId:   patient.ID,
1475
-				Ctime:       time.Now().Unix(),
1476
-				Mtime:       time.Now().Unix(),
1488
+			hisPatient = models.XtHisPatient{
1489
+				Name:                   name,
1490
+				Age:                    age,
1491
+				Gender:                 gender,
1492
+				Birthday:               birthUnix,
1493
+				Phone:                  phone,
1494
+				MedicalTreatmentType:   medical_care,
1495
+				IdType:                 certificates,
1496
+				IdCardNo:               id_card,
1497
+				BalanceAccountsType:    settlementValue,
1498
+				SocialType:             social_type,
1499
+				MedicalInsuranceNumber: medical_insurance_card,
1500
+				RegisterType:           register_type,
1501
+				RegisterCost:           registration_fee,
1502
+				TreatmentCost:          medical_expenses,
1503
+				AdminUserId:            adminInfo.AdminUser.Id,
1504
+				UserOrgId:              adminInfo.CurrentOrgId,
1505
+				Status:                 1,
1506
+				RecordDate:             recordDateTime,
1507
+				IsReturn:               1,
1508
+				PatientId:              patient.ID,
1509
+				Ctime:                  time.Now().Unix(),
1510
+				Mtime:                  time.Now().Unix(),
1511
+				Number:                 str,
1477 1512
 			}
1478
-			service.CreateHisPatient(&patient)
1513
+			service.CreateHisPatient(&hisPatient)
1514
+
1479 1515
 		}
1480 1516
 		c.ServeSuccessJSON(map[string]interface{}{
1481
-			"his_info": patient,
1517
+			"his_info": hisPatient,
1482 1518
 		})
1483 1519
 
1484 1520
 	}
@@ -1489,6 +1525,17 @@ func (c *HisApiController) GetRegisterInfo() {
1489 1525
 func (c *HisApiController) GetUploadInfo() {
1490 1526
 	id, _ := c.GetInt64("id")
1491 1527
 	record_time := c.GetString("record_time")
1528
+
1529
+	pay_way, _ := c.GetInt64("pay_way")
1530
+	pay_price, _ := c.GetFloat("pay_price")
1531
+	pay_card_no := c.GetString("pay_card_no")
1532
+	discount_price, _ := c.GetFloat("discount_price")
1533
+	preferential_price, _ := c.GetFloat("preferential_price")
1534
+	reality_price, _ := c.GetFloat("reality_price")
1535
+	found_price, _ := c.GetFloat("found_price")
1536
+	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1537
+	private_price, _ := c.GetFloat("private_price")
1538
+
1492 1539
 	timeLayout := "2006-01-02"
1493 1540
 	loc, _ := time.LoadLocation("Local")
1494 1541
 
@@ -1512,7 +1559,9 @@ func (c *HisApiController) GetUploadInfo() {
1512 1559
 
1513 1560
 	//org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1514 1561
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1562
+	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
1515 1563
 
1564
+	strconv.FormatInt(his.PatientId, 10)
1516 1565
 	client := &http.Client{}
1517 1566
 	data := make(map[string]interface{})
1518 1567
 	data["psn_no"] = his.PsnNo
@@ -1524,6 +1573,10 @@ func (c *HisApiController) GetUploadInfo() {
1524 1573
 	data["dept"] = patientPrescription.Departments
1525 1574
 
1526 1575
 	data["fixmedins_code"] = miConfig.Code
1576
+	data["dept_code"] = department.Number
1577
+	data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
1578
+	data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
1579
+	data["secret_key"] = miConfig.SecretKey
1527 1580
 
1528 1581
 	var ids []int64
1529 1582
 	//var idsTwo []int64
@@ -1563,21 +1616,30 @@ func (c *HisApiController) GetUploadInfo() {
1563 1616
 
1564 1617
 		if res.Infcode == 0 {
1565 1618
 			order := &models.HisOrder{
1566
-				UserOrgId:          adminUser.CurrentOrgId,
1567
-				HisPatientId:       his.ID,
1568
-				PatientId:          his.PatientId,
1569
-				SettleAccountsDate: recordDateTime,
1570
-				Ctime:              time.Now().Unix(),
1571
-				Mtime:              time.Now().Unix(),
1572
-				Status:             1,
1573
-				Number:             chrg_bchno,
1574
-				Infcode:            res.Infcode,
1575
-				WarnMsg:            res.WarnMsg,
1576
-				Cainfo:             res.Cainfo,
1577
-				ErrMsg:             res.ErrMsg,
1578
-				RespondTime:        res.RefmsgTime,
1579
-				InfRefmsgid:        res.InfRefmsgid,
1580
-				OrderStatus:        1,
1619
+				UserOrgId:             adminUser.CurrentOrgId,
1620
+				HisPatientId:          his.ID,
1621
+				PatientId:             his.PatientId,
1622
+				SettleAccountsDate:    recordDateTime,
1623
+				Ctime:                 time.Now().Unix(),
1624
+				Mtime:                 time.Now().Unix(),
1625
+				Status:                1,
1626
+				Number:                chrg_bchno,
1627
+				Infcode:               res.Infcode,
1628
+				WarnMsg:               res.WarnMsg,
1629
+				Cainfo:                res.Cainfo,
1630
+				ErrMsg:                res.ErrMsg,
1631
+				RespondTime:           res.RefmsgTime,
1632
+				InfRefmsgid:           res.InfRefmsgid,
1633
+				OrderStatus:           1,
1634
+				PayWay:                pay_way,
1635
+				PayPrice:              pay_price,
1636
+				PayCardNo:             pay_card_no,
1637
+				DiscountPrice:         discount_price,
1638
+				PreferentialPrice:     preferential_price,
1639
+				RealityPrice:          reality_price,
1640
+				FoundPrice:            found_price,
1641
+				MedicalInsurancePrice: medical_insurance_price,
1642
+				PrivatePrice:          private_price,
1581 1643
 			}
1582 1644
 			err = service.CreateOrder(order)
1583 1645
 			if err != nil {
@@ -1665,7 +1727,7 @@ func (c *HisApiController) GetUploadInfo() {
1665 1727
 				insutype := rf[0].Insutype
1666 1728
 				api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1667 1729
 					insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1668
-					"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code
1730
+					"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1669 1731
 				resp, requestErr := http.Get(api)
1670 1732
 
1671 1733
 				if requestErr != nil {
@@ -1791,16 +1853,25 @@ func (c *HisApiController) GetUploadInfo() {
1791 1853
 		allTotal := fmt.Sprintf("%.2f", total)
1792 1854
 		totals, _ := strconv.ParseFloat(allTotal, 64)
1793 1855
 		order := &models.HisOrder{
1794
-			UserOrgId:          adminUser.CurrentOrgId,
1795
-			HisPatientId:       his.ID,
1796
-			PatientId:          id,
1797
-			SettleAccountsDate: recordDateTime,
1798
-			Ctime:              time.Now().Unix(),
1799
-			Mtime:              time.Now().Unix(),
1800
-			Status:             1,
1801
-			OrderStatus:        2,
1802
-			Number:             chrg_bchno,
1803
-			MedfeeSumamt:       totals,
1856
+			UserOrgId:             adminUser.CurrentOrgId,
1857
+			HisPatientId:          his.ID,
1858
+			PatientId:             id,
1859
+			SettleAccountsDate:    recordDateTime,
1860
+			Ctime:                 time.Now().Unix(),
1861
+			Mtime:                 time.Now().Unix(),
1862
+			Status:                1,
1863
+			OrderStatus:           2,
1864
+			Number:                chrg_bchno,
1865
+			MedfeeSumamt:          totals,
1866
+			PayWay:                pay_way,
1867
+			PayPrice:              pay_price,
1868
+			PayCardNo:             pay_card_no,
1869
+			DiscountPrice:         discount_price,
1870
+			PreferentialPrice:     preferential_price,
1871
+			RealityPrice:          reality_price,
1872
+			FoundPrice:            found_price,
1873
+			MedicalInsurancePrice: medical_insurance_price,
1874
+			PrivatePrice:          private_price,
1804 1875
 		}
1805 1876
 		err = service.CreateOrder(order)
1806 1877
 		if err != nil {

+ 24 - 11
models/his_models.go ファイルの表示

@@ -622,6 +622,16 @@ type HisOrder struct {
622 622
 	ClrType            string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
623 623
 	SetlDetail         string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
624 624
 
625
+	PayWay                int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
626
+	PayPrice              float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
627
+	PayCardNo             string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
628
+	DiscountPrice         float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
629
+	PreferentialPrice     float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
630
+	RealityPrice          float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
631
+	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
632
+	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
633
+	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
634
+
625 635
 	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
626 636
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
627 637
 	HisPatient          HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
@@ -748,17 +758,20 @@ func (HisOrderError) TableName() string {
748 758
 }
749 759
 
750 760
 type MedicalInsuranceOrgConfig struct {
751
-	ID            int64  `gorm:"column:id" json:"id" form:"id"`
752
-	Code          string `gorm:"column:code" json:"code" form:"code"`
753
-	OrgName       string `gorm:"column:org_name" json:"org_name" form:"org_name"`
754
-	Vpn           string `gorm:"column:vpn" json:"vpn" form:"vpn"`
755
-	EleCardId     string `gorm:"column:ele_card_id" json:"ele_card_id" form:"ele_card_id"`
756
-	EleCardKey    string `gorm:"column:ele_card_key" json:"ele_card_key" form:"ele_card_key"`
757
-	ChannelNumber string `gorm:"column:channel_number" json:"channel_number" form:"channel_number"`
758
-	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
759
-	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
760
-	Status        int64  `gorm:"column:status" json:"status" form:"status"`
761
-	UserOrgId     int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
761
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
762
+	Code           string `gorm:"column:code" json:"code" form:"code"`
763
+	OrgName        string `gorm:"column:org_name" json:"org_name" form:"org_name"`
764
+	Vpn            string `gorm:"column:vpn" json:"vpn" form:"vpn"`
765
+	EleCardId      string `gorm:"column:ele_card_id" json:"ele_card_id" form:"ele_card_id"`
766
+	EleCardKey     string `gorm:"column:ele_card_key" json:"ele_card_key" form:"ele_card_key"`
767
+	ChannelNumber  string `gorm:"column:channel_number" json:"channel_number" form:"channel_number"`
768
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
769
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
770
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
771
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
772
+	MdtrtareaAdmvs string `gorm:"column:mdtrtarea_admvs" json:"mdtrtarea_admvs" form:"mdtrtarea_admvs"`
773
+	InsuplcAdmdvs  string `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
774
+	SecretKey      string `gorm:"column:secret_key" json:"secret_key" form:"secret_key"`
762 775
 }
763 776
 
764 777
 func (MedicalInsuranceOrgConfig) TableName() string {

+ 92 - 92
service/gdyb_service.go ファイルの表示

@@ -20,14 +20,14 @@ const (
20 20
 )
21 21
 
22 22
 // 人员基本信息
23
-func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code string) string {
23
+func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
24 24
 	// 生成签名
25 25
 	nonce := GetRandomString(32)
26 26
 	timestamp := time.Now().Unix()
27
-	signature := setSignature(timestamp, nonce)
27
+	signature := setSignature(timestamp, nonce, secret_key)
28 28
 
29 29
 	// 生成输入报文
30
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
30
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
31 31
 	input := make(map[string]interface{})
32 32
 	inputData := make(map[string]interface{})
33 33
 	inputMessage["infno"] = "1101"      // 交易编码
@@ -79,16 +79,16 @@ func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
79 79
 }
80 80
 
81 81
 // 门诊挂号
82
-func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string, fixmedins_code string) string {
82
+func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
83 83
 	// 生成签名
84 84
 	nonce := GetRandomString(32)
85 85
 	timestamp := time.Now().Unix()
86
-	signature := setSignature(timestamp, nonce)
86
+	signature := setSignature(timestamp, nonce, secret_key)
87 87
 	tempTime := time.Unix(timestamp, 0)
88 88
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
89 89
 
90 90
 	// 生成输入报文
91
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
91
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
92 92
 	input := make(map[string]interface{})
93 93
 	inputData := make(map[string]interface{})
94 94
 	inputMessage["infno"] = "2201"        // 交易编码
@@ -98,9 +98,9 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
98 98
 	inputData["mdtrt_cert_type"] = "02"   // 就诊凭证类型
99 99
 	inputData["mdtrt_cert_no"] = certNo   // 就诊凭证编号
100 100
 	inputData["ipt_otp_no"] = ipt_otp_no  // 住院/门诊号
101
-	inputData["atddr_no"] = "1002"        // 医师编码
101
+	inputData["atddr_no"] = doctor_id     // 医师编码
102 102
 	inputData["dr_name"] = doctor         // 医师姓名
103
-	inputData["dept_code"] = "3002"       // 科室编码
103
+	inputData["dept_code"] = dept_code    // 科室编码
104 104
 	inputData["dept_name"] = dept         // 科室名称
105 105
 	inputData["caty"] = "A03.06"          // 科别
106 106
 
@@ -145,14 +145,14 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
145 145
 }
146 146
 
147 147
 // 门诊挂号撤销
148
-func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string) string {
148
+func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
149 149
 	// 生成签名
150 150
 	nonce := GetRandomString(32)
151 151
 	timestamp := time.Now().Unix()
152
-	signature := setSignature(timestamp, nonce)
152
+	signature := setSignature(timestamp, nonce, secret_key)
153 153
 
154 154
 	// 生成输入报文
155
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
155
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "", insuplc_admdvs, mdtrtarea_admvs)
156 156
 	input := make(map[string]interface{})
157 157
 	inputData := make(map[string]interface{})
158 158
 	inputMessage["infno"] = "2202"       // 交易编码
@@ -201,16 +201,16 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
201 201
 }
202 202
 
203 203
 // 门诊就诊信息上传
204
-func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string) string {
204
+func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
205 205
 	// 生成签名
206 206
 	nonce := GetRandomString(32)
207 207
 	timestamp := time.Now().Unix()
208
-	signature := setSignature(timestamp, nonce)
208
+	signature := setSignature(timestamp, nonce, secret_key)
209 209
 	tempTime := time.Unix(timestamp, 0)
210 210
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
211 211
 
212 212
 	// 生成输入报文
213
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
213
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
214 214
 	input := make(map[string]interface{})
215 215
 	inputData := make(map[string]interface{})
216 216
 	diseinfo := make([]map[string]interface{}, 0)
@@ -229,7 +229,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
229 229
 	diseinfo_sun := make(map[string]interface{})
230 230
 	diseinfo_sun["diag_type"] = "1"           // 诊断类别
231 231
 	diseinfo_sun["diag_srt_no"] = "1"         // 诊断排序号
232
-	diseinfo_sun["diag_code"] = "A04.902"     // 诊断代码
232
+	diseinfo_sun["diag_code"] = diag_code     // 诊断代码
233 233
 	diseinfo_sun["diag_name"] = diag          // 诊断名称
234 234
 	diseinfo_sun["diag_dept"] = department    // 诊断科室
235 235
 	diseinfo_sun["dise_dor_no"] = doctor_id   // 诊断医生编码
@@ -334,11 +334,11 @@ type Result struct {
334 334
 }
335 335
 
336 336
 //  门诊费用明细信息上传
337
-func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string) string {
337
+func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
338 338
 	// 生成签名
339 339
 	nonce := GetRandomString(32)
340 340
 	timestamp := time.Now().Unix()
341
-	signature := setSignature(timestamp, nonce)
341
+	signature := setSignature(timestamp, nonce, secret_key)
342 342
 	tempTime := time.Unix(timestamp, 0)
343 343
 	//timeFormat := tempTime.Format("20060102150405")
344 344
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
@@ -398,7 +398,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
398 398
 	}
399 399
 
400 400
 	// 生成输入报文
401
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
401
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
402 402
 	input := make(map[string]interface{})
403 403
 	feedetail := make([]map[string]interface{}, 0)
404 404
 	inputMessage["infno"] = "2204" // 交易编码
@@ -423,9 +423,9 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
423 423
 		feedetailInfo["used_frqu_dscr"] = ""                         // 使用频次描述
424 424
 		feedetailInfo["prd_days"] = "0"                              // 周期天数
425 425
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
426
-		feedetailInfo["bilg_dept_codg"] = "3002"                     // 开单科室编码
426
+		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
427 427
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
428
-		feedetailInfo["bilg_dr_codg"] = "1002"                       // 开单医生编码
428
+		feedetailInfo["bilg_dr_codg"] = doctor_id                    // 开单医生编码
429 429
 		feedetailInfo["bilg_dr_name"] = doctor                       // 开单医师姓名
430 430
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
431 431
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
@@ -484,14 +484,14 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
484 484
 }
485 485
 
486 486
 //  门诊费用明细信息撤销
487
-func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string) string {
487
+func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
488 488
 	// 生成签名
489 489
 	nonce := GetRandomString(32)
490 490
 	timestamp := time.Now().Unix()
491
-	signature := setSignature(timestamp, nonce)
491
+	signature := setSignature(timestamp, nonce, secret_key)
492 492
 
493 493
 	// 生成输入报文
494
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
494
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "", insuplc_admdvs, mdtrtarea_admvs)
495 495
 	input := make(map[string]interface{})
496 496
 	inputData := make(map[string]interface{})
497 497
 	inputMessage["infno"] = "2205" // 交易编码
@@ -544,14 +544,14 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
544 544
 }
545 545
 
546 546
 //  门诊预结算
547
-func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string) string {
547
+func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
548 548
 	// 生成签名
549 549
 	nonce := GetRandomString(32)
550 550
 	timestamp := time.Now().Unix()
551
-	signature := setSignature(timestamp, nonce)
551
+	signature := setSignature(timestamp, nonce, secret_key)
552 552
 
553 553
 	// 生成输入报文
554
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
554
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "", "", "")
555 555
 	input := make(map[string]interface{})
556 556
 	inputData := make(map[string]interface{})
557 557
 	inputMessage["infno"] = "2206" // 交易编码
@@ -608,14 +608,14 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
608 608
 }
609 609
 
610 610
 //  门诊结算
611
-func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string) string {
611
+func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
612 612
 	// 生成签名
613 613
 	nonce := GetRandomString(32)
614 614
 	timestamp := time.Now().Unix()
615
-	signature := setSignature(timestamp, nonce)
615
+	signature := setSignature(timestamp, nonce, secret_key)
616 616
 
617 617
 	// 生成输入报文
618
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
618
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
619 619
 	input := make(map[string]interface{})
620 620
 	inputData := make(map[string]interface{})
621 621
 	inputMessage["infno"] = "2207" // 交易编码
@@ -673,14 +673,14 @@ func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
673 673
 }
674 674
 
675 675
 //  门诊结算撤销
676
-func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string) string {
676
+func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string) string {
677 677
 	// 生成签名
678 678
 	nonce := GetRandomString(32)
679 679
 	timestamp := time.Now().Unix()
680
-	signature := setSignature(timestamp, nonce)
680
+	signature := setSignature(timestamp, nonce, secret_key)
681 681
 
682 682
 	// 生成输入报文
683
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
683
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "", "", "")
684 684
 	input := make(map[string]interface{})
685 685
 	inputData := make(map[string]interface{})
686 686
 	inputMessage["infno"] = "2208" // 交易编码
@@ -924,8 +924,8 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
924 924
 //}
925 925
 
926 926
 // 生成签名
927
-func setSignature(timestamp int64, nonce string) string {
928
-	str := strconv.FormatInt(timestamp, 10) + SceretKey + nonce + strconv.FormatInt(timestamp, 10)
927
+func setSignature(timestamp int64, nonce string, secret_key string) string {
928
+	str := strconv.FormatInt(timestamp, 10) + secret_key + nonce + strconv.FormatInt(timestamp, 10)
929 929
 	hash := sha256.New()
930 930
 	//输入数据
931 931
 	hash.Write([]byte(str))
@@ -950,7 +950,7 @@ func GetRandomString(l int) string {
950 950
 }
951 951
 
952 952
 // 生成基础报文
953
-func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string) map[string]interface{} {
953
+func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) map[string]interface{} {
954 954
 	// 生成签名
955 955
 	tempTime := time.Unix(timestamp, 0)
956 956
 	timeFormat := tempTime.Format("20060102150405")
@@ -962,8 +962,8 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
962 962
 
963 963
 	inputMessage["infno"] = "1101"                                                              // 交易编码
964 964
 	inputMessage["msgid"] = fixmedins_code + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
965
-	inputMessage["mdtrtarea_admvs"] = "440200"                                                  // 就医地医保区划
966
-	inputMessage["insuplc_admdvs"] = "440200"                                                   // 参保地医保区划
965
+	inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs                                           // 就医地医保区划
966
+	inputMessage["insuplc_admdvs"] = insuplc_admdvs                                             // 参保地医保区划
967 967
 	inputMessage["recer_sys_code"] = "01"                                                       // 接收方系统代码
968 968
 	inputMessage["dev_no"] = ""                                                                 // 设备编号
969 969
 	inputMessage["dev_safe_info"] = ""                                                          // 设备安全信息
@@ -971,7 +971,7 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
971 971
 	inputMessage["signtype"] = ""                                                               // 签名类型
972 972
 	inputMessage["infver"] = "V1.1"                                                             // 接收方系统代码
973 973
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
974
-	inputMessage["opter"] = "mockuser"                                                          // 经办人
974
+	inputMessage["opter"] = doctor                                                              // 经办人
975 975
 	inputMessage["opter_name"] = doctor                                                         // 经办人姓名
976 976
 	inputMessage["inf_time"] = timeFormatOne                                                    // 交易时间
977 977
 	inputMessage["fixmedins_code"] = fixmedins_code                                             // 定点医药机构编号
@@ -980,57 +980,57 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
980 980
 	return inputMessage
981 981
 }
982 982
 
983
-func Gdyb1201(psnNo string, org_name string, doctor string) string {
984
-	// 生成签名
985
-	nonce := GetRandomString(32)
986
-	timestamp := time.Now().Unix()
987
-	signature := setSignature(timestamp, nonce)
988
-
989
-	// 生成输入报文
990
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
991
-	input := make(map[string]interface{})
992
-	inputData := make(map[string]interface{})
993
-	inputMessage["infno"] = "1201"         // 交易编码
994
-	inputData["fixmedins_type"] = psnNo    // 人员编号 (来自1101接口返回)
995
-	inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
996
-	inputData["fixmedins_code"] = ""       // 人员编号 (来自1101接口返回)
997
-
998
-	input["medinsinfo"] = inputData
999
-	inputMessage["input"] = input //交易输入
1000
-
1001
-	bytesData, err := json.Marshal(inputMessage)
1002
-	fmt.Println(string(bytesData))
1003
-	if err != nil {
1004
-		fmt.Println(err.Error())
1005
-		return err.Error()
1006
-	}
1007
-	reader := bytes.NewReader(bytesData)
1008
-
1009
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
1010
-	request, err := http.NewRequest("POST", url, reader)
1011
-	if err != nil {
1012
-		fmt.Println(err.Error())
1013
-		return err.Error()
1014
-	}
1015
-
1016
-	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1017
-	request.Header.Set("x-tif-paasid", "test_hosp")
1018
-	request.Header.Set("x-tif-signature", signature)
1019
-	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1020
-	request.Header.Set("x-tif-nonce", nonce)
1021
-
1022
-	client := http.Client{}
1023
-	resp, err := client.Do(request)
1024
-	if err != nil {
1025
-		fmt.Println(err.Error())
1026
-		return err.Error()
1027
-	}
1028
-	respBytes, err := ioutil.ReadAll(resp.Body)
1029
-	if err != nil {
1030
-		fmt.Println(err.Error())
1031
-		return err.Error()
1032
-	}
1033
-	str := string(respBytes)
1034
-	fmt.Println(str)
1035
-	return str
1036
-}
983
+//func Gdyb1201(psnNo string, org_name string, doctor string) string {
984
+//	// 生成签名
985
+//	nonce := GetRandomString(32)
986
+//	timestamp := time.Now().Unix()
987
+//	signature := setSignature(timestamp, nonce)
988
+//
989
+//	// 生成输入报文
990
+//	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
991
+//	input := make(map[string]interface{})
992
+//	inputData := make(map[string]interface{})
993
+//	inputMessage["infno"] = "1201"         // 交易编码
994
+//	inputData["fixmedins_type"] = psnNo    // 人员编号 (来自1101接口返回)
995
+//	inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
996
+//	inputData["fixmedins_code"] = ""       // 人员编号 (来自1101接口返回)
997
+//
998
+//	input["medinsinfo"] = inputData
999
+//	inputMessage["input"] = input //交易输入
1000
+//
1001
+//	bytesData, err := json.Marshal(inputMessage)
1002
+//	fmt.Println(string(bytesData))
1003
+//	if err != nil {
1004
+//		fmt.Println(err.Error())
1005
+//		return err.Error()
1006
+//	}
1007
+//	reader := bytes.NewReader(bytesData)
1008
+//
1009
+//	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
1010
+//	request, err := http.NewRequest("POST", url, reader)
1011
+//	if err != nil {
1012
+//		fmt.Println(err.Error())
1013
+//		return err.Error()
1014
+//	}
1015
+//
1016
+//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1017
+//	request.Header.Set("x-tif-paasid", "test_hosp")
1018
+//	request.Header.Set("x-tif-signature", signature)
1019
+//	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1020
+//	request.Header.Set("x-tif-nonce", nonce)
1021
+//
1022
+//	client := http.Client{}
1023
+//	resp, err := client.Do(request)
1024
+//	if err != nil {
1025
+//		fmt.Println(err.Error())
1026
+//		return err.Error()
1027
+//	}
1028
+//	respBytes, err := ioutil.ReadAll(resp.Body)
1029
+//	if err != nil {
1030
+//		fmt.Println(err.Error())
1031
+//		return err.Error()
1032
+//	}
1033
+//	str := string(respBytes)
1034
+//	fmt.Println(str)
1035
+//	return str
1036
+//}

+ 20 - 11
service/his_service.go ファイルの表示

@@ -458,17 +458,26 @@ func UpDatePrescriptionInfoNumber(user_org_id int64, id int64, number string, re
458 458
 }
459 459
 
460 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 482
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
474 483
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`