|
@@ -6133,7 +6133,6 @@ func (c *HisApiController) GetUploadInfo() {
|
6133
|
6133
|
pay_way, _ := c.GetInt64("pay_way")
|
6134
|
6134
|
pay_price, _ := c.GetFloat("pay_price")
|
6135
|
6135
|
pay_card_no := c.GetString("pay_card_no")
|
6136
|
|
- token := c.GetString("token")
|
6137
|
6136
|
|
6138
|
6137
|
discount_price, _ := c.GetFloat("discount_price")
|
6139
|
6138
|
preferential_price, _ := c.GetFloat("preferential_price")
|
|
@@ -6306,25 +6305,6 @@ func (c *HisApiController) GetUploadInfo() {
|
6306
|
6305
|
|
6307
|
6306
|
} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
|
6308
|
6307
|
|
6309
|
|
-
|
6310
|
|
-
|
6311
|
|
-
|
6312
|
|
-
|
6313
|
|
-
|
6314
|
|
-
|
6315
|
|
-
|
6316
|
|
-
|
6317
|
|
-
|
6318
|
|
-
|
6319
|
|
-
|
6320
|
|
-
|
6321
|
|
-
|
6322
|
|
-
|
6323
|
|
-
|
6324
|
|
-
|
6325
|
|
-
|
6326
|
|
-
|
6327
|
|
-
|
6328
|
6308
|
data := make(map[string]interface{})
|
6329
|
6309
|
client := &http.Client{}
|
6330
|
6310
|
data["psn_no"] = his.PsnNo
|
|
@@ -6356,7 +6336,6 @@ func (c *HisApiController) GetUploadInfo() {
|
6356
|
6336
|
|
6357
|
6337
|
|
6358
|
6338
|
|
6359
|
|
-
|
6360
|
6339
|
} else {
|
6361
|
6340
|
req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
|
6362
|
6341
|
|
|
@@ -7023,7 +7002,7 @@ func (c *HisApiController) GetUploadInfo() {
|
7023
|
7002
|
psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
|
7024
|
7003
|
} else if his.IdCardType == 4 {
|
7025
|
7004
|
cert_no = his.Certno
|
7026
|
|
- psn_info.VerifyNumber = token
|
|
7005
|
+ psn_info.VerifyNumber = psn_info.VerifyNumber
|
7027
|
7006
|
}
|
7028
|
7007
|
var api string
|
7029
|
7008
|
if miConfig.MdtrtareaAdmvs == "320921" {
|
|
@@ -8400,12 +8379,16 @@ func (c *HisApiController) GetPreUploadInfo() {
|
8400
|
8379
|
var req *http.Request
|
8401
|
8380
|
if miConfig.MdtrtareaAdmvs == "320921" {
|
8402
|
8381
|
req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
|
8403
|
|
-
|
8404
|
|
-
|
8405
|
|
-
|
8406
|
8382
|
} else {
|
8407
|
|
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
|
8408
|
|
-
|
|
8383
|
+ tokens := ReadEleCard(admin_user_id, c.GetAdminUserInfo().CurrentOrgId, c)
|
|
8384
|
+ if len(tokens) > 0 {
|
|
8385
|
+ req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
|
|
8386
|
+ } else {
|
|
8387
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
8388
|
+ "failed_code": -10,
|
|
8389
|
+ "msg": "token无效",
|
|
8390
|
+ })
|
|
8391
|
+ }
|
8409
|
8392
|
}
|
8410
|
8393
|
|
8411
|
8394
|
resp, _ := client.Do(req)
|
|
@@ -8999,7 +8982,9 @@ func (c *HisApiController) GetPreUploadInfo() {
|
8999
|
8982
|
return
|
9000
|
8983
|
} else {
|
9001
|
8984
|
psn_info, _ := service.GetPsnByPatientId(his.PatientId)
|
9002
|
|
- psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
|
|
8985
|
+ if his.IdCardType != 4 {
|
|
8986
|
+ psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
|
|
8987
|
+ }
|
9003
|
8988
|
|
9004
|
8989
|
bas := strings.Split(psn_info.CardInfo, "|")
|
9005
|
8990
|
|
|
@@ -12978,42 +12963,39 @@ func ConvertToString(src string, srcCode string, tagCode string) string {
|
12978
|
12963
|
return result
|
12979
|
12964
|
}
|
12980
|
12965
|
|
12981
|
|
-func (c *HisApiController) ReadEleCard() {
|
12982
|
|
- id_card_type, _ := c.GetInt64("id_card_type")
|
12983
|
|
- admin_user_id, _ := c.GetInt64("admin_user_id")
|
12984
|
|
- fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
|
12985
|
|
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
12986
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
12966
|
+func ReadEleCard(admin_user_id int64, org_id int64, c *HisApiController) string {
|
|
12967
|
+ roles, _ := service.GetAdminUserInfoByID(org_id, admin_user_id)
|
|
12968
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
|
12987
|
12969
|
|
12988
|
12970
|
if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
|
12989
|
12971
|
var api string
|
12990
|
12972
|
if miConfig.MdtrtareaAdmvs == "320921" {
|
12991
|
12973
|
api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
|
12992
|
|
- "&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
|
|
12974
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(4, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
|
12993
|
12975
|
fmt.Println(api)
|
12994
|
12976
|
|
12995
|
12977
|
} else {
|
12996
|
12978
|
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 +
|
12997
|
|
- "&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
|
|
12979
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(4, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
|
12998
|
12980
|
}
|
12999
|
12981
|
|
13000
|
12982
|
resp, requestErr := http.Get(api)
|
13001
|
12983
|
if requestErr != nil {
|
13002
|
12984
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
13003
|
|
- return
|
|
12985
|
+ return ""
|
13004
|
12986
|
}
|
13005
|
12987
|
|
13006
|
12988
|
body, ioErr := ioutil.ReadAll(resp.Body)
|
13007
|
12989
|
if ioErr != nil {
|
13008
|
12990
|
utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
13009
|
12991
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
13010
|
|
- return
|
|
12992
|
+ return ""
|
13011
|
12993
|
}
|
13012
|
12994
|
var respJSON map[string]interface{}
|
13013
|
12995
|
if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
13014
|
12996
|
utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
13015
|
12997
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
13016
|
|
- return
|
|
12998
|
+ return ""
|
13017
|
12999
|
}
|
13018
|
13000
|
var status string
|
13019
|
13001
|
status = respJSON["data"].(map[string]interface{})["status"].(string)
|
|
@@ -13027,7 +13009,6 @@ func (c *HisApiController) ReadEleCard() {
|
13027
|
13009
|
token = respJSON["data"].(map[string]interface{})["token"].(string)
|
13028
|
13010
|
busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
|
13029
|
13011
|
card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
|
13030
|
|
-
|
13031
|
13012
|
fmt.Println(card_info)
|
13032
|
13013
|
fmt.Println(busi_card_info)
|
13033
|
13014
|
|
|
@@ -13037,7 +13018,7 @@ func (c *HisApiController) ReadEleCard() {
|
13037
|
13018
|
if err := json.Unmarshal([]byte(result), &res10265); err != nil {
|
13038
|
13019
|
utils.ErrorLog("解析失败:%v", err)
|
13039
|
13020
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
13040
|
|
- return
|
|
13021
|
+ return ""
|
13041
|
13022
|
}
|
13042
|
13023
|
res.ErrMsg = res10265.ErrMsg
|
13043
|
13024
|
infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
|
|
@@ -13045,17 +13026,46 @@ func (c *HisApiController) ReadEleCard() {
|
13045
|
13026
|
res.Output = res10265.Output
|
13046
|
13027
|
res.InfRefmsgid = res10265.InfRefmsgid
|
13047
|
13028
|
if res.Infcode == 0 {
|
13048
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
13049
|
|
- "number": token,
|
13050
|
|
- })
|
|
13029
|
+ patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
13030
|
+ if err == gorm.ErrRecordNotFound {
|
|
13031
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
13032
|
+ return ""
|
|
13033
|
+ } else if err != nil {
|
|
13034
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
13035
|
+ return ""
|
|
13036
|
+
|
|
13037
|
+ } else {
|
|
13038
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
13039
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
13040
|
+ infoStr := string(Iinfos)
|
|
13041
|
+ idetinfoStr := string(Idetinfos)
|
|
13042
|
+ psn := &models.HisPsn{
|
|
13043
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
13044
|
+ Age: res.Output.Baseinfo.Age,
|
|
13045
|
+ PatientId: patient.ID,
|
|
13046
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
13047
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
13048
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
13049
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
13050
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
13051
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
13052
|
+ Idetinfo: idetinfoStr,
|
|
13053
|
+ Insuinfo: infoStr,
|
|
13054
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
13055
|
+ CardInfo: card_info,
|
|
13056
|
+ VerifyNumber: token,
|
|
13057
|
+ }
|
|
13058
|
+ service.CreateHisPsn(psn)
|
|
13059
|
+ return token
|
|
13060
|
+ }
|
13051
|
13061
|
}
|
13052
|
13062
|
} else {
|
13053
|
13063
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
13054
|
|
- return
|
|
13064
|
+ return ""
|
13055
|
13065
|
}
|
13056
|
13066
|
} else {
|
13057
|
13067
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
13058
|
|
- return
|
|
13068
|
+ return ""
|
13059
|
13069
|
}
|
13060
|
13070
|
}
|
13061
|
13071
|
|