csx 4 년 전
부모
커밋
a9d97903fa
4개의 변경된 파일625개의 추가작업 그리고 729개의 파일을 삭제
  1. 547 706
      controllers/sz/sz_his_api_controller.go
  2. 9 0
      models/his_models.go
  3. 4 1
      service/his_service.go
  4. 65 22
      service/sz_his_service.go

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 547 - 706
controllers/sz/sz_his_api_controller.go


+ 9 - 0
models/his_models.go 파일 보기

@@ -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 파일 보기

@@ -552,6 +552,9 @@ type HisOrder struct {
552 552
 	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
553 553
 	SzMedicineInsuranceInfo string `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
554 554
 
555
+	MzNumber      string `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
556
+	OrgSetlNumber string `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
557
+
555 558
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
556 559
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
557 560
 	HisPatient          models.HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
@@ -854,7 +857,7 @@ func GetHisOrderInfoByNumber(order_number string) (order []*models.HisOrderInfo,
854 857
 }
855 858
 
856 859
 func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
857
-	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
860
+	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
858 861
 	return
859 862
 }
860 863
 

+ 65 - 22
service/sz_his_service.go 파일 보기

@@ -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,14 +297,14 @@ 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 SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
300
+func SzybJY001(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
301 301
 	// 生成输入报文
302
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
302
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
303 303
 	inputData := make(map[string]interface{})
304
-	inputMessage["transType"] = "JY002" // 交易编码
304
+	inputMessage["transType"] = "JY001" // 交易编码
305 305
 
306
-	inputData["akc190"] = "2021033012131415"
307
-	inputData["bke384"] = number
306
+	inputData["akc190"] = mz_number
307
+	inputData["bke384"] = setl_number
308 308
 
309 309
 	inputMessage["transBody"] = inputData
310 310
 	bytesData, err := json.Marshal(inputMessage)
@@ -341,14 +341,59 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_co
341 341
 	return str
342 342
 }
343 343
 
344
-func SzybJY003(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
344
+func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
345 345
 	// 生成输入报文
346
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
346
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
347 347
 	inputData := make(map[string]interface{})
348 348
 	inputMessage["transType"] = "JY002" // 交易编码
349 349
 
350
-	inputData["akc190"] = "2021033012131415"
351
-	inputData["bke384"] = number
350
+	inputData["akc190"] = mz_number
351
+	inputData["bke384"] = setl_number
352
+
353
+	inputMessage["transBody"] = inputData
354
+	bytesData, err := json.Marshal(inputMessage)
355
+	fmt.Println(string(bytesData))
356
+	if err != nil {
357
+		fmt.Println(err.Error())
358
+		return err.Error()
359
+	}
360
+	reader := bytes.NewReader(bytesData)
361
+	//url := "http://192.168.1.99:10000"
362
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
363
+
364
+	request, err := http.NewRequest("POST", url, reader)
365
+	if err != nil {
366
+		fmt.Println(err.Error())
367
+		return err.Error()
368
+	}
369
+
370
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
371
+
372
+	client := http.Client{}
373
+	resp, err := client.Do(request)
374
+	if err != nil {
375
+		fmt.Println(err.Error())
376
+		return err.Error()
377
+	}
378
+	respBytes, err := ioutil.ReadAll(resp.Body)
379
+	if err != nil {
380
+		fmt.Println(err.Error())
381
+		return err.Error()
382
+	}
383
+	fmt.Println(string(respBytes))
384
+	str := string(respBytes)
385
+	return str
386
+}
387
+func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
388
+
389
+	// 生成输入报文
390
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
391
+
392
+	inputData := make(map[string]interface{})
393
+	inputMessage["transType"] = "JY003" // 交易编码
394
+
395
+	inputData["akc190"] = mz_number
396
+	inputData["bke384"] = setl_number
352 397
 
353 398
 	inputMessage["transBody"] = inputData
354 399
 	bytesData, err := json.Marshal(inputMessage)
@@ -410,8 +455,6 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
410 455
 	inputMessage["operatorCode"] = doctor_code    // 操作员编码
411 456
 	inputMessage["operatorName"] = doctor         // 操作员名字
412 457
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
413
-	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
414
-		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
415 458
 	inputMessage["serialNumber"] = number
416 459
 
417 460
 	inputMessage["transReturnCode"] = ""                                           //