|
@@ -16,19 +16,18 @@ import (
|
16
|
16
|
)
|
17
|
17
|
|
18
|
18
|
const (
|
19
|
|
- SceretKey = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" // secretKey 私钥
|
20
|
|
- FixmedinsCOde = "H44022900158" // 定点医药机构编号
|
|
19
|
+ SceretKey = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" // secretKey 私钥
|
21
|
20
|
)
|
22
|
21
|
|
23
|
22
|
// 人员基本信息
|
24
|
|
-func Gdyb1101(certNo string, org_name string, doctor string) string {
|
|
23
|
+func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code string) string {
|
25
|
24
|
// 生成签名
|
26
|
25
|
nonce := GetRandomString(32)
|
27
|
26
|
timestamp := time.Now().Unix()
|
28
|
27
|
signature := setSignature(timestamp, nonce)
|
29
|
28
|
|
30
|
29
|
// 生成输入报文
|
31
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
30
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
|
32
|
31
|
input := make(map[string]interface{})
|
33
|
32
|
inputData := make(map[string]interface{})
|
34
|
33
|
inputMessage["infno"] = "1101" // 交易编码
|
|
@@ -80,7 +79,7 @@ func Gdyb1101(certNo string, org_name string, doctor string) string {
|
80
|
79
|
}
|
81
|
80
|
|
82
|
81
|
// 门诊挂号
|
83
|
|
-func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept 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) string {
|
84
|
83
|
// 生成签名
|
85
|
84
|
nonce := GetRandomString(32)
|
86
|
85
|
timestamp := time.Now().Unix()
|
|
@@ -89,7 +88,7 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
|
89
|
88
|
timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
90
|
89
|
|
91
|
90
|
// 生成输入报文
|
92
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
91
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
|
93
|
92
|
input := make(map[string]interface{})
|
94
|
93
|
inputData := make(map[string]interface{})
|
95
|
94
|
inputMessage["infno"] = "2201" // 交易编码
|
|
@@ -153,7 +152,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
|
153
|
152
|
signature := setSignature(timestamp, nonce)
|
154
|
153
|
|
155
|
154
|
// 生成输入报文
|
156
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
155
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
|
157
|
156
|
input := make(map[string]interface{})
|
158
|
157
|
inputData := make(map[string]interface{})
|
159
|
158
|
inputMessage["infno"] = "2202" // 交易编码
|
|
@@ -202,7 +201,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
|
202
|
201
|
}
|
203
|
202
|
|
204
|
203
|
// 门诊就诊信息上传
|
205
|
|
-func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name 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) string {
|
206
|
205
|
// 生成签名
|
207
|
206
|
nonce := GetRandomString(32)
|
208
|
207
|
timestamp := time.Now().Unix()
|
|
@@ -211,7 +210,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
|
211
|
210
|
timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
212
|
211
|
|
213
|
212
|
// 生成输入报文
|
214
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
213
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
|
215
|
214
|
input := make(map[string]interface{})
|
216
|
215
|
inputData := make(map[string]interface{})
|
217
|
216
|
diseinfo := make([]map[string]interface{}, 0)
|
|
@@ -219,7 +218,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
|
219
|
218
|
inputMessage["infno"] = "2203" // 交易编码
|
220
|
219
|
inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
|
221
|
220
|
inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
|
222
|
|
- inputData["med_type"] = "11" // 医疗类别 16门诊特殊病
|
|
221
|
+ inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
|
223
|
222
|
inputData["begntime"] = timeFormatOne // 开始时间
|
224
|
223
|
inputData["main_cond_dscr"] = "" // 主要病情描述
|
225
|
224
|
inputData["dise_codg"] = "" // 病种编码
|
|
@@ -233,7 +232,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
|
233
|
232
|
diseinfo_sun["diag_code"] = "A04.902" // 诊断代码
|
234
|
233
|
diseinfo_sun["diag_name"] = diag // 诊断名称
|
235
|
234
|
diseinfo_sun["diag_dept"] = department // 诊断科室
|
236
|
|
- diseinfo_sun["dise_dor_no"] = "1002" // 诊断医生编码
|
|
235
|
+ diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
|
237
|
236
|
diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
|
238
|
237
|
diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
|
239
|
238
|
diseinfo_sun["vali_flag"] = "1" // 有效标志
|
|
@@ -335,7 +334,7 @@ type Result struct {
|
335
|
334
|
}
|
336
|
335
|
|
337
|
336
|
// 门诊费用明细信息上传
|
338
|
|
-func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept 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) string {
|
339
|
338
|
// 生成签名
|
340
|
339
|
nonce := GetRandomString(32)
|
341
|
340
|
timestamp := time.Now().Unix()
|
|
@@ -383,10 +382,8 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
|
383
|
382
|
}
|
384
|
383
|
}
|
385
|
384
|
|
386
|
|
- fmt.Println(customs)
|
387
|
|
-
|
388
|
385
|
// 生成输入报文
|
389
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
386
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
|
390
|
387
|
input := make(map[string]interface{})
|
391
|
388
|
feedetail := make([]map[string]interface{}, 0)
|
392
|
389
|
inputMessage["infno"] = "2204" // 交易编码
|
|
@@ -403,7 +400,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
|
403
|
400
|
feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
|
404
|
401
|
feedetailInfo["fee_ocur_time"] = timeFormatOne // 费用发生时间
|
405
|
402
|
feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
|
406
|
|
- feedetailInfo["medins_list_codg"] = FixmedinsCOde // 医药机构目录编码
|
|
403
|
+ feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
|
407
|
404
|
feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
|
408
|
405
|
feedetailInfo["cnt"] = item.Cut // 数量
|
409
|
406
|
feedetailInfo["pric"] = item.Price // 单价
|
|
@@ -479,7 +476,7 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
|
479
|
476
|
signature := setSignature(timestamp, nonce)
|
480
|
477
|
|
481
|
478
|
// 生成输入报文
|
482
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
479
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
|
483
|
480
|
input := make(map[string]interface{})
|
484
|
481
|
inputData := make(map[string]interface{})
|
485
|
482
|
inputMessage["infno"] = "2205" // 交易编码
|
|
@@ -539,7 +536,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
539
|
536
|
signature := setSignature(timestamp, nonce)
|
540
|
537
|
|
541
|
538
|
// 生成输入报文
|
542
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
539
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
|
543
|
540
|
input := make(map[string]interface{})
|
544
|
541
|
inputData := make(map[string]interface{})
|
545
|
542
|
inputMessage["infno"] = "2206" // 交易编码
|
|
@@ -596,14 +593,14 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
596
|
593
|
}
|
597
|
594
|
|
598
|
595
|
// 门诊结算
|
599
|
|
-func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string) string {
|
|
596
|
+func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string) string {
|
600
|
597
|
// 生成签名
|
601
|
598
|
nonce := GetRandomString(32)
|
602
|
599
|
timestamp := time.Now().Unix()
|
603
|
600
|
signature := setSignature(timestamp, nonce)
|
604
|
601
|
|
605
|
602
|
// 生成输入报文
|
606
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
603
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
|
607
|
604
|
input := make(map[string]interface{})
|
608
|
605
|
inputData := make(map[string]interface{})
|
609
|
606
|
inputMessage["infno"] = "2207" // 交易编码
|
|
@@ -668,7 +665,7 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
|
668
|
665
|
signature := setSignature(timestamp, nonce)
|
669
|
666
|
|
670
|
667
|
// 生成输入报文
|
671
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
668
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
|
672
|
669
|
input := make(map[string]interface{})
|
673
|
670
|
inputData := make(map[string]interface{})
|
674
|
671
|
inputMessage["infno"] = "2208" // 交易编码
|
|
@@ -938,7 +935,7 @@ func GetRandomString(l int) string {
|
938
|
935
|
}
|
939
|
936
|
|
940
|
937
|
// 生成基础报文
|
941
|
|
-func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string) map[string]interface{} {
|
|
938
|
+func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string) map[string]interface{} {
|
942
|
939
|
// 生成签名
|
943
|
940
|
tempTime := time.Unix(timestamp, 0)
|
944
|
941
|
timeFormat := tempTime.Format("20060102150405")
|
|
@@ -949,7 +946,7 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
|
949
|
946
|
inputMessage := make(map[string]interface{})
|
950
|
947
|
|
951
|
948
|
inputMessage["infno"] = "1101" // 交易编码
|
952
|
|
- inputMessage["msgid"] = "H44022900158" + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
|
|
949
|
+ inputMessage["msgid"] = fixmedins_code + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
|
953
|
950
|
inputMessage["mdtrtarea_admvs"] = "440200" // 就医地医保区划
|
954
|
951
|
inputMessage["insuplc_admdvs"] = "440200" // 参保地医保区划
|
955
|
952
|
inputMessage["recer_sys_code"] = "01" // 接收方系统代码
|
|
@@ -962,19 +959,12 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
|
962
|
959
|
inputMessage["opter"] = "mockuser" // 经办人
|
963
|
960
|
inputMessage["opter_name"] = doctor // 经办人姓名
|
964
|
961
|
inputMessage["inf_time"] = timeFormatOne // 交易时间
|
965
|
|
- inputMessage["fixmedins_code"] = FixmedinsCOde // 定点医药机构编号
|
966
|
|
- inputMessage["fixmedins_name"] = "" //定点医药机构名称
|
|
962
|
+ inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
|
|
963
|
+ inputMessage["fixmedins_name"] = org_name //定点医药机构名称
|
967
|
964
|
inputMessage["sign_no"] = "" //交易签到流水号
|
968
|
965
|
return inputMessage
|
969
|
966
|
}
|
970
|
967
|
|
971
|
|
-func FindHisRegisterRecord(record_time int64, patient_id int64, org_id int64) (total int64, err error) {
|
972
|
|
-
|
973
|
|
- err = readDb.Model(&models.VMHisPatient{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND record_date = ?", org_id, patient_id, record_time).Count(&total).Error
|
974
|
|
-
|
975
|
|
- return
|
976
|
|
-}
|
977
|
|
-
|
978
|
968
|
func Gdyb1201(psnNo string, org_name string, doctor string) string {
|
979
|
969
|
// 生成签名
|
980
|
970
|
nonce := GetRandomString(32)
|
|
@@ -982,13 +972,13 @@ func Gdyb1201(psnNo string, org_name string, doctor string) string {
|
982
|
972
|
signature := setSignature(timestamp, nonce)
|
983
|
973
|
|
984
|
974
|
// 生成输入报文
|
985
|
|
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
|
|
975
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
|
986
|
976
|
input := make(map[string]interface{})
|
987
|
977
|
inputData := make(map[string]interface{})
|
988
|
|
- inputMessage["infno"] = "1201" // 交易编码
|
989
|
|
- inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
|
990
|
|
- inputData["fixmedins_name"] = "翁源沅胜血液透析中心" // 人员编号 (来自1101接口返回)
|
991
|
|
- inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
|
|
978
|
+ inputMessage["infno"] = "1201" // 交易编码
|
|
979
|
+ inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
|
|
980
|
+ inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
|
|
981
|
+ inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
|
992
|
982
|
|
993
|
983
|
input["medinsinfo"] = inputData
|
994
|
984
|
inputMessage["input"] = input //交易输入
|