test_user 1 gadu atpakaļ
vecāks
revīzija
2126707def
1 mainītis faili ar 93 papildinājumiem un 66 dzēšanām
  1. 93 66
      controllers/sg/his_api_controller.go

+ 93 - 66
controllers/sg/his_api_controller.go Parādīt failu

@@ -4075,73 +4075,70 @@ func (c *HisApiController) ReadCard() {
4075 4075
 			}
4076 4076
 		} else if miConfig.MdtrtareaAdmvs == "430800" {
4077 4077
 
4078
-			if initFlag == 0 {
4079
-				c.TestGetBasBaseInit()
4080
-			}
4081
-			token := c.GetEleBaseInfo()
4082
-
4083
-			token = Remove0000(token)
4084
-
4085
-			result2, requestLog2 := service.Hnyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, token, "", "", "")
4086
-			saveLog(result2, requestLog2, "1101", "获取人员信息")
4078
+			_, result := GetHnEleBaseInfo(miConfig.Code, admin_user_id, roles.UserName)
4079
+			fmt.Println(result)
4080
+			//token = Remove0000(token)
4081
+
4082
+			//result2, requestLog2 := service.Hnyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, token, "", "", "")
4083
+			//saveLog(result2, requestLog2, "1101", "获取人员信息")
4084
+			////
4085
+			//var res ResultTwo
4086
+			//if err := json.Unmarshal([]byte(result2), &res); err != nil {
4087
+			//	utils.ErrorLog("解析失败:%v", err)
4088
+			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4089
+			//	return
4090
+			//}
4087 4091
 			//
4088
-			var res ResultTwo
4089
-			if err := json.Unmarshal([]byte(result2), &res); err != nil {
4090
-				utils.ErrorLog("解析失败:%v", err)
4091
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4092
-				return
4093
-			}
4094
-
4095
-			if res.Infcode == 0 {
4096
-				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
4097
-				if err == gorm.ErrRecordNotFound {
4098
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
4099
-					return
4100
-				} else if err != nil {
4101
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4102
-					return
4103
-
4104
-				} else {
4105
-
4106
-					//month := time.Unix(1557042972, 0).Format("1")
4107
-					//year := time.Now().Format("2006")
4108
-					//month = time.Now().Format("01")
4109
-					//day := time.Now().Format("02")
4110
-					//date := year+"-"+month+"-"+day + " "+"00:00:00"
4111
-
4112
-					Iinfos, _ := json.Marshal(res.Output.Iinfo)
4113
-					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4114
-					infoStr := string(Iinfos)
4115
-					idetinfoStr := string(Idetinfos)
4116
-					psn := &models.HisPsn{
4117
-						PsnNo:       res.Output.Baseinfo.PsnNo,
4118
-						Age:         res.Output.Baseinfo.Age,
4119
-						PatientId:   patient.ID,
4120
-						Certno:      res.Output.Baseinfo.Certno,
4121
-						Brdy:        res.Output.Baseinfo.Brdy,
4122
-						Gend:        res.Output.Baseinfo.Gend,
4123
-						Naty:        res.Output.Baseinfo.Naty,
4124
-						PsnCertType: res.Output.Baseinfo.PsnCertType,
4125
-						PsnName:     res.Output.Baseinfo.PsnName,
4126
-						Idetinfo:    idetinfoStr,
4127
-						Insuinfo:    infoStr,
4128
-						UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
4129
-						CardInfo:    "",
4130
-						Stage:       "1",
4131
-						//RecordDate:
4132
-						VerifyNumber: token,
4133
-					}
4134
-					service.CreateHisPsn(psn)
4135
-
4136
-					c.ServeSuccessJSON(map[string]interface{}{
4137
-						"patient": patient,
4138
-						"number":  token,
4139
-					})
4140
-				}
4141
-			} else {
4142
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
4143
-				return
4144
-			}
4092
+			//if res.Infcode == 0 {
4093
+			//	patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
4094
+			//	if err == gorm.ErrRecordNotFound {
4095
+			//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
4096
+			//		return
4097
+			//	} else if err != nil {
4098
+			//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4099
+			//		return
4100
+			//
4101
+			//	} else {
4102
+			//
4103
+			//		//month := time.Unix(1557042972, 0).Format("1")
4104
+			//		//year := time.Now().Format("2006")
4105
+			//		//month = time.Now().Format("01")
4106
+			//		//day := time.Now().Format("02")
4107
+			//		//date := year+"-"+month+"-"+day + " "+"00:00:00"
4108
+			//
4109
+			//		Iinfos, _ := json.Marshal(res.Output.Iinfo)
4110
+			//		Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4111
+			//		infoStr := string(Iinfos)
4112
+			//		idetinfoStr := string(Idetinfos)
4113
+			//		psn := &models.HisPsn{
4114
+			//			PsnNo:       res.Output.Baseinfo.PsnNo,
4115
+			//			Age:         res.Output.Baseinfo.Age,
4116
+			//			PatientId:   patient.ID,
4117
+			//			Certno:      res.Output.Baseinfo.Certno,
4118
+			//			Brdy:        res.Output.Baseinfo.Brdy,
4119
+			//			Gend:        res.Output.Baseinfo.Gend,
4120
+			//			Naty:        res.Output.Baseinfo.Naty,
4121
+			//			PsnCertType: res.Output.Baseinfo.PsnCertType,
4122
+			//			PsnName:     res.Output.Baseinfo.PsnName,
4123
+			//			Idetinfo:    idetinfoStr,
4124
+			//			Insuinfo:    infoStr,
4125
+			//			UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
4126
+			//			CardInfo:    "",
4127
+			//			Stage:       "1",
4128
+			//			//RecordDate:
4129
+			//			VerifyNumber: token,
4130
+			//		}
4131
+			//		service.CreateHisPsn(psn)
4132
+			//
4133
+			//		c.ServeSuccessJSON(map[string]interface{}{
4134
+			//			"patient": patient,
4135
+			//			"number":  token,
4136
+			//		})
4137
+			//	}
4138
+			//} else {
4139
+			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
4140
+			//	return
4141
+			//}
4145 4142
 
4146 4143
 		} else if miConfig.MdtrtareaAdmvs == "360399" {
4147 4144
 			//if initFlag == 0 {
@@ -4778,6 +4775,36 @@ func (c *HisApiController) GetEleBaseInfo() string {
4778 4775
 	return string(str)
4779 4776
 }
4780 4777
 
4778
+func GetHnEleBaseInfo(code string, operator_id int64, operator_name string) (string, string) {
4779
+	DllDef := syscall.MustLoadDLL("NationECCode.dll")
4780
+	readCard := DllDef.MustFindProc("NationEcTrans")
4781
+	fmt.Println(readCard)
4782
+	fmt.Println("!!!!!")
4783
+	pBusiCardInfo := make([]byte, 2048)
4784
+	input := make(map[string]interface{})
4785
+	inputData := make(map[string]interface{})
4786
+	inputData["orgId"] = code
4787
+	inputData["businessType"] = "01101"
4788
+	inputData["operatorId"] = operator_id
4789
+	inputData["operatorName"] = operator_name
4790
+	inputData["officeId"] = "001"
4791
+	inputData["officeName"] = "血透室"
4792
+	inputData["deviceType"] = ""
4793
+	input["data"] = inputData
4794
+	input["orgId"] = code
4795
+	input["transType"] = "ec.query"
4796
+	bytesData, _ := json.Marshal(input)
4797
+
4798
+	ret2, _, _ := readCard.Call(StrPtr("https://10.93.32.89:20001/localcfc/api/hsecfc/localQrCodeQuery"), StrPtr(string(bytesData)), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
4799
+	fmt.Println(ret2)
4800
+	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
4801
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
4802
+	if ret2 != 0 {
4803
+		return "", ""
4804
+	}
4805
+	return DeleteExtraSpace(""), DeleteExtraSpace(string(pBusiCardInfo))
4806
+}
4807
+
4781 4808
 func GetJxEleBaseInfo(org_id int64) string {
4782 4809
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
4783 4810
 	readCard := DllDef.MustFindProc("NationEcTrans")