浏览代码

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

csx 3 年前
父节点
当前提交
657c84617f
共有 7 个文件被更改,包括 302 次插入89 次删除
  1. 5 5
      conf/app.conf
  2. 125 28
      controllers/js/jsyb_controller.go
  3. 109 50
      controllers/sg/his_api_controller.go
  4. 1 0
      models/his_models.go
  5. 6 2
      service/gdyb_service.go
  6. 7 1
      service/hbyb_service.go
  7. 49 3
      service/jsyb_service.go

+ 5 - 5
conf/app.conf 查看文件

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 10106
48
+org_id = 10138
49
 mobile_token_expiration_second = 86400
49
 mobile_token_expiration_second = 86400
50
 httpdomain = https://api.xt.kuyicloud.com
50
 httpdomain = https://api.xt.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
53
 front_end_domain = "https://xt.kuyicloud.com/#"
53
 front_end_domain = "https://xt.kuyicloud.com/#"
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
-# gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
56
+# gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
+gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58
 #内蒙古
58
 #内蒙古
59
 # gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
59
 # gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60
 # gdyb_paasid = "sg03_prd"
60
 # gdyb_paasid = "sg03_prd"
61
-gdyb_paasid = "jm_sc_yjyy"
61
+# gdyb_paasid = "jm_sc_yjyy"
62
 # gdyb_paasid="zh_prd_yrojyy"
62
 # gdyb_paasid="zh_prd_yrojyy"
63
-# gdyb_paasid = "sz_prd_yjyy"
63
+gdyb_paasid = "sz_prd_yjyy"
64
 # gdyb_paasid = "zq_prd_yjyy"
64
 # gdyb_paasid = "zq_prd_yjyy"
65
 
65
 
66
 
66
 

+ 125 - 28
controllers/js/jsyb_controller.go 查看文件

608
 	})
608
 	})
609
 }
609
 }
610
 
610
 
611
+type ELeData struct {
612
+	Data struct {
613
+		Extra       string `json:"extra"`
614
+		IDNo        string `json:"idNo"`
615
+		IDType      string `json:"idType"`
616
+		EcToken     string `json:"ecToken"`
617
+		InsuOrg     string `json:"insuOrg"`
618
+		UserName    string `json:"userName"`
619
+		EcIndexNo   string `json:"ecIndexNo"`
620
+		Gender      string `json:"gender"`
621
+		Birthday    string `json:"birthday"`
622
+		Nationality string `json:"nationality"`
623
+		Email       string `json:"email"`
624
+	} `json:"data"`
625
+	Code    int    `json:"code"`
626
+	Message string `json:"message"`
627
+}
628
+
611
 func (c *JSybController) ReadCard() {
629
 func (c *JSybController) ReadCard() {
612
 	fixmedins_code := c.GetString("fixmedins_code")
630
 	fixmedins_code := c.GetString("fixmedins_code")
613
 	secret_key := c.GetString("secret_key")
631
 	secret_key := c.GetString("secret_key")
618
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
636
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
619
 	url := c.GetString("url")
637
 	url := c.GetString("url")
620
 	cainfo := c.GetString("cainfo")
638
 	cainfo := c.GetString("cainfo")
639
+	id_card_type, _ := c.GetInt64("id_card_type")
640
+	operator_id := c.GetString("operator_id")
641
+	operator := c.GetString("operator")
621
 
642
 
622
 	//result, request := service.Jsyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
643
 	//result, request := service.Jsyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
623
 	//fmt.Println(request)
644
 	//fmt.Println(request)
624
 	//fmt.Println(result)
645
 	//fmt.Println(result)
625
 
646
 
626
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
647
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
627
-	pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
628
-	pBusiCardInfo = Remove0000(pBusiCardInfo)
629
-	pCardInfo = Remove0000(pCardInfo)
630
-	fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
631
-
632
-	fmt.Println(pBusiCardInfo)
633
-	fmt.Println(pCardInfo)
634
-	bas := strings.Split(pCardInfo, "|")
635
-	basNumber := bas[2]
636
-	id_card_no := bas[1]
637
-	card_sn := bas[3]
638
-
639
-	if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
640
-		result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
641
-		var dat map[string]interface{}
642
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
643
-			fmt.Println(dat)
648
+
649
+	switch id_card_type {
650
+	case 1:
651
+		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
652
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
653
+		pCardInfo = Remove0000(pCardInfo)
654
+		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
655
+
656
+		fmt.Println(pBusiCardInfo)
657
+		fmt.Println(pCardInfo)
658
+		bas := strings.Split(pCardInfo, "|")
659
+		basNumber := bas[2]
660
+		id_card_no := bas[1]
661
+		card_sn := bas[3]
662
+
663
+		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
664
+			result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
665
+			var dat map[string]interface{}
666
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
667
+				fmt.Println(dat)
668
+			} else {
669
+				fmt.Println(err)
670
+			}
671
+			c.ServeSuccessJSON(map[string]interface{}{
672
+				"status":         "0",
673
+				"card_info":      pCardInfo,
674
+				"busi_card_info": pBusiCardInfo,
675
+				"result":         dat,
676
+				"type":           "1",
677
+			})
644
 		} else {
678
 		} else {
645
-			fmt.Println(err)
679
+			c.ServeSuccessJSON(map[string]interface{}{
680
+				"status": "-1",
681
+			})
682
+
646
 		}
683
 		}
647
-		c.ServeSuccessJSON(map[string]interface{}{
648
-			"status":         "0",
649
-			"card_info":      pCardInfo,
650
-			"busi_card_info": pBusiCardInfo,
651
-			"result":         dat,
652
-		})
653
-	} else {
654
-		c.ServeSuccessJSON(map[string]interface{}{
655
-			"status": "-1",
656
-		})
684
+		break
685
+	case 3: //电子凭证
686
+		pCardInfo, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
687
+		fmt.Println(pCardInfo)
688
+		fmt.Println(pBusiCardInfo)
689
+		var ele ELeData
690
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
691
+		if err != nil {
692
+			utils.ErrorLog("解析失败:%v", err)
693
+		}
694
+		token := ele.Data.EcToken
695
+		if len(token) > 0 {
696
+			result, _ := service.Jsyb1101B(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo)
697
+			var dat map[string]interface{}
698
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
699
+				fmt.Println(dat)
700
+			} else {
701
+				fmt.Println(err)
702
+			}
703
+			c.ServeSuccessJSON(map[string]interface{}{
704
+				"status":         "0",
705
+				"card_info":      pCardInfo,
706
+				"busi_card_info": pBusiCardInfo,
707
+				"token":          token,
708
+				"result":         dat,
709
+				"type":           "2",
710
+			})
711
+		} else {
712
+			c.ServeSuccessJSON(map[string]interface{}{
713
+				"status": "-1",
714
+			})
715
+
716
+		}
717
+		break
657
 
718
 
658
 	}
719
 	}
659
 
720
 
718
 	return DeleteExtraSpace(string(pCardInfo)), DeleteExtraSpace(string(pBusiCardInfo))
779
 	return DeleteExtraSpace(string(pCardInfo)), DeleteExtraSpace(string(pBusiCardInfo))
719
 }
780
 }
720
 
781
 
782
+func (c *JSybController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
783
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
784
+	readCard := DllDef.MustFindProc("EcQuery")
785
+	fmt.Println(readCard)
786
+	fmt.Println("!!!!!")
787
+	//pCardInfo := make([]byte, 8192)
788
+	pBusiCardInfo := make([]byte, 8192)
789
+
790
+	data := make(map[string]interface{})
791
+
792
+	inputData := make(map[string]interface{})
793
+	inputData["orgId"] = code
794
+	inputData["businessType"] = "01101"
795
+	inputData["operatorId"] = operator_id
796
+	inputData["operatorName"] = operator_name
797
+	inputData["officeId"] = "001"
798
+	inputData["officeName"] = "血透室"
799
+
800
+	data["data"] = inputData
801
+	data["transType"] = "ec.query"
802
+	data["orgId"] = code
803
+
804
+	bytesData, _ := json.Marshal(data)
805
+
806
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
807
+	fmt.Println(ret2)
808
+	fmt.Println(DeleteExtraSpace(string(bytesData)))
809
+	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
810
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
811
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
812
+	if ret2 != 0 {
813
+		return "", ""
814
+	}
815
+	return DeleteExtraSpace(string(bytesData)), DeleteExtraSpace(string(pBusiCardInfo))
816
+}
817
+
721
 func IntPtr(n int) uintptr {
818
 func IntPtr(n int) uintptr {
722
 	return uintptr(n)
819
 	return uintptr(n)
723
 }
820
 }

+ 109 - 50
controllers/sg/his_api_controller.go 查看文件

395
 			var api string
395
 			var api string
396
 			if miConfig.MdtrtareaAdmvs == "320921" {
396
 			if miConfig.MdtrtareaAdmvs == "320921" {
397
 				api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
397
 				api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
398
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
398
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "operator_id=" + strconv.FormatInt(admin_user_id, 10) + "operator=" + roles.UserName
399
 
399
 
400
 			} else {
400
 			} else {
401
 				api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
401
 				api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
402
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
402
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
403
 			}
403
 			}
404
 
404
 
405
 			resp, requestErr := http.Get(api)
405
 			resp, requestErr := http.Get(api)
422
 			}
422
 			}
423
 			var status string
423
 			var status string
424
 			status = respJSON["data"].(map[string]interface{})["status"].(string)
424
 			status = respJSON["data"].(map[string]interface{})["status"].(string)
425
+			card_type := respJSON["data"].(map[string]interface{})["type"].(string)
426
+
427
+			var token string
428
+			var res ResultTwo           //1101结果
429
+			var res10265 ResultTwo10265 //1101结果
430
+			var card_info string        //卡信息
431
+			var busi_card_info string
432
+
433
+			card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
434
+			busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
425
 
435
 
426
 			if status == "0" { //读卡成功
436
 			if status == "0" { //读卡成功
427
-				var card_info string //卡信息
428
-				var busi_card_info string
429
-				var res ResultTwo           //1101结果
430
-				var res10265 ResultTwo10265 //1101结果
437
+				if card_type == "1" {
431
 
438
 
432
-				card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
433
-				busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
439
+					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
440
+					result, _ := json.Marshal(respJSON)
434
 
441
 
435
-				fmt.Println(card_info)
436
-				fmt.Println(busi_card_info)
442
+					if err := json.Unmarshal([]byte(result), &res10265); err != nil {
443
+						utils.ErrorLog("解析失败:%v", err)
444
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
445
+						return
446
+					}
447
+					res.ErrMsg = res10265.ErrMsg
448
+					infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
449
+					res.Infcode = infocode
450
+					res.Output = res10265.Output
451
+					res.InfRefmsgid = res10265.InfRefmsgid
437
 
452
 
438
-				respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
439
-				result, _ := json.Marshal(respJSON)
453
+				} else {
454
+					//var card_info string //卡信息
455
+					//var busi_card_info string
456
+
457
+					token = respJSON["data"].(map[string]interface{})["token"].(string)
458
+					//busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
459
+
460
+					//fmt.Println(card_info)
461
+					//fmt.Println(busi_card_info)
462
+
463
+					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
464
+					result, _ := json.Marshal(respJSON)
465
+
466
+					if err := json.Unmarshal([]byte(result), &res10265); err != nil {
467
+						utils.ErrorLog("解析失败:%v", err)
468
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
469
+						return
470
+					}
471
+					res.ErrMsg = res10265.ErrMsg
472
+					infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
473
+					res.Infcode = infocode
474
+					res.Output = res10265.Output
475
+					res.InfRefmsgid = res10265.InfRefmsgid
440
 
476
 
441
-				if err := json.Unmarshal([]byte(result), &res10265); err != nil {
442
-					utils.ErrorLog("解析失败:%v", err)
443
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
444
-					return
445
 				}
477
 				}
446
-				res.ErrMsg = res10265.ErrMsg
447
-				infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
448
-				res.Infcode = infocode
449
-				res.Output = res10265.Output
450
-				res.InfRefmsgid = res10265.InfRefmsgid
451
 
478
 
452
 				if res.Infcode == 0 {
479
 				if res.Infcode == 0 {
453
 					patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
480
 					patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
460
 
487
 
461
 					} else {
488
 					} else {
462
 
489
 
463
-						bas := strings.Split(card_info, "|")
464
-						basNumber := bas[2]
465
-
466
-						Iinfos, _ := json.Marshal(res.Output.Iinfo)
467
-						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
468
-						infoStr := string(Iinfos)
469
-						idetinfoStr := string(Idetinfos)
470
-						psn := &models.HisPsn{
471
-							PsnNo:        res.Output.Baseinfo.PsnNo,
472
-							Age:          res.Output.Baseinfo.Age,
473
-							PatientId:    patient.ID,
474
-							Certno:       res.Output.Baseinfo.Certno,
475
-							Brdy:         res.Output.Baseinfo.Brdy,
476
-							Gend:         res.Output.Baseinfo.Gend,
477
-							Naty:         res.Output.Baseinfo.Naty,
478
-							PsnCertType:  res.Output.Baseinfo.PsnCertType,
479
-							PsnName:      res.Output.Baseinfo.PsnName,
480
-							Idetinfo:     idetinfoStr,
481
-							Insuinfo:     infoStr,
482
-							UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
483
-							CardInfo:     card_info,
484
-							VerifyNumber: busi_card_info,
490
+						if card_type == "1" {
491
+							bas := strings.Split(card_info, "|")
492
+							basNumber := bas[2]
493
+							Iinfos, _ := json.Marshal(res.Output.Iinfo)
494
+							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
495
+							infoStr := string(Iinfos)
496
+							idetinfoStr := string(Idetinfos)
497
+							psn := &models.HisPsn{
498
+								PsnNo:        res.Output.Baseinfo.PsnNo,
499
+								Age:          res.Output.Baseinfo.Age,
500
+								PatientId:    patient.ID,
501
+								Certno:       res.Output.Baseinfo.Certno,
502
+								Brdy:         res.Output.Baseinfo.Brdy,
503
+								Gend:         res.Output.Baseinfo.Gend,
504
+								Naty:         res.Output.Baseinfo.Naty,
505
+								PsnCertType:  res.Output.Baseinfo.PsnCertType,
506
+								PsnName:      res.Output.Baseinfo.PsnName,
507
+								Idetinfo:     idetinfoStr,
508
+								Insuinfo:     infoStr,
509
+								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
510
+								CardInfo:     card_info,
511
+								VerifyNumber: busi_card_info,
512
+							}
513
+							service.CreateHisPsn(psn)
514
+							c.ServeSuccessJSON(map[string]interface{}{
515
+								"patient": patient,
516
+								"number":  basNumber,
517
+							})
518
+						} else {
519
+							Iinfos, _ := json.Marshal(res.Output.Iinfo)
520
+							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
521
+							infoStr := string(Iinfos)
522
+							idetinfoStr := string(Idetinfos)
523
+							psn := &models.HisPsn{
524
+								PsnNo:        res.Output.Baseinfo.PsnNo,
525
+								Age:          res.Output.Baseinfo.Age,
526
+								PatientId:    patient.ID,
527
+								Certno:       res.Output.Baseinfo.Certno,
528
+								Brdy:         res.Output.Baseinfo.Brdy,
529
+								Gend:         res.Output.Baseinfo.Gend,
530
+								Naty:         res.Output.Baseinfo.Naty,
531
+								PsnCertType:  res.Output.Baseinfo.PsnCertType,
532
+								PsnName:      res.Output.Baseinfo.PsnName,
533
+								Idetinfo:     idetinfoStr,
534
+								Insuinfo:     infoStr,
535
+								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
536
+								CardInfo:     card_info,
537
+								VerifyNumber: token,
538
+							}
539
+							service.CreateHisPsn(psn)
540
+							c.ServeSuccessJSON(map[string]interface{}{
541
+								"patient": patient,
542
+								"number":  token,
543
+							})
485
 						}
544
 						}
486
-						service.CreateHisPsn(psn)
487
-						c.ServeSuccessJSON(map[string]interface{}{
488
-							"patient": patient,
489
-							"number":  basNumber,
490
-						})
491
 					}
545
 					}
492
 				} else {
546
 				} else {
493
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
547
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
7934
 					PsnPay:    acct_pay,
7988
 					PsnPay:    acct_pay,
7935
 					Creator:   admin_user_id,
7989
 					Creator:   admin_user_id,
7936
 					Ctime:     time.Now().Unix(),
7990
 					Ctime:     time.Now().Unix(),
7991
+					ClrType:   clr_type,
7937
 				}
7992
 				}
7938
 				err := service.CreateMedicalInsuranceCostCompareRecord(micc)
7993
 				err := service.CreateMedicalInsuranceCostCompareRecord(micc)
7939
 				if err == nil {
7994
 				if err == nil {
8296
 	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
8351
 	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
8297
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
8352
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
8298
 	orderInfos = append(orderInfos, orderInfos_two...)
8353
 	orderInfos = append(orderInfos, orderInfos_two...)
8299
-	//his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8354
+	his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8300
 
8355
 
8301
 	//diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
8356
 	//diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
8302
 
8357
 
8516
 			res.Infcode = infocode
8571
 			res.Infcode = infocode
8517
 
8572
 
8518
 		} else {
8573
 		} else {
8574
+			//result2 := service.Gdyb1101()
8575
+
8519
 			result2 := service.Gdyb5204(baseParams, businessParams)
8576
 			result2 := service.Gdyb5204(baseParams, businessParams)
8520
 			saveLog(result2, "", "5204", "查询")
8577
 			saveLog(result2, "", "5204", "查询")
8521
 			result := service.Gdyb5203(baseParams, businessParams)
8578
 			result := service.Gdyb5203(baseParams, businessParams)
8638
 				"org_name":                                    miConfig.OrgName,
8695
 				"org_name":                                    miConfig.OrgName,
8639
 				"org_code":                                    miConfig.Code,
8696
 				"org_code":                                    miConfig.Code,
8640
 				"order_number":                                order.Number,
8697
 				"order_number":                                order.Number,
8641
-				//"his":                                         his_hospital,
8698
+				"his_hospital":                                his_hospital,
8699
+				"his":                                         his,
8700
+
8642
 				//"check_order_info":                            cus_slice,
8701
 				//"check_order_info":                            cus_slice,
8643
 			})
8702
 			})
8644
 		}
8703
 		}

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

1048
 	PsnPay    float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
1048
 	PsnPay    float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
1049
 	Creator   int64   `gorm:"column:creator" json:"creator" form:"creator"`
1049
 	Creator   int64   `gorm:"column:creator" json:"creator" form:"creator"`
1050
 	Ctime     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1050
 	Ctime     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1051
+	ClrType   string  `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1051
 }
1052
 }
1052
 
1053
 
1053
 func (MedicalInsuranceCostCompare) TableName() string {
1054
 func (MedicalInsuranceCostCompare) TableName() string {

+ 6 - 2
service/gdyb_service.go 查看文件

786
 	ProvinceDrugMedListCodg string
786
 	ProvinceDrugMedListCodg string
787
 	ProvinceGoodMedListCodg string
787
 	ProvinceGoodMedListCodg string
788
 	IsUser                  int64
788
 	IsUser                  int64
789
+	FeeOcurTime             string
789
 }
790
 }
790
 
791
 
791
 type RequestResult struct {
792
 type RequestResult struct {
848
 
849
 
849
 	for _, item := range hisPrescription {
850
 	for _, item := range hisPrescription {
850
 		role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
851
 		role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
851
-
852
+		tm := time.Unix(item.PreTime, 0)
852
 		if item.Type == 1 { //药品
853
 		if item.Type == 1 { //药品
853
 			for _, subItem := range item.HisDoctorAdviceInfo {
854
 			for _, subItem := range item.HisDoctorAdviceInfo {
854
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
855
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
864
 						HospApprFlag:     subItem.HospApprFlag,
865
 						HospApprFlag:     subItem.HospApprFlag,
865
 						DoctorNumber:     role.DoctorNumber,
866
 						DoctorNumber:     role.DoctorNumber,
866
 						DoctorName:       role.UserName,
867
 						DoctorName:       role.UserName,
868
+						FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
867
 					}
869
 					}
868
 
870
 
869
 					customs = append(customs, cus)
871
 					customs = append(customs, cus)
887
 							DoctorNumber:     role.DoctorNumber,
889
 							DoctorNumber:     role.DoctorNumber,
888
 							DoctorName:       role.UserName,
890
 							DoctorName:       role.UserName,
889
 							HospApprFlag:     -1,
891
 							HospApprFlag:     -1,
892
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
890
 						}
893
 						}
891
 						customs = append(customs, cus)
894
 						customs = append(customs, cus)
892
 					}
895
 					}
904
 							HospApprFlag:     -1,
907
 							HospApprFlag:     -1,
905
 							DoctorNumber:     role.DoctorNumber,
908
 							DoctorNumber:     role.DoctorNumber,
906
 							DoctorName:       role.UserName,
909
 							DoctorName:       role.UserName,
910
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
907
 						}
911
 						}
908
 						customs = append(customs, cus)
912
 						customs = append(customs, cus)
909
 					}
913
 					}
947
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
951
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
948
 		feedetailInfo["rxno"] = ""                                   // 处方号
952
 		feedetailInfo["rxno"] = ""                                   // 处方号
949
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
953
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
950
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
954
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
951
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
955
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
952
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
956
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
953
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
957
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额

+ 7 - 1
service/hbyb_service.go 查看文件

273
 	var customs []*Custom
273
 	var customs []*Custom
274
 
274
 
275
 	for _, item := range hisPrescription {
275
 	for _, item := range hisPrescription {
276
+		tm := time.Unix(item.PreTime, 0)
277
+
276
 		if item.Type == 1 { //药品
278
 		if item.Type == 1 { //药品
279
+
277
 			for _, subItem := range item.HisDoctorAdviceInfo {
280
 			for _, subItem := range item.HisDoctorAdviceInfo {
278
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
281
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
279
 					//var randNum int
282
 					//var randNum int
285
 						Price:            fmt.Sprintf("%.2f", subItem.Price),
288
 						Price:            fmt.Sprintf("%.2f", subItem.Price),
286
 						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
289
 						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
287
 						HospApprFlag:     subItem.BaseDrugLib.HospApprFlag,
290
 						HospApprFlag:     subItem.BaseDrugLib.HospApprFlag,
291
+						FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
288
 					}
292
 					}
289
 
293
 
290
 					customs = append(customs, cus)
294
 					customs = append(customs, cus)
307
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
311
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
308
 							MedListCodg:      subItem.HisProject.MedicalCode,
312
 							MedListCodg:      subItem.HisProject.MedicalCode,
309
 							HospApprFlag:     -1,
313
 							HospApprFlag:     -1,
314
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
310
 						}
315
 						}
311
 						customs = append(customs, cus)
316
 						customs = append(customs, cus)
312
 					}
317
 					}
322
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
327
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
323
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
328
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
324
 							HospApprFlag:     -1,
329
 							HospApprFlag:     -1,
330
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
325
 						}
331
 						}
326
 						customs = append(customs, cus)
332
 						customs = append(customs, cus)
327
 					}
333
 					}
362
 		feedetailInfo["dise_codg"] = ""                              // 病种编码
368
 		feedetailInfo["dise_codg"] = ""                              // 病种编码
363
 		feedetailInfo["rxno"] = ""                                   // 处方号
369
 		feedetailInfo["rxno"] = ""                                   // 处方号
364
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
370
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
365
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
371
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
366
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
372
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
367
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
373
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
368
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
374
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额

+ 49 - 3
service/jsyb_service.go 查看文件

109
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
109
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
110
 }
110
 }
111
 
111
 
112
+func Jsyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string) (string, string) {
113
+	timestamp := time.Now().Unix()
114
+	//生成输入报文
115
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
116
+
117
+	input := make(map[string]interface{})
118
+	inputData := make(map[string]interface{})
119
+	inputMessage["infno"] = "1101" // 交易编码
120
+
121
+	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
122
+	inputData["card_sn"] = ""           // 卡识别码
123
+	inputData["certno"] = ""            // 证件号码
124
+	inputData["psn_cert_type"] = "01"   // 人员证件类型
125
+
126
+	inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
127
+	inputData["begntime"] = ""         // 开始时间
128
+	inputData["psn_name"] = ""         // 人员姓名
129
+	input["data"] = inputData
130
+	inputMessage["input"] = input //交易输入
131
+
132
+	var inputLog string
133
+	bytesData, _ := json.Marshal(inputMessage)
134
+	inputLog = string(bytesData)
135
+	fmt.Println(string(bytesData))
136
+	if err != nil {
137
+		fmt.Println(err.Error())
138
+		return err.Error(), ""
139
+	}
140
+	request_url = request_url + "1101"
141
+	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
142
+}
143
+
112
 // 门诊挂号
144
 // 门诊挂号
113
 func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, opera 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, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
145
 func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, opera 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, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
114
 	fmt.Println(opera)
146
 	fmt.Println(opera)
130
 	if id_card_type == 1 {
162
 	if id_card_type == 1 {
131
 		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
163
 		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
132
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
164
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
165
+	} else if id_card_type == 4 {
166
+		inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
167
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
133
 	} else {
168
 	} else {
134
 		inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
169
 		inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
135
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
170
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
171
+
136
 	}
172
 	}
137
 
173
 
138
 	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
174
 	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
319
 
355
 
320
 	timestamp2 := time.Now().Unix()
356
 	timestamp2 := time.Now().Unix()
321
 
357
 
322
-	tempTime := time.Unix(timestamp2, 0)
323
-	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
358
+	//tempTime := time.Unix(timestamp2, 0)
359
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
324
 	var customs []*Custom
360
 	var customs []*Custom
325
 	for _, item := range hisPrescription {
361
 	for _, item := range hisPrescription {
362
+		tm := time.Unix(item.PreTime, 0)
326
 
363
 
327
 		if item.Type == 1 { //药品
364
 		if item.Type == 1 { //药品
328
 			for _, subItem := range item.HisDoctorAdviceInfo {
365
 			for _, subItem := range item.HisDoctorAdviceInfo {
340
 						DoctorName:              new_doctor_name,
377
 						DoctorName:              new_doctor_name,
341
 						ProvinceDrugMedListCodg: "",
378
 						ProvinceDrugMedListCodg: "",
342
 						ProvinceGoodMedListCodg: "",
379
 						ProvinceGoodMedListCodg: "",
380
+						FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
343
 					}
381
 					}
344
 
382
 
345
 					if subItem.BaseDrugLib.DrugClassify == "2" {
383
 					if subItem.BaseDrugLib.DrugClassify == "2" {
369
 							HospApprFlag:            -1,
407
 							HospApprFlag:            -1,
370
 							ProvinceDrugMedListCodg: "",
408
 							ProvinceDrugMedListCodg: "",
371
 							ProvinceGoodMedListCodg: "",
409
 							ProvinceGoodMedListCodg: "",
410
+							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
372
 						}
411
 						}
373
 						customs = append(customs, cus)
412
 						customs = append(customs, cus)
374
 					}
413
 					}
388
 							DoctorName:              new_doctor_name,
427
 							DoctorName:              new_doctor_name,
389
 							ProvinceDrugMedListCodg: "",
428
 							ProvinceDrugMedListCodg: "",
390
 							ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
429
 							ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
430
+							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
391
 						}
431
 						}
392
 						customs = append(customs, cus)
432
 						customs = append(customs, cus)
393
 					}
433
 					}
432
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
472
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
433
 		feedetailInfo["rxno"] = ""                                   // 处方号
473
 		feedetailInfo["rxno"] = ""                                   // 处方号
434
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
474
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
435
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
475
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
436
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
476
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
437
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
477
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
438
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
478
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
547
 		if id_card_type == 1 {
587
 		if id_card_type == 1 {
548
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
588
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
549
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
589
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
590
+		} else if id_card_type == 4 {
591
+			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
592
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
550
 		} else {
593
 		} else {
551
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
594
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
552
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
595
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
607
 		if id_card_type == 1 {
650
 		if id_card_type == 1 {
608
 			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
651
 			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
609
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
652
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
653
+		} else if id_card_type == 4 {
654
+			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
655
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
610
 		} else {
656
 		} else {
611
 			inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
657
 			inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
612
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
658
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号