瀏覽代碼

Merge branch 'master' of http://git.shengws.com/csx/gdyb

XMLWAN 4 年之前
父節點
當前提交
bcaa504413
共有 5 個文件被更改,包括 367 次插入270 次删除
  1. 2 2
      conf/app.conf
  2. 295 208
      controllers/sz/sz_his_api_controller.go
  3. 4 0
      enums/error_code.go
  4. 56 50
      models/drug.go
  5. 10 10
      service/sz_his_service.go

+ 2 - 2
conf/app.conf 查看文件

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9532
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 #
6 6
 copyrequestbody = true
@@ -44,7 +44,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
44 44
 
45 45
 
46 46
 [prod]
47
-org_id = 9919
47
+org_id = 9504
48 48
 mobile_token_expiration_second = 86400
49 49
 httpdomain = https://api.xt.kuyicloud.com
50 50
 sso_domain = https://sso.kuyicloud.com

+ 295 - 208
controllers/sz/sz_his_api_controller.go 查看文件

@@ -9,6 +9,7 @@ import (
9 9
 	"gdyb/service"
10 10
 	"gdyb/utils"
11 11
 	"github.com/astaxie/beego"
12
+	"github.com/axgle/mahonia"
12 13
 	"math/rand"
13 14
 
14 15
 	//"github.com/axgle/mahonia"
@@ -272,6 +273,7 @@ func SZHisManagerApiRegistRouters() {
272 273
 	beego.Router("/sz/api/register/get", &SZHisApiController{}, "get:GetRegisterInfo")
273 274
 	//上传明细,预结算
274 275
 	//beego.Router("/sz/api/upload/get", &SZHisApiController{}, "get:GetUploadInfo")
276
+
275 277
 	//结算
276 278
 	beego.Router("/sz/api/settle/get", &SZHisApiController{}, "get:GetSettleInfo")
277 279
 
@@ -283,9 +285,10 @@ func SZHisManagerApiRegistRouters() {
283 285
 	beego.Router("sz/api/refundnumber/get", &SZHisApiController{}, "get:RefundNumber")
284 286
 
285 287
 	beego.Router("/sz/api/monthrefund/get", &SZHisApiController{}, "get:MonthRefund")
288
+
286 289
 	//查询交易
287 290
 	beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
288
-	//撤销明细
291
+	beego.Router("/sz/api/detail/upload", &SZHisApiController{}, "get:GetUploadDetail")
289 292
 	beego.Router("/sz/api/detail/cancel", &SZHisApiController{}, "get:CancelOrderDetail")
290 293
 	//
291 294
 	////机构药品目录备案
@@ -347,12 +350,12 @@ func (c *SZHisApiController) ReadCard() {
347 350
 	if ret4 == 0 {
348 351
 		patient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
349 352
 		if patient.ID == 0 {
350
-			patient.HealthCareNo = health_card_no
351 353
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
352 354
 			return
353 355
 		} else {
354 356
 			c.ServeSuccessJSON(map[string]interface{}{
355
-				"patient": patient,
357
+				"patient":        patient,
358
+				"health_card_no": health_card_no,
356 359
 			})
357 360
 		}
358 361
 	} else {
@@ -806,10 +809,10 @@ func (c *SZHisApiController) GetRegisterInfo() {
806 809
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
807 810
 		return
808 811
 	}
809
-
812
+	//doctorInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
813
+	doctorDepartment, _ := service.GetDepartMentDetail(department)
810 814
 	adminRole, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
811 815
 	his, _ := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient_id, theTime.Unix())
812
-
813 816
 	var custom_code string
814 817
 	var custom_project_name string
815 818
 	var allPrice float64
@@ -844,42 +847,36 @@ func (c *SZHisApiController) GetRegisterInfo() {
844 847
 
845 848
 		break
846 849
 	}
847
-
848 850
 	if his.ID == 0 {
849
-
850
-		var doctor_name string
851
-		var doctor_code string
851
+		var opera_name string
852
+		var opera_code string
852 853
 		if adminRole.ID == 0 {
853
-
854
-			doctor_name = "管理员"
855
-			doctor_code = "01"
856
-
854
+			opera_name = "管理员"
855
+			opera_code = "01"
857 856
 		} else {
858
-			doctor_name = adminRole.UserName
859
-			doctor_code = strconv.FormatInt(admin_user_id, 10)
860
-
857
+			opera_name = adminRole.UserName
858
+			opera_code = strconv.FormatInt(admin_user_id, 10)
861 859
 		}
862 860
 		month := time.Unix(1557042972, 0).Format("1")
863 861
 		year := time.Now().Format("2006")
864 862
 		month = time.Now().Format("01")
865 863
 		day := time.Now().Format("02")
866
-
867 864
 		//流水号
868
-		//
869 865
 		number := miConfig.Code + year + month + day +
870 866
 			fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
871 867
 		mz_number := miConfig.Code + year + month + day +
872 868
 			fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
873 869
 		//1.判断读卡类型
874 870
 		//2.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
875
-		yiliao_number, id_card_number, verifyCode, version_code, _, ret4 := ReadBasCardGetNumber("MZ002" + "|" + number + "|" + miConfig.Code + "|")
871
+		yiliao_number, id_card_number, verifyCode, version_code, health_card_no, _, ret4 := ReadBasCardGetNumber("MZ002" + "|" + number + "|" + miConfig.Code + "|")
876 872
 		fmt.Println(yiliao_number)
877 873
 		fmt.Println(id_card_number)
878 874
 		fmt.Println(verifyCode)
879 875
 		fmt.Println(version_code)
880 876
 		fmt.Println(ret4)
881 877
 
882
-		dept_code := "0306"
878
+		dept_code := doctorDepartment.Number
879
+
883 880
 		is_yidi = 1
884 881
 		tempPatient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
885 882
 		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
@@ -891,7 +888,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
891 888
 				if is_yidi == 1 {
892 889
 					//本地就医流程
893 890
 					//挂号
894
-					resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, dept_code, yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
891
+					resp_result := service.SzybMZ002(opera_name, opera_code, miConfig.Code, dept_code, yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
895 892
 					var dat map[string]interface{}
896 893
 					if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
897 894
 						fmt.Println(dat)
@@ -934,6 +931,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
934 931
 							YiliaoNumber:           yiliao_number,
935 932
 							MzNumber:               number,
936 933
 							Number:                 mz_number,
934
+							PsnNo:                  health_card_no,
937 935
 						}
938 936
 						service.CreateHisPatientTwo(&his)
939 937
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -955,7 +953,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
955 953
 
956 954
 					//tempPatient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
957 955
 					//if tempPatient.ID == patient_id {
958
-					resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
956
+					resp_result := service.SzybMZ002(opera_name, opera_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
959 957
 					var dat map[string]interface{}
960 958
 					if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
961 959
 						fmt.Println(dat)
@@ -1000,6 +998,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1000 998
 							YiliaoNumber:           yiliao_number,
1001 999
 							MzNumber:               number,
1002 1000
 							Number:                 mz_number,
1001
+							PsnNo:                  health_card_no,
1003 1002
 						}
1004 1003
 						service.CreateHisPatientTwo(&his)
1005 1004
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1020,7 +1019,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1020 1019
 				//fmt.Println(readCardBasResult)
1021 1020
 				//是否异地就医,是的话走鉴权流程,不是的话走门诊挂号
1022 1021
 				if is_yidi == 1 { //1本地就医
1023
-					resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
1022
+					resp_result := service.SzybMZ002(opera_name, opera_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
1024 1023
 					var dat map[string]interface{}
1025 1024
 					if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
1026 1025
 						fmt.Println(dat)
@@ -1065,6 +1064,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1065 1064
 							YiliaoNumber:           yiliao_number,
1066 1065
 							MzNumber:               number,
1067 1066
 							Number:                 mz_number,
1067
+							PsnNo:                  health_card_no,
1068 1068
 						}
1069 1069
 						service.CreateHisPatientTwo(&his)
1070 1070
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1081,7 +1081,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1081 1081
 				} else { //异地就医需要走鉴权流程
1082 1082
 					//authResult := CardAuth(number)
1083 1083
 					//fmt.Println(authResult)
1084
-					resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
1084
+					resp_result := service.SzybMZ002(opera_name, opera_code, miConfig.Code, "0305", yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
1085 1085
 					var dat map[string]interface{}
1086 1086
 					if err := json.Unmarshal([]byte(resp_result), &dat); err == nil {
1087 1087
 						fmt.Println(dat)
@@ -1126,6 +1126,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1126 1126
 							YiliaoNumber:           yiliao_number,
1127 1127
 							MzNumber:               number,
1128 1128
 							Number:                 mz_number,
1129
+							PsnNo:                  health_card_no,
1129 1130
 						}
1130 1131
 						service.CreateHisPatientTwo(&his)
1131 1132
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1152,7 +1153,6 @@ func (c *SZHisApiController) GetRegisterInfo() {
1152 1153
 }
1153 1154
 
1154 1155
 func (c *SZHisApiController) RefundNumber() {
1155
-	order_id, _ := c.GetInt64("order_id")
1156 1156
 	record_time := c.GetString("record_time")
1157 1157
 	patient_id, _ := c.GetInt64("patient_id")
1158 1158
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -1167,12 +1167,7 @@ func (c *SZHisApiController) RefundNumber() {
1167 1167
 	}
1168 1168
 	recordDateTime := theTime.Unix()
1169 1169
 	fmt.Println(recordDateTime)
1170
-	var order models.HisOrder
1171
-	order, _ = service.GetHisOrderByID(order_id)
1172
-	if order.ID == 0 {
1173
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
1174
-		return
1175
-	}
1170
+
1176 1171
 	his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, theTime.Unix())
1177 1172
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1178 1173
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -1201,7 +1196,7 @@ func (c *SZHisApiController) RefundNumber() {
1201 1196
 	verifyCode, version_code := ReadCardGetCode("JY002" + "|" + number + "|" + miConfig.Code)
1202 1197
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1203 1198
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1204
-		result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, his.MzNumber, order.Number, verifyCode, number, version_code)
1199
+		result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, his.MzNumber, his.Number, verifyCode, number, version_code)
1205 1200
 		var dat map[string]interface{}
1206 1201
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1207 1202
 			fmt.Println(dat)
@@ -1702,6 +1697,13 @@ func (c *SZHisApiController) GetSettleInfo() {
1702 1697
 
1703 1698
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1704 1699
 
1700
+	sick, _ := service.FindSickById(patientPrescription.SickType)
1701
+
1702
+	if sick.ID == 0 {
1703
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamSickTypeWrong)
1704
+		return
1705
+	}
1706
+
1705 1707
 	adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
1706 1708
 
1707 1709
 	adminRole, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
@@ -1764,7 +1766,9 @@ func (c *SZHisApiController) GetSettleInfo() {
1764 1766
 				if len(subItem.HisProject.MedicalCode) > 0 {
1765 1767
 					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
1766 1768
 
1767
-					count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
1769
+					//count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
1770
+
1771
+					count, _ := strconv.ParseFloat(strconv.FormatInt(subItem.Count, 10), 64)
1768 1772
 					temp := strings.Split(subItem.FeedetlSn, "-")
1769 1773
 					newFl := fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) + "-" + temp[1] + "-" + temp[2]
1770 1774
 
@@ -1974,13 +1978,13 @@ func (c *SZHisApiController) GetSettleInfo() {
1974 1978
 			}
1975 1979
 		}
1976 1980
 
1977
-		yiliao_number, id_card_number, verifyCode, version_code, _, ret4 := ReadBasCardGetNumber("FY005" + "|" + number + "|" + miConfig.Code + "|")
1981
+		yiliao_number, id_card_number, verifyCode, version_code, health_card_no, _, ret4 := ReadBasCardGetNumber("FY005" + "|" + number + "|" + miConfig.Code + "|")
1982
+
1978 1983
 		if ret4 == 0 {
1979 1984
 			//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1980 1985
 			tempPatient, _ := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
1981 1986
 			if tempPatient.ID == patient_id {
1982
-
1983
-				result_three := service.SzybFY005(doctor_name, doctor_code, miConfig.Code, total, yiliao_number, verifyCode, number, mz_number, version_code, drug_doctor_code, drug_doctor_name, his.MedicalTreatmentType)
1987
+				result_three := service.SzybFY005(doctor_name, doctor_code, miConfig.Code, total, yiliao_number, verifyCode, number, mz_number, version_code, drug_doctor_code, drug_doctor_name, his.MedicalTreatmentType, sick.CountryCode)
1984 1988
 				var dat map[string]interface{}
1985 1989
 				if err := json.Unmarshal([]byte(result_three), &dat); err == nil {
1986 1990
 					fmt.Println(dat)
@@ -2000,6 +2004,7 @@ func (c *SZHisApiController) GetSettleInfo() {
2000 2004
 					order.PayWay = pay_way
2001 2005
 					order.PayPrice = pay_price
2002 2006
 					order.PayCardNo = pay_card_no
2007
+					order.PsnNo = health_card_no
2003 2008
 					order.DiscountPrice = discount_price
2004 2009
 					order.PreferentialPrice = preferential_price
2005 2010
 					order.RealityPrice = reality_price
@@ -2743,6 +2748,17 @@ func (c *SZHisApiController) Refund() {
2743 2748
 	//
2744 2749
 	//verifyCode := "000000|9972fca7ba9471c7dbe08324b2e31f70"
2745 2750
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2751
+	order_infos, _ := service.GetHisOrderInfoByNumber(order.Number)
2752
+	var customs []*models.CustomDetail
2753
+
2754
+	for _, item := range order_infos {
2755
+		cus := &models.CustomDetail{
2756
+			PrescriptionNumber: item.OrderNumber,
2757
+			ChargeSerialNumber: item.FeedetlSn,
2758
+		}
2759
+		customs = append(customs, cus)
2760
+	}
2761
+
2746 2762
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2747 2763
 
2748 2764
 		result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, order.OrgSetlNumber, order.MzNumber, verifyCode, number, version_code)
@@ -2764,6 +2780,7 @@ func (c *SZHisApiController) Refund() {
2764 2780
 		if res.Transreturncode == "00000000" {
2765 2781
 			service.UpdataOrderlog(order_id, adminUser.CurrentOrgId, result)
2766 2782
 			service.UpdataOrderStatusSZ(order_id, order.Number, adminUser.CurrentOrgId, his.MzNumber, his.Number)
2783
+			service.UpdataOrderInfoStatus(order.ID, order.Number, adminUser.CurrentOrgId)
2767 2784
 			c.ServeSuccessJSON(map[string]interface{}{
2768 2785
 				"msg": "退费成功",
2769 2786
 			})
@@ -2874,9 +2891,50 @@ func (c *SZHisApiController) GetSettleAccounts() {
2874 2891
 
2875 2892
 	patient, _ := service.GetPatientByIDTwo(adminUser.CurrentOrgId, patient_id)
2876 2893
 
2877
-	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2894
+	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, order.SettleAccountsDate)
2878 2895
 	adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
2879 2896
 
2897
+	his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, order.SettleAccountsDate)
2898
+	yiliao_leibie := ""
2899
+
2900
+	switch his.MedicalTreatmentType {
2901
+	case 11:
2902
+		yiliao_leibie = "普通门诊"
2903
+		break
2904
+	case 12:
2905
+		yiliao_leibie = "家庭通道"
2906
+		break
2907
+	case 13:
2908
+		yiliao_leibie = "门诊大病"
2909
+		break
2910
+	case 14:
2911
+		yiliao_leibie = "重疾特药"
2912
+		break
2913
+	case 15:
2914
+		yiliao_leibie = "门诊慢病"
2915
+		break
2916
+	case 16:
2917
+		yiliao_leibie = "门诊特检"
2918
+		break
2919
+	case 17:
2920
+		yiliao_leibie = "健康体检"
2921
+		break
2922
+	case 18:
2923
+		yiliao_leibie = "预防接种"
2924
+		break
2925
+	case 19:
2926
+		yiliao_leibie = "门诊输血"
2927
+		break
2928
+	case 91:
2929
+		yiliao_leibie = "新冠肺炎门诊"
2930
+		break
2931
+
2932
+	}
2933
+
2934
+	//departments, _ := service.Get(patientPrescription.Departments)
2935
+
2936
+	departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
2937
+
2880 2938
 	if order.ID == 0 {
2881 2939
 		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
2882 2940
 
@@ -2925,12 +2983,16 @@ func (c *SZHisApiController) GetSettleAccounts() {
2925 2983
 		}
2926 2984
 		if res.Transreturncode == "00000000" {
2927 2985
 			c.ServeSuccessJSON(map[string]interface{}{
2928
-				"result":       res,
2929
-				"org_name":     miConfig.OrgName,
2930
-				"org_code":     miConfig.Code,
2931
-				"patient_name": patient.Name,
2932
-				"doctor_code":  adminRole_two.DoctorCode,
2933
-				"doctor_name":  doctor_name,
2986
+				"result":         res,
2987
+				"org_name":       miConfig.OrgName,
2988
+				"org_code":       miConfig.Code,
2989
+				"patient_name":   patient.Name,
2990
+				"doctor_code":    adminRole_two.DoctorCode,
2991
+				"doctor_name":    doctor_name,
2992
+				"health_card_no": order.PsnNo,
2993
+				"order_number":   order.Number,
2994
+				"department":     departments.Name,
2995
+				"yiliao_leibie":  yiliao_leibie,
2934 2996
 			})
2935 2997
 		} else {
2936 2998
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -3111,6 +3173,33 @@ func (c *SZHisApiController) CancelOrderDetail() {
3111 3173
 //	}
3112 3174
 //	return "", "", "", "", err, -10
3113 3175
 //}
3176
+func ReadBasCardGetNumber(request string) (string, string, string, string, string, error, int64) {
3177
+	DllDef2 := syscall.MustLoadDLL("SSCardDriver_SZ.dll")
3178
+	readCards := DllDef2.MustFindProc("iReadCardBas")
3179
+	str := request
3180
+	str3 := make([]byte, 1024)
3181
+	fmt.Println(":", request)
3182
+	fmt.Println(":", StrPtr(str))
3183
+
3184
+	ret4, _, err := readCards.Call(IntPtr(1), StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
3185
+	fmt.Println(":", string(str3))
3186
+	fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
3187
+	if ret4 == 0 {
3188
+		result := string(str3)
3189
+		fmt.Println(result)
3190
+		result_arr := strings.Split(result, "|")
3191
+		//医疗证号
3192
+		yiliao_number := result_arr[12]
3193
+		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
3194
+		id_card_number := result_arr[1]
3195
+		verifyCode := result_arr[11] + "|" + result_arr[13]
3196
+		versionCode := result_arr[14]
3197
+		health_card_no := result_arr[2]
3198
+
3199
+		return yiliao_number, id_card_number, verifyCode, versionCode, health_card_no, err, 0
3200
+	}
3201
+	return "", "", "", "", "", err, -10
3202
+}
3114 3203
 
3115 3204
 //读卡
3116 3205
 func ReadBasCard(request string) (string, string, error, int64) {
@@ -3236,15 +3325,15 @@ func (c *SZHisApiController) GetDrugList() {
3236 3325
 		detail := &models.DrugDetail{
3237 3326
 
3238 3327
 			MedicalInsuranceNumber: item.MedicalInsuranceNumber,
3239
-			Code:                   item.Code,
3240
-			DrugName:               item.DrugName,
3241
-			DrugSpec:               item.DrugSpec,
3242
-			DrugDosageName:         item.DrugDosageName,
3243
-			ManufacturerName:       item.ManufacturerName,
3244
-			MinUnit:                item.MinUnit,
3245
-			RetailPrice:            item.RetailPrice,
3246
-			LastPrice:              item.LastPrice,
3247
-			LimitRemark:            item.LimitRemark,
3328
+			Code:             item.Code,
3329
+			DrugName:         item.DrugName,
3330
+			DrugSpec:         item.DrugSpec,
3331
+			DrugDosageName:   item.DrugDosageName,
3332
+			ManufacturerName: item.ManufacturerName,
3333
+			MinUnit:          item.MinUnit,
3334
+			RetailPrice:      item.RetailPrice,
3335
+			LastPrice:        item.LastPrice,
3336
+			LimitRemark:      item.LimitRemark,
3248 3337
 		}
3249 3338
 
3250 3339
 		result := service.SzybML008(doctor_name, doctor_code, miConfig.Code, detail)
@@ -3408,15 +3497,14 @@ func (c *SZHisApiController) GetRevocation() {
3408 3497
 					detail := &models.DrugDetail{
3409 3498
 
3410 3499
 						SocialSecurityDirectoryCode: item.MedicalInsuranceNumber, //社保目录
3411
-						Code:                        item.Code,                   //协议机构内部目录编码
3412
-						DrugName:                    item.DrugName,               //协议机构内部目录名称
3413
-						DrugSpec:                    item.DrugSpec,
3414
-						ManufacturerName:            item.ManufacturerName,
3415
-						MinUnit:                     item.MinUnit,
3416
-						RetailPrice:                 item.RetailPrice, //协议机构内部项目收费价格
3417
-						LimitRemark:                 item.LimitRemark,
3418
-						MedicalInsuranceNumber:      item.MedicalInsuranceNumber, //社保目录
3419
-
3500
+						Code:                   item.Code,     //协议机构内部目录编码
3501
+						DrugName:               item.DrugName, //协议机构内部目录名称
3502
+						DrugSpec:               item.DrugSpec,
3503
+						ManufacturerName:       item.ManufacturerName,
3504
+						MinUnit:                item.MinUnit,
3505
+						RetailPrice:            item.RetailPrice, //协议机构内部项目收费价格
3506
+						LimitRemark:            item.LimitRemark,
3507
+						MedicalInsuranceNumber: item.MedicalInsuranceNumber, //社保目录
3420 3508
 					}
3421 3509
 					customs = append(customs, detail)
3422 3510
 				}
@@ -3494,15 +3582,15 @@ func (c *SZHisApiController) GetRevocation() {
3494 3582
 				detail := &models.DrugDetail{
3495 3583
 					MedicalInsuranceNumber:      item.MedicalInsuranceNumber,
3496 3584
 					SocialSecurityDirectoryCode: item.MedicalInsuranceNumber,
3497
-					Code:                        item.Code,
3498
-					DrugName:                    item.DrugName,
3499
-					DrugSpec:                    item.DrugSpec,
3500
-					DrugDosageName:              item.DrugDosageName,
3501
-					ManufacturerName:            item.ManufacturerName,
3502
-					MinUnit:                     item.MinUnit,
3503
-					RetailPrice:                 item.RetailPrice,
3504
-					LastPrice:                   item.LastPrice,
3505
-					LimitRemark:                 item.LimitRemark,
3585
+					Code:             item.Code,
3586
+					DrugName:         item.DrugName,
3587
+					DrugSpec:         item.DrugSpec,
3588
+					DrugDosageName:   item.DrugDosageName,
3589
+					ManufacturerName: item.ManufacturerName,
3590
+					MinUnit:          item.MinUnit,
3591
+					RetailPrice:      item.RetailPrice,
3592
+					LastPrice:        item.LastPrice,
3593
+					LimitRemark:      item.LimitRemark,
3506 3594
 				}
3507 3595
 
3508 3596
 				result := service.SzybML008(doctor_name, doctor_code, miConfig.Code, detail)
@@ -3870,39 +3958,39 @@ func (c *SZHisApiController) GetDoctorList() {
3870 3958
 	for _, item := range list {
3871 3959
 		fmt.Println("医护类别", item.StudyMajorName)
3872 3960
 		detail := &models.DocDetail{
3873
-			UserName:                                item.UserName,                                                       //医护姓名
3874
-			RoleId:                                  item.Name,                                                           //医护人员类别
3875
-			Sex:                                     strconv.FormatInt(item.Sex, 10),                                     //性别
3876
-			CardType:                                strconv.FormatInt(item.CardType, 10),                                //证件类型
3877
-			IdCard:                                  item.IdCard,                                                         //证件号码
3878
-			Phone:                                   item.Mobile,                                                         //联系电话
3879
-			WorkMajorName:                           item.WorkMajorName,                                                  // 现从事专业名称
3880
-			Nation:                                  item.Nation,                                                         //民族
3881
-			BirthDay:                                20201022,                                                            // 出生日期
3882
-			WorkTime:                                20201022,                                                            //参加工作日期
3883
-			Education:                               strconv.FormatInt(item.Education, 10),                               //学历
3884
-			StudyMajorName:                          item.StudyMajorName,                                                 //所学的专业名称
3885
-			CertificateCode:                         item.MedicalCode,                                                    //医(药)师执业证书编码
3886
-			MedicalCode:                             item.DoctorCode,                                                     //医(药)师资格证编码
3887
-			MedicalRangeCode:                        strconv.FormatInt(item.DoctorRangeCode, 10),                         //医师执业范围代码
3888
-			MedicalLevel:                            strconv.FormatInt(item.DoctorLevel, 10),                             //医生执业资格证中的医师级别
3889
-			TypeJob:                                 strconv.FormatInt(item.DoctorTypeJob, 10),                           //医生执业资格证中的执业类别
3890
-			DoctorNumber:                            item.DoctorNumber,                                                   //医保医师编号
3891
-			Licensing:                               strconv.FormatInt(item.Licensing, 10),                               //多点执业标志
3892
-			DoctorServiceStatus:                     "",                                                                  //医师医保服务资格状态
3893
-			MonitoringLevel:                         "",                                                                  //监控等级
3894
-			DrugPsychotropicSubstances:              "",                                                                  //毒麻精神药品资格
3895
-			HealthCareCode:                          "",                                                                  // 母婴保健技术考核合格证书编号
3896
-			PlanningTechnicalServiceCode:            "",                                                                  //计划生育技术服务人员合格证编号
3897
-			PharmacistType:                          "",                                                                  //药师类别
3898
-			PharmacistPracticeCategory:              "",                                                                  //药师执业类别
3899
-			PharmacistsLicensing:                    "",                                                                  //药师执业范围
3900
-			PharmacistRegistrationNumber:            "",                                                                  //执业药师注册证编号
3901
-			OfficeCode:                              "",                                                                  //科室编码
3902
-			JobNumber:                               item.JobNumber,                                                      //工号
3903
-			PostName:                                "",                                                                  //职位名称
3904
-			TechnicalJobLevelCode:                   "",                                                                  //专业技术职务级别编码
3905
-			IsActive:                                strconv.FormatInt(item.IsActive, 10),                                //在职与否
3961
+			UserName:                     item.UserName,                               //医护姓名
3962
+			RoleId:                       item.Name,                                   //医护人员类别
3963
+			Sex:                          strconv.FormatInt(item.Sex, 10),             //性别
3964
+			CardType:                     strconv.FormatInt(item.CardType, 10),        //证件类型
3965
+			IdCard:                       item.IdCard,                                 //证件号码
3966
+			Phone:                        item.Mobile,                                 //联系电话
3967
+			WorkMajorName:                item.WorkMajorName,                          // 现从事专业名称
3968
+			Nation:                       item.Nation,                                 //民族
3969
+			BirthDay:                     20201022,                                    // 出生日期
3970
+			WorkTime:                     20201022,                                    //参加工作日期
3971
+			Education:                    strconv.FormatInt(item.Education, 10),       //学历
3972
+			StudyMajorName:               item.StudyMajorName,                         //所学的专业名称
3973
+			CertificateCode:              item.MedicalCode,                            //医(药)师执业证书编码
3974
+			MedicalCode:                  item.DoctorCode,                             //医(药)师资格证编码
3975
+			MedicalRangeCode:             strconv.FormatInt(item.DoctorRangeCode, 10), //医师执业范围代码
3976
+			MedicalLevel:                 strconv.FormatInt(item.DoctorLevel, 10),     //医生执业资格证中的医师级别
3977
+			TypeJob:                      strconv.FormatInt(item.DoctorTypeJob, 10),   //医生执业资格证中的执业类别
3978
+			DoctorNumber:                 item.DoctorNumber,                           //医保医师编号
3979
+			Licensing:                    strconv.FormatInt(item.Licensing, 10),       //多点执业标志
3980
+			DoctorServiceStatus:          "",                                          //医师医保服务资格状态
3981
+			MonitoringLevel:              "",                                          //监控等级
3982
+			DrugPsychotropicSubstances:   "",                                          //毒麻精神药品资格
3983
+			HealthCareCode:               "",                                          // 母婴保健技术考核合格证书编号
3984
+			PlanningTechnicalServiceCode: "",                                          //计划生育技术服务人员合格证编号
3985
+			PharmacistType:               "",                                          //药师类别
3986
+			PharmacistPracticeCategory:   "",                                          //药师执业类别
3987
+			PharmacistsLicensing:         "",                                          //药师执业范围
3988
+			PharmacistRegistrationNumber: "",                                          //执业药师注册证编号
3989
+			OfficeCode:                   "",                                          //科室编码
3990
+			JobNumber:                    item.JobNumber,                              //工号
3991
+			PostName:                     "",                                          //职位名称
3992
+			TechnicalJobLevelCode:        "",                                          //专业技术职务级别编码
3993
+			IsActive:                     strconv.FormatInt(item.IsActive, 10),        //在职与否
3906 3994
 			PrescriptionQualificationIdentification: strconv.FormatInt(item.PrescriptionQualificationIdentification, 10), //处方资格标识
3907 3995
 			IdentificationOutpatients:               strconv.FormatInt(item.IdentificationOutpatients, 10),               //门诊大病医师标识
3908 3996
 			OutpatientIllnessCategory:               item.OutpatientIllnessCategory,                                      //门诊大病类别
@@ -3984,39 +4072,39 @@ func (c *SZHisApiController) GetMedicalList() {
3984 4072
 			fmt.Println("医护类别", item.Mobile)
3985 4073
 
3986 4074
 			detail := &models.DocDetail{
3987
-				UserName:                                item.UserName,                                                       //医护姓名
3988
-				RoleId:                                  item.Name,                                                           //医护人员类别
3989
-				Sex:                                     strconv.FormatInt(item.Sex, 10),                                     //性别
3990
-				CardType:                                strconv.FormatInt(item.CardType, 10),                                //证件类型
3991
-				IdCard:                                  item.IdCard,                                                         //证件号码
3992
-				Phone:                                   item.Mobile,                                                         //联系电话
3993
-				WorkMajorName:                           item.WorkMajorName,                                                  // 现从事专业名称
3994
-				Nation:                                  item.Nation,                                                         //民族
3995
-				BirthDay:                                20201022,                                                            // 出生日期
3996
-				WorkTime:                                20201022,                                                            //参加工作日期
3997
-				Education:                               strconv.FormatInt(item.Education, 10),                               //学历
3998
-				StudyMajorName:                          item.StudyMajorName,                                                 //所学的专业名称
3999
-				CertificateCode:                         item.MedicalCode,                                                    //医(药)师执业证书编码
4000
-				MedicalCode:                             item.DoctorCode,                                                     //医(药)师资格证编码
4001
-				MedicalRangeCode:                        strconv.FormatInt(item.DoctorRangeCode, 10),                         //医师执业范围代码
4002
-				MedicalLevel:                            strconv.FormatInt(item.DoctorLevel, 10),                             //医生执业资格证中的医师级别
4003
-				TypeJob:                                 strconv.FormatInt(item.DoctorTypeJob, 10),                           //医生执业资格证中的执业类别
4004
-				DoctorNumber:                            item.DoctorNumber,                                                   //医保医师编号
4005
-				Licensing:                               strconv.FormatInt(item.Licensing, 10),                               //多点执业标志
4006
-				DoctorServiceStatus:                     "",                                                                  //医师医保服务资格状态
4007
-				MonitoringLevel:                         "",                                                                  //监控等级
4008
-				DrugPsychotropicSubstances:              "",                                                                  //毒麻精神药品资格
4009
-				HealthCareCode:                          "",                                                                  // 母婴保健技术考核合格证书编号
4010
-				PlanningTechnicalServiceCode:            "",                                                                  //计划生育技术服务人员合格证编号
4011
-				PharmacistType:                          "",                                                                  //药师类别
4012
-				PharmacistPracticeCategory:              "",                                                                  //药师执业类别
4013
-				PharmacistsLicensing:                    "",                                                                  //药师执业范围
4014
-				PharmacistRegistrationNumber:            "",                                                                  //执业药师注册证编号
4015
-				OfficeCode:                              "",                                                                  //科室编码
4016
-				JobNumber:                               item.JobNumber,                                                      //工号
4017
-				PostName:                                "",                                                                  //职位名称
4018
-				TechnicalJobLevelCode:                   "",                                                                  //专业技术职务级别编码
4019
-				IsActive:                                strconv.FormatInt(item.IsActive, 10),                                //在职与否
4075
+				UserName:                     item.UserName,                               //医护姓名
4076
+				RoleId:                       item.Name,                                   //医护人员类别
4077
+				Sex:                          strconv.FormatInt(item.Sex, 10),             //性别
4078
+				CardType:                     strconv.FormatInt(item.CardType, 10),        //证件类型
4079
+				IdCard:                       item.IdCard,                                 //证件号码
4080
+				Phone:                        item.Mobile,                                 //联系电话
4081
+				WorkMajorName:                item.WorkMajorName,                          // 现从事专业名称
4082
+				Nation:                       item.Nation,                                 //民族
4083
+				BirthDay:                     20201022,                                    // 出生日期
4084
+				WorkTime:                     20201022,                                    //参加工作日期
4085
+				Education:                    strconv.FormatInt(item.Education, 10),       //学历
4086
+				StudyMajorName:               item.StudyMajorName,                         //所学的专业名称
4087
+				CertificateCode:              item.MedicalCode,                            //医(药)师执业证书编码
4088
+				MedicalCode:                  item.DoctorCode,                             //医(药)师资格证编码
4089
+				MedicalRangeCode:             strconv.FormatInt(item.DoctorRangeCode, 10), //医师执业范围代码
4090
+				MedicalLevel:                 strconv.FormatInt(item.DoctorLevel, 10),     //医生执业资格证中的医师级别
4091
+				TypeJob:                      strconv.FormatInt(item.DoctorTypeJob, 10),   //医生执业资格证中的执业类别
4092
+				DoctorNumber:                 item.DoctorNumber,                           //医保医师编号
4093
+				Licensing:                    strconv.FormatInt(item.Licensing, 10),       //多点执业标志
4094
+				DoctorServiceStatus:          "",                                          //医师医保服务资格状态
4095
+				MonitoringLevel:              "",                                          //监控等级
4096
+				DrugPsychotropicSubstances:   "",                                          //毒麻精神药品资格
4097
+				HealthCareCode:               "",                                          // 母婴保健技术考核合格证书编号
4098
+				PlanningTechnicalServiceCode: "",                                          //计划生育技术服务人员合格证编号
4099
+				PharmacistType:               "",                                          //药师类别
4100
+				PharmacistPracticeCategory:   "",                                          //药师执业类别
4101
+				PharmacistsLicensing:         "",                                          //药师执业范围
4102
+				PharmacistRegistrationNumber: "",                                          //执业药师注册证编号
4103
+				OfficeCode:                   "",                                          //科室编码
4104
+				JobNumber:                    item.JobNumber,                              //工号
4105
+				PostName:                     "",                                          //职位名称
4106
+				TechnicalJobLevelCode:        "",                                          //专业技术职务级别编码
4107
+				IsActive:                     strconv.FormatInt(item.IsActive, 10),        //在职与否
4020 4108
 				PrescriptionQualificationIdentification: strconv.FormatInt(item.PrescriptionQualificationIdentification, 10), //处方资格标识
4021 4109
 				IdentificationOutpatients:               strconv.FormatInt(item.IdentificationOutpatients, 10),               //门诊大病医师标识
4022 4110
 				OutpatientIllnessCategory:               item.OutpatientIllnessCategory,                                      //门诊大病类别
@@ -4084,46 +4172,45 @@ func (c *SZHisApiController) GetMedicalList() {
4084 4172
 		for _, item := range list {
4085 4173
 			fmt.Println("医护类别", item.Name)
4086 4174
 			detail := &models.DocDetail{
4087
-				UserName:                                item.UserName,                                                       //医护姓名
4088
-				RoleId:                                  item.Name,                                                           //医护人员类别
4089
-				Sex:                                     strconv.FormatInt(item.Sex, 10),                                     //性别
4090
-				CardType:                                strconv.FormatInt(item.CardType, 10),                                //证件类型
4091
-				IdCard:                                  item.IdCard,                                                         //证件号码
4092
-				Phone:                                   item.Mobile,                                                         //联系电话
4093
-				WorkMajorName:                           item.WorkMajorName,                                                  // 现从事专业名称
4094
-				Nation:                                  item.Nation,                                                         //民族
4095
-				BirthDay:                                20201022,                                                            // 出生日期
4096
-				WorkTime:                                20201022,                                                            //参加工作日期
4097
-				Education:                               strconv.FormatInt(item.Education, 10),                               //学历
4098
-				StudyMajorName:                          item.StudyMajorName,                                                 //所学的专业名称
4099
-				CertificateCode:                         item.MedicalCode,                                                    //医(药)师执业证书编码
4100
-				MedicalCode:                             item.DoctorCode,                                                     //医(药)师资格证编码
4101
-				MedicalRangeCode:                        strconv.FormatInt(item.DoctorRangeCode, 10),                         //医师执业范围代码
4102
-				MedicalLevel:                            strconv.FormatInt(item.DoctorLevel, 10),                             //医生执业资格证中的医师级别
4103
-				TypeJob:                                 strconv.FormatInt(item.DoctorTypeJob, 10),                           //医生执业资格证中的执业类别
4104
-				DoctorNumber:                            item.DoctorNumber,                                                   //医保医师编号
4105
-				Licensing:                               strconv.FormatInt(item.Licensing, 10),                               //多点执业标志
4106
-				DoctorServiceStatus:                     "",                                                                  //医师医保服务资格状态
4107
-				MonitoringLevel:                         "",                                                                  //监控等级
4108
-				DrugPsychotropicSubstances:              "",                                                                  //毒麻精神药品资格
4109
-				HealthCareCode:                          "",                                                                  // 母婴保健技术考核合格证书编号
4110
-				PlanningTechnicalServiceCode:            "",                                                                  //计划生育技术服务人员合格证编号
4111
-				PharmacistType:                          "",                                                                  //药师类别
4112
-				PharmacistPracticeCategory:              "",                                                                  //药师执业类别
4113
-				PharmacistsLicensing:                    "",                                                                  //药师执业范围
4114
-				PharmacistRegistrationNumber:            "",                                                                  //执业药师注册证编号
4115
-				OfficeCode:                              "",                                                                  //科室编码
4116
-				JobNumber:                               item.JobNumber,                                                      //工号
4117
-				PostName:                                "",                                                                  //职位名称
4118
-				TechnicalJobLevelCode:                   "",                                                                  //专业技术职务级别编码
4119
-				IsActive:                                strconv.FormatInt(item.IsActive, 10),                                //在职与否
4175
+				UserName:                     item.UserName,                               //医护姓名
4176
+				RoleId:                       item.Name,                                   //医护人员类别
4177
+				Sex:                          strconv.FormatInt(item.Sex, 10),             //性别
4178
+				CardType:                     strconv.FormatInt(item.CardType, 10),        //证件类型
4179
+				IdCard:                       item.IdCard,                                 //证件号码
4180
+				Phone:                        item.Mobile,                                 //联系电话
4181
+				WorkMajorName:                item.WorkMajorName,                          // 现从事专业名称
4182
+				Nation:                       item.Nation,                                 //民族
4183
+				BirthDay:                     20201022,                                    // 出生日期
4184
+				WorkTime:                     20201022,                                    //参加工作日期
4185
+				Education:                    strconv.FormatInt(item.Education, 10),       //学历
4186
+				StudyMajorName:               item.StudyMajorName,                         //所学的专业名称
4187
+				CertificateCode:              item.MedicalCode,                            //医(药)师执业证书编码
4188
+				MedicalCode:                  item.DoctorCode,                             //医(药)师资格证编码
4189
+				MedicalRangeCode:             strconv.FormatInt(item.DoctorRangeCode, 10), //医师执业范围代码
4190
+				MedicalLevel:                 strconv.FormatInt(item.DoctorLevel, 10),     //医生执业资格证中的医师级别
4191
+				TypeJob:                      strconv.FormatInt(item.DoctorTypeJob, 10),   //医生执业资格证中的执业类别
4192
+				DoctorNumber:                 item.DoctorNumber,                           //医保医师编号
4193
+				Licensing:                    strconv.FormatInt(item.Licensing, 10),       //多点执业标志
4194
+				DoctorServiceStatus:          "",                                          //医师医保服务资格状态
4195
+				MonitoringLevel:              "",                                          //监控等级
4196
+				DrugPsychotropicSubstances:   "",                                          //毒麻精神药品资格
4197
+				HealthCareCode:               "",                                          // 母婴保健技术考核合格证书编号
4198
+				PlanningTechnicalServiceCode: "",                                          //计划生育技术服务人员合格证编号
4199
+				PharmacistType:               "",                                          //药师类别
4200
+				PharmacistPracticeCategory:   "",                                          //药师执业类别
4201
+				PharmacistsLicensing:         "",                                          //药师执业范围
4202
+				PharmacistRegistrationNumber: "",                                          //执业药师注册证编号
4203
+				OfficeCode:                   "",                                          //科室编码
4204
+				JobNumber:                    item.JobNumber,                              //工号
4205
+				PostName:                     "",                                          //职位名称
4206
+				TechnicalJobLevelCode:        "",                                          //专业技术职务级别编码
4207
+				IsActive:                     strconv.FormatInt(item.IsActive, 10),        //在职与否
4120 4208
 				PrescriptionQualificationIdentification: strconv.FormatInt(item.PrescriptionQualificationIdentification, 10), //处方资格标识
4121 4209
 				IdentificationOutpatients:               strconv.FormatInt(item.IdentificationOutpatients, 10),               //门诊大病医师标识
4122 4210
 				OutpatientIllnessCategory:               item.OutpatientIllnessCategory,                                      //门诊大病类别
4123 4211
 				StartTime:                               20201010,                                                            //开始日期
4124 4212
 				StaffCode:                               "",                                                                  //医护人员编码
4125 4213
 				EndTime:                                 0,                                                                   // 结束日期
4126
-
4127 4214
 			}
4128 4215
 			result := service.SzybYS002(doctor_name, doctor_code, miConfig.Code, detail)
4129 4216
 			fmt.Println("reuslt9999999999999999", result)
@@ -4210,44 +4297,44 @@ func (c *SZHisApiController) GetUpdateMedicalList() {
4210 4297
 		for _, item := range list {
4211 4298
 			fmt.Println("医护类别", item.Name)
4212 4299
 			detail := &models.DocDetail{
4213
-				StaffCode:                               "",            //医护人员编码
4214
-				UserName:                                item.UserName, //医护人员姓名
4215
-				RoleId:                                  item.Name,     //医护人员类别
4216
-				Sex:                                     "",            //性别
4217
-				CardType:                                "",            //证件类型
4218
-				IdCard:                                  "",            //证件号码
4219
-				Phone:                                   "",            //联系电话
4220
-				WorkMajorName:                           "",            //现从事专业名称
4221
-				Nation:                                  "",            //民族
4222
-				BirthDay:                                20201022,      //出生日期
4223
-				WorkTime:                                12,            //参加工作日期
4224
-				Education:                               "",            //学历
4225
-				StudyMajorName:                          "",            //所学的专业名称
4226
-				CertificateCode:                         "",            //证书编码
4227
-				MedicalCode:                             "",            //医师资格编码
4228
-				MedicalRangeCode:                        "",            //医师执业范围代码
4229
-				MedicalLevel:                            "",            //医生级别
4230
-				TypeJob:                                 "",            //职业类别
4231
-				DoctorNumber:                            "",            //医师编号
4232
-				Licensing:                               "",            //职业标志
4233
-				DoctorServiceStatus:                     "",            //医师医保服务资格状态
4234
-				MonitoringLevel:                         "",            //监控等级
4235
-				DrugPsychotropicSubstances:              "",            //毒麻精神药品资格
4236
-				HealthCareCode:                          "",            // 母婴保健技术考核合格证书编号
4237
-				PlanningTechnicalServiceCode:            "",            //计划生育技术服务人员合格证编号
4238
-				PharmacistType:                          "",            //药师类别
4239
-				PharmacistPracticeCategory:              "",            //药师执业类别
4240
-				PharmacistsLicensing:                    "",            //药师执业范围
4241
-				PharmacistRegistrationNumber:            "",            //执业药师注册证编号
4242
-				OfficeCode:                              "",            //科室编码
4243
-				JobNumber:                               "",            //工号
4244
-				PostName:                                "",            //职位名称
4245
-				TechnicalJobLevelCode:                   "",            //专业技术职务级别编码
4246
-				IsActive:                                "",            //在职与否
4247
-				PrescriptionQualificationIdentification: "",            //处方资格标识
4248
-				IdentificationOutpatients:               "",            //门诊大病医师标识
4249
-				OutpatientIllnessCategory:               "",            //门诊大病类别
4250
-				StartTime:                               1233,          //开始日期
4300
+				StaffCode:                    "",            //医护人员编码
4301
+				UserName:                     item.UserName, //医护人员姓名
4302
+				RoleId:                       item.Name,     //医护人员类别
4303
+				Sex:                          "",            //性别
4304
+				CardType:                     "",            //证件类型
4305
+				IdCard:                       "",            //证件号码
4306
+				Phone:                        "",            //联系电话
4307
+				WorkMajorName:                "",            //现从事专业名称
4308
+				Nation:                       "",            //民族
4309
+				BirthDay:                     20201022,      //出生日期
4310
+				WorkTime:                     12,            //参加工作日期
4311
+				Education:                    "",            //学历
4312
+				StudyMajorName:               "",            //所学的专业名称
4313
+				CertificateCode:              "",            //证书编码
4314
+				MedicalCode:                  "",            //医师资格编码
4315
+				MedicalRangeCode:             "",            //医师执业范围代码
4316
+				MedicalLevel:                 "",            //医生级别
4317
+				TypeJob:                      "",            //职业类别
4318
+				DoctorNumber:                 "",            //医师编号
4319
+				Licensing:                    "",            //职业标志
4320
+				DoctorServiceStatus:          "",            //医师医保服务资格状态
4321
+				MonitoringLevel:              "",            //监控等级
4322
+				DrugPsychotropicSubstances:   "",            //毒麻精神药品资格
4323
+				HealthCareCode:               "",            // 母婴保健技术考核合格证书编号
4324
+				PlanningTechnicalServiceCode: "",            //计划生育技术服务人员合格证编号
4325
+				PharmacistType:               "",            //药师类别
4326
+				PharmacistPracticeCategory:   "",            //药师执业类别
4327
+				PharmacistsLicensing:         "",            //药师执业范围
4328
+				PharmacistRegistrationNumber: "",            //执业药师注册证编号
4329
+				OfficeCode:                   "",            //科室编码
4330
+				JobNumber:                    "",            //工号
4331
+				PostName:                     "",            //职位名称
4332
+				TechnicalJobLevelCode:        "",            //专业技术职务级别编码
4333
+				IsActive:                     "",            //在职与否
4334
+				PrescriptionQualificationIdentification: "",   //处方资格标识
4335
+				IdentificationOutpatients:               "",   //门诊大病医师标识
4336
+				OutpatientIllnessCategory:               "",   //门诊大病类别
4337
+				StartTime:                               1233, //开始日期
4251 4338
 				EndTime:                                 123333,
4252 4339
 			}
4253 4340
 			customs = append(customs, detail)

+ 4 - 0
enums/error_code.go 查看文件

@@ -245,6 +245,8 @@ const ( // ErrorCode
245 245
 	ErrorDoctorLoginFaildParamWrong   = 30004
246 246
 
247 247
 	ErrorNoReadCardException = 30005
248
+
249
+	ErrorCodeParamSickTypeWrong = 30006
248 250
 )
249 251
 
250 252
 var ErrCodeMsgs = map[int]string{
@@ -472,6 +474,8 @@ var ErrCodeMsgs = map[int]string{
472 474
 	ErrorDoctorLoginFaildParamWrong:    "登记失败",
473 475
 
474 476
 	ErrorNoReadCardException: "无法读取除社保卡以外的卡",
477
+
478
+	ErrorCodeParamSickTypeWrong: "医生所开处方的疾病类型不能为空",
475 479
 }
476 480
 
477 481
 type SGJError struct {

+ 56 - 50
models/drug.go 查看文件

@@ -1,56 +1,62 @@
1 1
 package models
2 2
 
3 3
 type BaseDrugLib struct {
4
-	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
5
-	DrugName               string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
6
-	Pinyin                 string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
7
-	Wubi                   string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
8
-	DrugAlias              string  `gorm:"column:drug_alias" json:"drug_alias" form:"drug_alias"`
9
-	DrugAliasPinyin        string  `gorm:"column:drug_alias_pinyin" json:"drug_alias_pinyin" form:"drug_alias_pinyin"`
10
-	DrugAliasWubi          string  `gorm:"column:drug_alias_wubi" json:"drug_alias_wubi" form:"drug_alias_wubi"`
11
-	DrugCategory           int64   `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
12
-	DrugSpec               string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
13
-	DrugType               int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
14
-	DrugStockLimit         string  `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
15
-	DrugOriginPlace        string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
16
-	DrugDosageForm         int64   `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
17
-	MedicalInsuranceLevel  int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
18
-	MaxUnit                string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
19
-	MinUnit                string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
20
-	UnitMatrixing          string  `gorm:"column:unit_matrixing" json:"unit_matrixing" form:"unit_matrixing"`
21
-	RetailPrice            float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
22
-	LastPrice              float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
23
-	DrugControl            int64   `gorm:"column:drug_control" json:"drug_control" form:"drug_control"`
24
-	Number                 string  `gorm:"column:number" json:"number" form:"number"`
25
-	DrugClassify           string  `gorm:"column:drug_classify" json:"drug_classify" form:"drug_classify"`
26
-	DrugDose               float64 `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
27
-	DrugDoseUnit           int64   `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
28
-	MedicalInsuranceNumber string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
29
-	Manufacturer           int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
30
-	PharmacologyCategory   int64   `gorm:"column:pharmacology_category" json:"pharmacology_category" form:"pharmacology_category"`
31
-	StatisticsCategory     int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
32
-	Code                   string  `gorm:"column:code" json:"code" form:"code"`
33
-	IsSpecialDiseases      int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
34
-	IsRecord               int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
35
-	Agent                  string  `gorm:"column:agent" json:"agent" form:"agent"`
36
-	DrugStatus             string  `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
37
-	LimitRemark            string  `gorm:"column:limit_remark" json:"limit_remark" form:"limit_remark"`
38
-	DeliveryWay            string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
39
-	ExecutionFrequency     string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
40
-	SingleDose             float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
41
-	PrescribingNumber      float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
42
-	Label                  int64   `gorm:"column:label" json:"label" form:"label"`
43
-	Sort                   int64   `gorm:"column:sort" json:"sort" form:"sort"`
44
-	IsUseDoctorAdvice      int64   `gorm:"column:is_use_doctor_advice" json:"is_use_doctor_advice" form:"is_use_doctor_advice"`
45
-	IsDefault              int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
46
-	IsChargePredict        int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
47
-	IsStatisticsWork       int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
48
-	IsChargeUse            int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
49
-	Status                 int64   `gorm:"column:status" json:"status" form:"status"`
50
-	Ctime                  int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
51
-	Mtime                  int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
52
-	OrgId                  int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
53
-	DrugCode               string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
4
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
5
+	DrugName                    string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
6
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
7
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
8
+	DrugAlias                   string  `gorm:"column:drug_alias" json:"drug_alias" form:"drug_alias"`
9
+	DrugAliasPinyin             string  `gorm:"column:drug_alias_pinyin" json:"drug_alias_pinyin" form:"drug_alias_pinyin"`
10
+	DrugAliasWubi               string  `gorm:"column:drug_alias_wubi" json:"drug_alias_wubi" form:"drug_alias_wubi"`
11
+	DrugCategory                int64   `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
12
+	DrugSpec                    string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
13
+	DrugType                    int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
14
+	DrugStockLimit              string  `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
15
+	DrugOriginPlace             string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
16
+	DrugDosageForm              int64   `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
17
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
18
+	MaxUnit                     string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
19
+	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
20
+	UnitMatrixing               string  `gorm:"column:unit_matrixing" json:"unit_matrixing" form:"unit_matrixing"`
21
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
22
+	LastPrice                   float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
23
+	DrugControl                 int64   `gorm:"column:drug_control" json:"drug_control" form:"drug_control"`
24
+	Number                      string  `gorm:"column:number" json:"number" form:"number"`
25
+	DrugClassify                string  `gorm:"column:drug_classify" json:"drug_classify" form:"drug_classify"`
26
+	DrugDose                    float64 `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
27
+	DrugDoseUnit                int64   `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
28
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
29
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
30
+	PharmacologyCategory        int64   `gorm:"column:pharmacology_category" json:"pharmacology_category" form:"pharmacology_category"`
31
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
32
+	Code                        string  `gorm:"column:code" json:"code" form:"code"`
33
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
34
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
35
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
36
+	DrugStatus                  string  `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
37
+	LimitRemark                 string  `gorm:"column:limit_remark" json:"limit_remark" form:"limit_remark"`
38
+	DeliveryWay                 string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
39
+	ExecutionFrequency          string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
40
+	SingleDose                  float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
41
+	PrescribingNumber           float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
42
+	Label                       int64   `gorm:"column:label" json:"label" form:"label"`
43
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
44
+	IsUseDoctorAdvice           int64   `gorm:"column:is_use_doctor_advice" json:"is_use_doctor_advice" form:"is_use_doctor_advice"`
45
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
46
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
47
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
48
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
49
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
50
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
51
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
52
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
53
+	DrugCode                    string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
54
+	PrescriptionMark            int64   `gorm:"column:prescription_mark" json:"prescription_mark" form:"prescription_mark"`
55
+	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
56
+	DrugRemark                  string  `gorm:"column:drug_remark" json:"drug_remark" form:"drug_remark"`
57
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
58
+	DoseCode                    string  `gorm:"column:dose_code" json:"dose_code" form:"dose_code"`
59
+	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
54 60
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
55 61
 }
56 62
 

+ 10 - 10
service/sz_his_service.go 查看文件

@@ -314,7 +314,7 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, total f
314 314
 	str := string(respBytes)
315 315
 	return str
316 316
 }
317
-func SzybFY005(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64) string {
317
+func SzybFY005(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64, code string) string {
318 318
 	// 生成输入报文
319 319
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
320 320
 	inputData := make(map[string]interface{})
@@ -326,7 +326,7 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, total f
326 326
 		inputData["aka130"] = "11"
327 327
 	} else if medical_care == 13 {
328 328
 		inputData["aka130"] = "13"
329
-		inputData["cka303"] = "Z99.2"
329
+		inputData["cka303"] = code
330 330
 	} else {
331 331
 		inputData["aka130"] = fmt.Sprintf("%d", medical_care)
332 332
 	}
@@ -710,14 +710,14 @@ func SetSZDrugMessage(doctor string, doctor_code string, fixmedins_code string)
710 710
 	inputMessage["extendDeviceId"] = ""
711 711
 	inputMessage["extendSerialNumber"] = ""
712 712
 	inputMessage["extendUserId"] = ""
713
-	inputMessage["hospitalCode"] = "G5540"     // 协议机构编码
714
-	inputMessage["operatorCode"] = doctor_code // 操作员编码
715
-	inputMessage["operatorName"] = doctor      // 操作员名字
716
-	inputMessage["operatorPass"] = ""          // 定点协议机构操作人员编码
717
-	//inputMessage["serialNumber"] = "G5540" + year + month + day +
718
-	//  fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
719
-	inputMessage["serialNumber"] = "G554020210406" + fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
720
-	inputMessage["verifyCode"] = "000000|8ec5b7745a5cc45b631f23b4bf1e417e"
713
+	inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码
714
+	inputMessage["operatorCode"] = doctor_code    // 操作员编码
715
+	inputMessage["operatorName"] = doctor         // 操作员名字
716
+	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
717
+	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
718
+		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
719
+	//inputMessage["serialNumber"] = "G554020210406" + fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
720
+	//inputMessage["verifyCode"] = "000000|8ec5b7745a5cc45b631f23b4bf1e417e"
721 721
 
722 722
 	inputMessage["transReturnCode"] = ""                                           //
723 723
 	inputMessage["transReturnMessage"] = ""                                        //