|
@@ -137,7 +137,7 @@ func (c *HisApiController) ReadEleToken() {
|
137
|
137
|
tokens := ReadEleCard(admin_user_id, c.GetAdminUserInfo().CurrentOrgId, c)
|
138
|
138
|
if len(tokens) > 0 {
|
139
|
139
|
c.ServeSuccessJSON(map[string]interface{}{
|
140
|
|
- "msg": "读取成功,请在5分钟内进行结算操作",
|
|
140
|
+ "msg": "读取成功",
|
141
|
141
|
})
|
142
|
142
|
} else {
|
143
|
143
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -153,9 +153,52 @@ func (c *HisApiController) ReadEleToken() {
|
153
|
153
|
token := c.GetEleBaseInfo()
|
154
|
154
|
token = Remove0000(token)
|
155
|
155
|
if len(token) > 0 {
|
156
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
157
|
|
- "msg": "读取成功,请在5分钟内进行结算操作",
|
158
|
|
- })
|
|
156
|
+ result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token)
|
|
157
|
+ saveLog(result2, requestLog2, "1101", "获取人员信息")
|
|
158
|
+ var res ResultTwo
|
|
159
|
+ if err := json.Unmarshal([]byte(result2), &res); err != nil {
|
|
160
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
161
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
162
|
+ return
|
|
163
|
+ }
|
|
164
|
+ if res.Infcode == 0 {
|
|
165
|
+ patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
166
|
+ if err == gorm.ErrRecordNotFound {
|
|
167
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
168
|
+ return
|
|
169
|
+ } else if err != nil {
|
|
170
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
171
|
+ return
|
|
172
|
+ } else {
|
|
173
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
174
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
175
|
+ infoStr := string(Iinfos)
|
|
176
|
+ idetinfoStr := string(Idetinfos)
|
|
177
|
+ psn := &models.HisPsn{
|
|
178
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
179
|
+ Age: res.Output.Baseinfo.Age,
|
|
180
|
+ PatientId: patient.ID,
|
|
181
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
182
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
183
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
184
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
185
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
186
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
187
|
+ Idetinfo: idetinfoStr,
|
|
188
|
+ Insuinfo: infoStr,
|
|
189
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
190
|
+ CardInfo: "",
|
|
191
|
+ VerifyNumber: token,
|
|
192
|
+ }
|
|
193
|
+ service.CreateHisPsn(psn)
|
|
194
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
195
|
+ "msg": "读取成功",
|
|
196
|
+ })
|
|
197
|
+ }
|
|
198
|
+ } else {
|
|
199
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
200
|
+ return
|
|
201
|
+ }
|
159
|
202
|
} else {
|
160
|
203
|
c.ServeSuccessJSON(map[string]interface{}{
|
161
|
204
|
"failed_code": -10,
|
|
@@ -213,7 +256,7 @@ func (c *HisApiController) ReadEleToken() {
|
213
|
256
|
|
214
|
257
|
if len(token) > 0 {
|
215
|
258
|
c.ServeSuccessJSON(map[string]interface{}{
|
216
|
|
- "msg": "读取成功,请在5分钟内进行结算操作",
|
|
259
|
+ "msg": "读取成功",
|
217
|
260
|
})
|
218
|
261
|
} else {
|
219
|
262
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -2458,27 +2501,42 @@ func (c *HisApiController) ReadCard() {
|
2458
|
2501
|
}
|
2459
|
2502
|
|
2460
|
2503
|
} else if miConfig.MdtrtareaAdmvs == "350500" {
|
|
2504
|
+
|
2461
|
2505
|
type ELeData struct {
|
|
2506
|
+ Code string `json:"code"`
|
2462
|
2507
|
Data struct {
|
2463
|
|
- IdNo string `json:"idNo"`
|
2464
|
|
- IdType string `json:"idType"`
|
2465
|
|
- UserName string `json:"userName"`
|
2466
|
|
- EcToken string `json:"ecToken"`
|
2467
|
|
- InsuOrg string `json:"insuOrg"`
|
2468
|
|
- Gender string `json:"gender"`
|
2469
|
|
- Birthday string `json:"birthday"`
|
2470
|
|
- Nationality string `json:"nationality"`
|
2471
|
|
- Email string `json:"email"`
|
2472
|
|
- Extra string `json:"extra"`
|
|
2508
|
+ Aac002 string `json:"aac002"`
|
|
2509
|
+ Aaz500 string `json:"aaz500"`
|
|
2510
|
+ ActCardNo string `json:"actCardNo"`
|
|
2511
|
+ Bab520 string `json:"bab520"`
|
|
2512
|
+ Bkz543 string `json:"bkz543"`
|
|
2513
|
+ BusinessType string `json:"businessType"`
|
|
2514
|
+ CertfCodg string `json:"certfCodg"`
|
|
2515
|
+ EcIndexNo string `json:"ecIndexNo"`
|
|
2516
|
+ EcToken string `json:"ecToken"`
|
|
2517
|
+ ID0000 string `json:"id0000"`
|
|
2518
|
+ IDNo string `json:"idNo"`
|
|
2519
|
+ IDType string `json:"idType"`
|
|
2520
|
+ Idcode string `json:"idcode"`
|
|
2521
|
+ IdentityToken string `json:"identity_token"`
|
|
2522
|
+ InsuOrg string `json:"insuOrg"`
|
|
2523
|
+ OfficeID string `json:"officeId"`
|
|
2524
|
+ OfficeName string `json:"officeName"`
|
|
2525
|
+ OperatorID string `json:"operatorId"`
|
|
2526
|
+ OperatorName string `json:"operatorName"`
|
|
2527
|
+ OrgID string `json:"orgId"`
|
|
2528
|
+ UserName string `json:"userName"`
|
2473
|
2529
|
} `json:"data"`
|
2474
|
|
- Code int `json:"code"`
|
2475
|
|
- Message string `json:"message"`
|
|
2530
|
+ Infno interface{} `json:"infno"`
|
|
2531
|
+ Message string `json:"message"`
|
|
2532
|
+ OrgID string `json:"orgId"`
|
|
2533
|
+ TransType string `json:"transType"`
|
2476
|
2534
|
}
|
2477
|
2535
|
|
2478
|
2536
|
inputInfo, outPutInfo, errMsg := service.ReadEleCard(miConfig.Code)
|
2479
|
2537
|
fmt.Println(errMsg)
|
2480
|
2538
|
|
2481
|
|
- if len(errMsg) == 0 {
|
|
2539
|
+ if len(outPutInfo) > 0 {
|
2482
|
2540
|
var ele ELeData
|
2483
|
2541
|
err := json.Unmarshal([]byte(outPutInfo), &ele)
|
2484
|
2542
|
if err != nil {
|
|
@@ -2487,113 +2545,106 @@ func (c *HisApiController) ReadCard() {
|
2487
|
2545
|
token := ele.Data.EcToken
|
2488
|
2546
|
fmt.Println(inputInfo)
|
2489
|
2547
|
fmt.Println(outPutInfo)
|
2490
|
|
- result, requestLog, errMsgLog := service.FJyb1101ForEleToken(ele.Data.IdNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, "", certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, token)
|
2491
|
|
-
|
|
2548
|
+ result, requestLog, errMsgLog := service.FJyb1101ForEleToken(ele.Data.IDNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, "", certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, token)
|
2492
|
2549
|
saveLog(result, requestLog, "1101", "获取人员信息")
|
2493
|
|
- fmt.Println(errMsgLog)
|
2494
|
|
-
|
2495
|
|
- if len(errMsgLog) > 0 {
|
2496
|
|
-
|
|
2550
|
+ var dat map[string]interface{}
|
|
2551
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2552
|
+ fmt.Println(dat)
|
2497
|
2553
|
} else {
|
|
2554
|
+ fmt.Println(err)
|
|
2555
|
+ }
|
2498
|
2556
|
|
2499
|
|
- var dat map[string]interface{}
|
2500
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
2501
|
|
- fmt.Println(dat)
|
2502
|
|
- } else {
|
2503
|
|
- fmt.Println(err)
|
2504
|
|
- }
|
2505
|
|
-
|
2506
|
|
- userJSONBytes, _ := json.Marshal(dat)
|
2507
|
|
- var res ResultTwo
|
2508
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2509
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2510
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2557
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
2558
|
+ var res ResultTwo
|
|
2559
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
2560
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2561
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2562
|
+ return
|
|
2563
|
+ }
|
|
2564
|
+ res.ErrMsg = errMsgLog
|
|
2565
|
+ if res.Infcode == 0 {
|
|
2566
|
+ patient, err := service.GetPatientByNumber(ele.Data.IDNo, c.GetAdminUserInfo().CurrentOrgId)
|
|
2567
|
+ if err == gorm.ErrRecordNotFound {
|
|
2568
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
2569
|
+ return
|
|
2570
|
+ } else if err != nil {
|
|
2571
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
2511
|
2572
|
return
|
2512
|
|
- }
|
2513
|
|
- res.ErrMsg = errMsgLog
|
2514
|
|
- if res.Infcode == 0 {
|
2515
|
|
- patient, err := service.GetPatientByNumber(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
|
2516
|
|
- if err == gorm.ErrRecordNotFound {
|
2517
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
2518
|
|
- return
|
2519
|
|
- } else if err != nil {
|
2520
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
2521
|
|
- return
|
2522
|
2573
|
|
2523
|
|
- } else {
|
2524
|
|
- fmt.Println(res)
|
2525
|
|
- Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
2526
|
|
- Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
2527
|
|
- infoStr := string(Iinfos)
|
2528
|
|
- idetinfoStr := string(Idetinfos)
|
2529
|
|
- psn := &models.HisPsn{
|
2530
|
|
- PsnNo: res.Output.Baseinfo.PsnNo,
|
2531
|
|
- Age: res.Output.Baseinfo.Age,
|
2532
|
|
- PatientId: patient.ID,
|
2533
|
|
- Certno: res.Output.Baseinfo.Certno,
|
2534
|
|
- Brdy: res.Output.Baseinfo.Brdy,
|
2535
|
|
- Gend: res.Output.Baseinfo.Gend,
|
2536
|
|
- Naty: res.Output.Baseinfo.Naty,
|
2537
|
|
- PsnCertType: res.Output.Baseinfo.PsnCertType,
|
2538
|
|
- PsnName: res.Output.Baseinfo.PsnName,
|
2539
|
|
- Idetinfo: idetinfoStr,
|
2540
|
|
- Insuinfo: infoStr,
|
2541
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2542
|
|
- CardInfo: outPutInfo,
|
2543
|
|
- VerifyNumber: token,
|
2544
|
|
- }
|
2545
|
|
- service.CreateHisPsn(psn)
|
|
2574
|
+ } else {
|
|
2575
|
+ fmt.Println(res)
|
|
2576
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
2577
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
2578
|
+ infoStr := string(Iinfos)
|
|
2579
|
+ idetinfoStr := string(Idetinfos)
|
|
2580
|
+ psn := &models.HisPsn{
|
|
2581
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
2582
|
+ Age: res.Output.Baseinfo.Age,
|
|
2583
|
+ PatientId: patient.ID,
|
|
2584
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
2585
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
2586
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
2587
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
2588
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
2589
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
2590
|
+ Idetinfo: idetinfoStr,
|
|
2591
|
+ Insuinfo: infoStr,
|
|
2592
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2593
|
+ CardInfo: outPutInfo,
|
|
2594
|
+ VerifyNumber: token,
|
|
2595
|
+ }
|
|
2596
|
+ service.CreateHisPsn(psn)
|
2546
|
2597
|
|
2547
|
|
- var rf []*ResultFive
|
2548
|
|
- json.Unmarshal([]byte(infoStr), &rf)
|
|
2598
|
+ var rf []*ResultFive
|
|
2599
|
+ json.Unmarshal([]byte(infoStr), &rf)
|
2549
|
2600
|
|
2550
|
|
- var insutypes []*ResultFive
|
2551
|
|
- var insutype string
|
2552
|
|
- var is390 int = 0
|
2553
|
|
- var is310 int = 0
|
|
2601
|
+ var insutypes []*ResultFive
|
|
2602
|
+ var insutype string
|
|
2603
|
+ var is390 int = 0
|
|
2604
|
+ var is310 int = 0
|
2554
|
2605
|
|
2555
|
|
- for _, item := range rf {
|
2556
|
|
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
2557
|
|
- insutypes = append(insutypes, item)
|
2558
|
|
- }
|
|
2606
|
+ for _, item := range rf {
|
|
2607
|
+ if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
|
2608
|
+ insutypes = append(insutypes, item)
|
2559
|
2609
|
}
|
|
2610
|
+ }
|
2560
|
2611
|
|
2561
|
|
- if len(insutypes) == 1 {
|
2562
|
|
- insutype = insutypes[0].Insutype
|
2563
|
|
- //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
|
2564
|
|
- } else {
|
2565
|
|
- for _, i := range insutypes {
|
2566
|
|
- if i.Insutype == "390" {
|
2567
|
|
- is390 = 1
|
2568
|
|
- }
|
|
2612
|
+ if len(insutypes) == 1 {
|
|
2613
|
+ insutype = insutypes[0].Insutype
|
|
2614
|
+ //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
|
|
2615
|
+ } else {
|
|
2616
|
+ for _, i := range insutypes {
|
|
2617
|
+ if i.Insutype == "390" {
|
|
2618
|
+ is390 = 1
|
|
2619
|
+ }
|
2569
|
2620
|
|
2570
|
|
- if i.Insutype == "310" {
|
2571
|
|
- is310 = 1
|
2572
|
|
- }
|
|
2621
|
+ if i.Insutype == "310" {
|
|
2622
|
+ is310 = 1
|
2573
|
2623
|
}
|
2574
|
2624
|
}
|
2575
|
|
- if is390 == 1 {
|
2576
|
|
- insutype = "390"
|
2577
|
|
- }
|
|
2625
|
+ }
|
|
2626
|
+ if is390 == 1 {
|
|
2627
|
+ insutype = "390"
|
|
2628
|
+ }
|
2578
|
2629
|
|
2579
|
|
- if is310 == 1 {
|
2580
|
|
- insutype = "310"
|
2581
|
|
- }
|
|
2630
|
+ if is310 == 1 {
|
|
2631
|
+ insutype = "310"
|
|
2632
|
+ }
|
2582
|
2633
|
|
2583
|
|
- if len(insutypes) == 0 {
|
2584
|
|
- insutype = "310"
|
2585
|
|
- }
|
2586
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2587
|
|
- "patient": patient,
|
2588
|
|
- "number": token,
|
2589
|
|
- "insutype": insutype,
|
2590
|
|
- })
|
|
2634
|
+ if len(insutypes) == 0 {
|
|
2635
|
+ insutype = "310"
|
2591
|
2636
|
}
|
2592
|
|
- } else {
|
2593
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
2594
|
|
- return
|
|
2637
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2638
|
+ "patient": patient,
|
|
2639
|
+ "number": token,
|
|
2640
|
+ "insutype": insutype,
|
|
2641
|
+ })
|
2595
|
2642
|
}
|
|
2643
|
+ } else {
|
|
2644
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
2645
|
+ return
|
2596
|
2646
|
}
|
|
2647
|
+
|
2597
|
2648
|
}
|
2598
|
2649
|
}
|
2599
|
2650
|
break
|
|
@@ -3895,9 +3946,9 @@ func (c *HisApiController) GetSettleListHospital() {
|
3895
|
3946
|
}
|
3896
|
3947
|
|
3897
|
3948
|
func (c *HisApiController) GetBatchSettleList() {
|
3898
|
|
- orders, _ := service.GetAllHisOrder(10106)
|
|
3949
|
+ orders, _ := service.GetAllHisOrderErr(10106, 101060)
|
3899
|
3950
|
for _, item := range orders {
|
3900
|
|
- order_id := item.ID
|
|
3951
|
+ order_id := item.PatientId
|
3901
|
3952
|
order, _ := service.GetHisOrderByIDTwo(order_id)
|
3902
|
3953
|
roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
|
3903
|
3954
|
his, _ := service.GetHisPatientByNumber(order.MdtrtId)
|
|
@@ -7728,14 +7779,15 @@ func (c *HisApiController) GetUploadInfo() {
|
7728
|
7779
|
} else {
|
7729
|
7780
|
psn_info, _ := service.GetPsnByPatientId(his.PatientId)
|
7730
|
7781
|
psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
|
7731
|
|
-
|
7732
|
|
- //psn_info, _ := service.GetPsnByPatientId(id)
|
7733
|
7782
|
bas := strings.Split(psn_info.CardInfo, "|")
|
7734
|
|
-
|
7735
|
7783
|
if his.IdCardType == 1 {
|
7736
|
7784
|
cert_no = bas[2]
|
7737
|
|
- } else {
|
7738
|
|
- cert_no = bas[1]
|
|
7785
|
+ } else if his.IdCardType == 3 {
|
|
7786
|
+ cert_no = his.Certno
|
|
7787
|
+ psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
|
|
7788
|
+ } else if his.IdCardType == 4 {
|
|
7789
|
+ cert_no = his.Certno
|
|
7790
|
+ psn_info.VerifyNumber = psn_info.VerifyNumber
|
7739
|
7791
|
}
|
7740
|
7792
|
|
7741
|
7793
|
//江苏地区国家医保医疗类别
|
|
@@ -9286,15 +9338,17 @@ func (c *HisApiController) GetPreUploadInfo() {
|
9286
|
9338
|
psn_info, _ := service.GetPsnByPatientId(his.PatientId)
|
9287
|
9339
|
if his.IdCardType != 4 {
|
9288
|
9340
|
psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
|
9289
|
|
- }
|
9290
|
|
-
|
9291
|
|
- bas := strings.Split(psn_info.CardInfo, "|")
|
|
9341
|
+ bas := strings.Split(psn_info.CardInfo, "|")
|
|
9342
|
+ if his.IdCardType == 1 {
|
|
9343
|
+ cert_no = bas[2]
|
|
9344
|
+ } else {
|
|
9345
|
+ cert_no = bas[1]
|
|
9346
|
+ }
|
9292
|
9347
|
|
9293
|
|
- if his.IdCardType == 1 {
|
9294
|
|
- cert_no = bas[2]
|
9295
|
9348
|
} else {
|
9296
|
|
- cert_no = bas[1]
|
|
9349
|
+ cert_no = his.Certno
|
9297
|
9350
|
}
|
|
9351
|
+
|
9298
|
9352
|
//江苏地区国家医保医疗类别
|
9299
|
9353
|
//职工透析:医疗类别选特殊情况门诊9933
|
9300
|
9354
|
//居民血透门慢: 医疗类别选门诊慢病1402
|