Bläddra i källkod

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

XMLWAN 3 år sedan
förälder
incheckning
98ed85ef5b
4 ändrade filer med 1248 tillägg och 417 borttagningar
  1. 1147 403
      controllers/sz/sz_his_api_controller.go
  2. 9 0
      models/his_models.go
  3. 4 1
      service/his_service.go
  4. 88 13
      service/sz_his_service.go

Filskillnaden har hållits tillbaka eftersom den är för stor
+ 1147 - 403
controllers/sz/sz_his_api_controller.go


+ 9 - 0
models/his_models.go Visa fil

@@ -117,6 +117,8 @@ type HisPatient struct {
117 117
 	IptOtpNo               string  `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
118 118
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
119 119
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
120
+	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
121
+	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
120 122
 }
121 123
 
122 124
 func (HisPatient) TableName() string {
@@ -573,6 +575,8 @@ type XtHisPatient struct {
573 575
 	IsReturn               int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
574 576
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
575 577
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
578
+	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
579
+	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
576 580
 }
577 581
 
578 582
 func (XtHisPatient) TableName() string {
@@ -656,6 +660,9 @@ type HisOrder struct {
656 660
 	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
657 661
 	SzMedicineInsuranceInfo string `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
658 662
 
663
+	MzNumber      string `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
664
+	OrgSetlNumber string `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
665
+
659 666
 	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
660 667
 	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
661 668
 	SettleEndTime   int64 `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
@@ -754,6 +761,8 @@ type VMHisPatient struct {
754 761
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
755 762
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
756 763
 	IdCardType             int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
764
+	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
765
+	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
757 766
 }
758 767
 
759 768
 func (VMHisPatient) TableName() string {

+ 4 - 1
service/his_service.go Visa fil

@@ -553,6 +553,9 @@ type HisOrder struct {
553 553
 	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
554 554
 	SzMedicineInsuranceInfo string `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
555 555
 
556
+	MzNumber      string `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
557
+	OrgSetlNumber string `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
558
+
556 559
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
557 560
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
558 561
 	HisPatient          models.HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
@@ -855,7 +858,7 @@ func GetHisOrderInfoByNumber(order_number string) (order []*models.HisOrderInfo,
855 858
 }
856 859
 
857 860
 func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
858
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND is_medicine_insurance = 1 AND settle_accounts_date <= ? AND settle_accounts_date >= ? AND insutype = ? AND clr_type = ? ", org_id, end_time, start_time, insutype, clr_type).Find(&orders).Error
861
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND is_medicine_insurance = 1 AND settle_accounts_date <= ? AND settle_accounts_date >= ? AND insutype = ?", org_id, end_time, start_time, insutype, clr_type).Find(&orders).Error
859 862
 	return
860 863
 }
861 864
 

+ 88 - 13
service/sz_his_service.go Visa fil

@@ -6,19 +6,18 @@ import (
6 6
 	"fmt"
7 7
 	"gdyb/models"
8 8
 	"io/ioutil"
9
-	"math/rand"
10 9
 	"net/http"
11 10
 	"time"
12 11
 	_ "unsafe"
13 12
 )
14 13
 
15
-func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string) string {
14
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string, other_number string) string {
16 15
 	// 生成输入报文
17 16
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
18 17
 	inputData := make(map[string]interface{})
19 18
 	inputMessage["transType"] = "MZ002" // 交易编码
20 19
 
21
-	inputData["akc190"] = serial_number
20
+	inputData["akc190"] = "202104080950121452"
22 21
 	inputData["aaz500"] = account
23 22
 	inputData["bzz269"] = "000000"
24 23
 	inputData["aka130"] = "11"
@@ -26,15 +25,17 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
26 25
 	inputData["bkc368"] = "2"
27 26
 	inputData["akc264"] = 10.00
28 27
 	inputData["listsize"] = 1
29
-
28
+	timestamp := time.Now().Unix()
29
+	tempTime := time.Unix(timestamp, 0)
30
+	timeFormat := tempTime.Format("20060102150405")
30 31
 	feedetail := make([]map[string]interface{}, 0)
31 32
 	feedetailInfo := make(map[string]interface{})
32
-	feedetailInfo["aae072"] = "202123242526272829"
33
-	feedetailInfo["bkf500"] = "202123242526272829"
33
+	feedetailInfo["aae072"] = timeFormat
34
+	feedetailInfo["bkf500"] = timeFormat
34 35
 	feedetailInfo["ake001"] = "110100002"
35 36
 	feedetailInfo["ake005"] = "110100002"
36 37
 	feedetailInfo["ake006"] = "普通门诊诊查费"
37
-	feedetailInfo["aae019"] = "10.00"
38
+	feedetailInfo["aae019"] = 10.00
38 39
 	feedetail = append(feedetail, feedetailInfo)
39 40
 	inputData["inputlist"] = feedetail
40 41
 
@@ -79,7 +80,7 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
79 80
 	inputMessage["transChannel"] = "10" // 交易编码
80 81
 
81 82
 	inputData["akc190"] = "G554020210305"
82
-	inputData["bke384"] = "G5540202103316180298"
83
+	inputData["bke384"] = serial_number
83 84
 	inputData["listsize"] = len(datas)
84 85
 
85 86
 	feedetail := make([]map[string]interface{}, 0)
@@ -196,9 +197,9 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
196 197
 	str := string(respBytes)
197 198
 	return str
198 199
 }
199
-func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string, serial_number string) string {
200
+func SzybFY004(doctor string, doctor_code string, fixmedins_code string, total float64, verify_code string, serial_number string) string {
200 201
 	// 生成输入报文
201
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, number)
202
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
202 203
 	inputData := make(map[string]interface{})
203 204
 	inputMessage["transType"] = "FY004" // 交易编码
204 205
 
@@ -253,7 +254,6 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
253 254
 	inputData["aaz500"] = account
254 255
 	inputData["bzz269"] = "000000"
255 256
 	inputData["akc190"] = "G554020210305"
256
-
257 257
 	inputData["aka130"] = "11"
258 258
 	inputData["bkc320"] = doctor_code
259 259
 	inputData["ckc350"] = doctor
@@ -297,6 +297,58 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
297 297
 	str := string(respBytes)
298 298
 	return str
299 299
 }
300
+func SzybJY001(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
301
+	// 生成输入报文
302
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
303
+	inputData := make(map[string]interface{})
304
+	inputMessage["transType"] = "JY001" // 交易编码
305
+
306
+	inputData["akc190"] = mz_number
307
+	inputData["bke384"] = setl_number
308
+
309
+	inputMessage["transBody"] = inputData
310
+	bytesData, err := json.Marshal(inputMessage)
311
+	fmt.Println(string(bytesData))
312
+	if err != nil {
313
+		fmt.Println(err.Error())
314
+		return err.Error()
315
+	}
316
+	reader := bytes.NewReader(bytesData)
317
+	//url := "http://192.168.1.99:10000"
318
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
319
+
320
+	request, err := http.NewRequest("POST", url, reader)
321
+	if err != nil {
322
+		fmt.Println(err.Error())
323
+		return err.Error()
324
+	}
325
+
326
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
327
+
328
+	client := http.Client{}
329
+	resp, err := client.Do(request)
330
+	if err != nil {
331
+		fmt.Println(err.Error())
332
+		return err.Error()
333
+	}
334
+	respBytes, err := ioutil.ReadAll(resp.Body)
335
+	if err != nil {
336
+		fmt.Println(err.Error())
337
+		return err.Error()
338
+	}
339
+	fmt.Println(string(respBytes))
340
+	str := string(respBytes)
341
+	return str
342
+}
343
+
344
+func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
345
+	// 生成输入报文
346
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
347
+	inputData := make(map[string]interface{})
348
+	inputMessage["transType"] = "JY002" // 交易编码
349
+
350
+	inputData["akc190"] = mz_number
351
+	inputData["bke384"] = setl_number
300 352
 
301 353
 //func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
302 354
 //	// 生成输入报文
@@ -386,15 +438,40 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
386 438
 //	return str
387 439
 //}
388 440
 
441
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
442
+
443
+	client := http.Client{}
444
+	resp, err := client.Do(request)
445
+	if err != nil {
446
+		fmt.Println(err.Error())
447
+		return err.Error()
448
+	}
449
+	respBytes, err := ioutil.ReadAll(resp.Body)
450
+	if err != nil {
451
+		fmt.Println(err.Error())
452
+		return err.Error()
453
+	}
454
+	fmt.Println(string(respBytes))
455
+	str := string(respBytes)
456
+	return str
457
+}
458
+func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
459
+
460
+	// 生成输入报文
461
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
462
+
389 463
 func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
390 464
 	//生成输入报文
391 465
 	inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
392 466
 
393 467
 	inputData := make(map[string]interface{})
468
+	inputMessage["transType"] = "JY003" // 交易编码
394 469
 
395 470
 	inputData["listsize"] = len(datas)
396 471
 	inputMessage["transType"] = "ML008" // 交易编码
397 472
 	feedetail := make([]map[string]interface{}, 0)
473
+	inputData["akc190"] = mz_number
474
+	inputData["bke384"] = setl_number
398 475
 
399 476
 	for _, item := range datas {
400 477
 		fmt.Println("中国222222", item.DrugDosageName)
@@ -479,8 +556,6 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
479 556
 	inputMessage["operatorCode"] = doctor_code    // 操作员编码
480 557
 	inputMessage["operatorName"] = doctor         // 操作员名字
481 558
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
482
-	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
483
-		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
484 559
 	inputMessage["serialNumber"] = number
485 560
 
486 561
 	inputMessage["transReturnCode"] = ""                                           //