|
@@ -2354,6 +2354,144 @@ func (c *HisApiController) ReadCard() {
|
2354
|
2354
|
|
2355
|
2355
|
|
2356
|
2356
|
|
|
2357
|
+ } else if miConfig.MdtrtareaAdmvs == "350500" {
|
|
2358
|
+ type ELeData struct {
|
|
2359
|
+ Data struct {
|
|
2360
|
+ IdNo string `json:"idNo"`
|
|
2361
|
+ IdType string `json:"idType"`
|
|
2362
|
+ UserName string `json:"userName"`
|
|
2363
|
+ EcToken string `json:"ecToken"`
|
|
2364
|
+ InsuOrg string `json:"insuOrg"`
|
|
2365
|
+ Gender string `json:"gender"`
|
|
2366
|
+ Birthday string `json:"birthday"`
|
|
2367
|
+ Nationality string `json:"nationality"`
|
|
2368
|
+ Email string `json:"email"`
|
|
2369
|
+ Extra string `json:"extra"`
|
|
2370
|
+ } `json:"data"`
|
|
2371
|
+ Code int `json:"code"`
|
|
2372
|
+ Message string `json:"message"`
|
|
2373
|
+ }
|
|
2374
|
+
|
|
2375
|
+ inputInfo, outPutInfo, errMsg := service.ReadEleCard(miConfig.Code)
|
|
2376
|
+ fmt.Println(errMsg)
|
|
2377
|
+
|
|
2378
|
+ if len(errMsg) == 0 {
|
|
2379
|
+ var ele ELeData
|
|
2380
|
+ err := json.Unmarshal([]byte(outPutInfo), &ele)
|
|
2381
|
+ if err != nil {
|
|
2382
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2383
|
+ }
|
|
2384
|
+ token := ele.Data.EcToken
|
|
2385
|
+ fmt.Println(inputInfo)
|
|
2386
|
+ fmt.Println(outPutInfo)
|
|
2387
|
+ 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)
|
|
2388
|
+
|
|
2389
|
+ saveLog(result, requestLog, "1101", "获取人员信息")
|
|
2390
|
+ fmt.Println(errMsgLog)
|
|
2391
|
+
|
|
2392
|
+ if len(errMsgLog) > 0 {
|
|
2393
|
+
|
|
2394
|
+ } else {
|
|
2395
|
+
|
|
2396
|
+ var dat map[string]interface{}
|
|
2397
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2398
|
+ fmt.Println(dat)
|
|
2399
|
+ } else {
|
|
2400
|
+ fmt.Println(err)
|
|
2401
|
+ }
|
|
2402
|
+
|
|
2403
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
2404
|
+ var res ResultTwo
|
|
2405
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
2406
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2407
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2408
|
+ return
|
|
2409
|
+ }
|
|
2410
|
+ res.ErrMsg = errMsgLog
|
|
2411
|
+ if res.Infcode == 0 {
|
|
2412
|
+ patient, err := service.GetPatientByNumber(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
|
|
2413
|
+ if err == gorm.ErrRecordNotFound {
|
|
2414
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
2415
|
+ return
|
|
2416
|
+ } else if err != nil {
|
|
2417
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2418
|
+ return
|
|
2419
|
+
|
|
2420
|
+ } else {
|
|
2421
|
+ fmt.Println(res)
|
|
2422
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
2423
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
2424
|
+ infoStr := string(Iinfos)
|
|
2425
|
+ idetinfoStr := string(Idetinfos)
|
|
2426
|
+ psn := &models.HisPsn{
|
|
2427
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
2428
|
+ Age: res.Output.Baseinfo.Age,
|
|
2429
|
+ PatientId: patient.ID,
|
|
2430
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
2431
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
2432
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
2433
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
2434
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
2435
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
2436
|
+ Idetinfo: idetinfoStr,
|
|
2437
|
+ Insuinfo: infoStr,
|
|
2438
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2439
|
+ CardInfo: outPutInfo,
|
|
2440
|
+ VerifyNumber: token,
|
|
2441
|
+ }
|
|
2442
|
+ service.CreateHisPsn(psn)
|
|
2443
|
+
|
|
2444
|
+ var rf []*ResultFive
|
|
2445
|
+ json.Unmarshal([]byte(infoStr), &rf)
|
|
2446
|
+
|
|
2447
|
+ var insutypes []*ResultFive
|
|
2448
|
+ var insutype string
|
|
2449
|
+ var is390 int = 0
|
|
2450
|
+ var is310 int = 0
|
|
2451
|
+
|
|
2452
|
+ for _, item := range rf {
|
|
2453
|
+ if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
|
2454
|
+ insutypes = append(insutypes, item)
|
|
2455
|
+ }
|
|
2456
|
+ }
|
|
2457
|
+
|
|
2458
|
+ if len(insutypes) == 1 {
|
|
2459
|
+ insutype = insutypes[0].Insutype
|
|
2460
|
+
|
|
2461
|
+ } else {
|
|
2462
|
+ for _, i := range insutypes {
|
|
2463
|
+ if i.Insutype == "390" {
|
|
2464
|
+ is390 = 1
|
|
2465
|
+ }
|
|
2466
|
+
|
|
2467
|
+ if i.Insutype == "310" {
|
|
2468
|
+ is310 = 1
|
|
2469
|
+ }
|
|
2470
|
+ }
|
|
2471
|
+ }
|
|
2472
|
+ if is390 == 1 {
|
|
2473
|
+ insutype = "390"
|
|
2474
|
+ }
|
|
2475
|
+
|
|
2476
|
+ if is310 == 1 {
|
|
2477
|
+ insutype = "310"
|
|
2478
|
+ }
|
|
2479
|
+
|
|
2480
|
+ if len(insutypes) == 0 {
|
|
2481
|
+ insutype = "310"
|
|
2482
|
+ }
|
|
2483
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2484
|
+ "patient": patient,
|
|
2485
|
+ "number": token,
|
|
2486
|
+ "insutype": insutype,
|
|
2487
|
+ })
|
|
2488
|
+ }
|
|
2489
|
+ } else {
|
|
2490
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
2491
|
+ return
|
|
2492
|
+ }
|
|
2493
|
+ }
|
|
2494
|
+ }
|
2357
|
2495
|
}
|
2358
|
2496
|
break
|
2359
|
2497
|
}
|
|
@@ -6024,11 +6162,12 @@ func (c *HisApiController) GetRegisterInfo() {
|
6024
|
6162
|
var cert_no string
|
6025
|
6163
|
if id_card_type == 1 {
|
6026
|
6164
|
cert_no = strings.Split(psn_info.CardInfo, "|")[0]
|
|
6165
|
+ } else if id_card_type == 4 {
|
|
6166
|
+ cert_no = psn_info.VerifyNumber
|
6027
|
6167
|
} else {
|
6028
|
|
- cert_no = strings.Split(psn_info.CardInfo, "|")[1]
|
6029
|
|
-
|
|
6168
|
+ cert_no = psn_info.VerifyNumber
|
6030
|
6169
|
}
|
6031
|
|
- fmt.Println(cert_no)
|
|
6170
|
+
|
6032
|
6171
|
result, requestLog, _ := service.FJyb2201(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, doctor_info.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, roles.UserName, doctor_info.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, cert_no)
|
6033
|
6172
|
saveLog(result, requestLog, "2201", "挂号")
|
6034
|
6173
|
if miConfig.Code == "H15049901371" {
|
|
@@ -8451,6 +8590,7 @@ func (c *HisApiController) GetPreUploadInfo() {
|
8451
|
8590
|
res2.Infcode = infocode
|
8452
|
8591
|
|
8453
|
8592
|
} else if miConfig.MdtrtareaAdmvs == "350500" {
|
|
8593
|
+
|
8454
|
8594
|
result, requestLog, _ := service.FJyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time, doctor_info.UserName, roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
|
8455
|
8595
|
saveLog(result, requestLog, "2203", "上传就诊信息")
|
8456
|
8596
|
var respJSON2 map[string]interface{}
|