test_user 1 month ago
parent
commit
e2ac9cfc10

+ 447 - 292
controllers/sg/his_api_controller.go View File

@@ -3787,7 +3787,7 @@ func (c *HisApiController) ChangeDrugtwo() {
3787 3787
 
3788 3788
 	//ids := c.GetString("ids")
3789 3789
 	//id_arr := strings.Split(ids, ",")
3790
-	flows, _ := service.GetNewDrugFlowInfotwo()
3790
+	flows, _ := service.GetNewDrugFlowInfothree123()
3791 3791
 	admin_user_id, _ := c.GetInt64("admin_user_id")
3792 3792
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3793 3793
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
@@ -3799,40 +3799,42 @@ func (c *HisApiController) ChangeDrugtwo() {
3799 3799
 			if prescription.OrderStatus == 2 {
3800 3800
 				//已经结算
3801 3801
 				//判断是否已经销售
3802
-				if item.IsSale == 1 { //是否已经销售,1是   0否
3803
-					//是否已经变更 1是  0否
3804
-					if item.IsChange == 0 { //没变更,进行变更操作
3805
-						bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3806
-
3807
-						result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3808
-						saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
3809
-						var respJSON3 map[string]interface{}
3810
-						if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3811
-							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3812
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3813
-							return
3814
-						}
3815
-						userJSONBytes3, _ := json.Marshal(respJSON3)
3816
-						if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3817
-							utils.ErrorLog("解析失败:%v", err)
3818
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3819
-							return
3820
-						}
3821
-						if res3.Infcode == 0 {
3822
-							item.IsChange = 1
3823
-							item.BgBchno = bg_number
3824
-							service.SaveDF2(item)
3825
-						} else {
3826
-							err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3827
-						}
3828
-					}
3829
-				} else { //没销售,
3802
+				//if item.IsSale == 1 { //是否已经销售,1是   0否
3803
+				//	//是否已经变更 1是  0否
3804
+				//	if item.IsChange == 0 { //没变更,进行变更操作
3805
+				//		bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3806
+				//
3807
+				//		result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3808
+				//		saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
3809
+				//		var respJSON3 map[string]interface{}
3810
+				//		if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3811
+				//			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3812
+				//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3813
+				//			return
3814
+				//		}
3815
+				//		userJSONBytes3, _ := json.Marshal(respJSON3)
3816
+				//		if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3817
+				//			utils.ErrorLog("解析失败:%v", err)
3818
+				//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3819
+				//			return
3820
+				//		}
3821
+				//		if res3.Infcode == 0 {
3822
+				//			item.IsChange = 1
3823
+				//			item.BgBchno = bg_number
3824
+				//			service.SaveDF2(item)
3825
+				//		} else {
3826
+				//			err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3827
+				//		}
3828
+				//	}
3829
+				//}
3830
+				//else
3831
+				{ //没销售,
3830 3832
 					var res FJ3507Result
3831 3833
 					var res3507for10188 FJ3507ResultFor10188
3832 3834
 					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
3833 3835
 
3834 3836
 					//进行商品销售接口
3835
-					result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3837
+					result3, result4 := SaleStock10217(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3836 3838
 					saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
3837 3839
 					var respJSON3 map[string]interface{}
3838 3840
 					if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
@@ -3870,60 +3872,61 @@ func (c *HisApiController) ChangeDrugtwo() {
3870 3872
 						item.Bchno = number
3871 3873
 						item.SaleDate = time.Now().Format("2006-01-02")
3872 3874
 
3873
-						err5 := service.SaveDF(item)
3874
-						if err5 == nil {
3875
-							if item.IsChange == 0 { //没变更,进行变更操作
3876
-								bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3877
-
3878
-								result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3879
-								saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
3880
-
3881
-								var respJSON3 map[string]interface{}
3882
-								if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3883
-									utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3884
-									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3885
-									return
3886
-								}
3887
-
3888
-								if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3889
-									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3890
-										utils.ErrorLog("解析失败:%v", err)
3891
-										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3892
-										return
3893
-									}
3894
-									//if res3507for10188.Infcode
3895
-									res3.InfRefmsgid = res3507for10188.InfRefmsgid
3896
-									//res.Output = resSix10265.Output
3897
-									res3.ErrMsg = res3507for10188.ErrMsg
3898
-									res3.Cainfo = res3507for10188.Cainfo
3899
-									res3.WarnMsg = res3507for10188.WarnMsg
3900
-									infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3901
-									res3.Infcode = infocode
3902
-								} else {
3903
-
3904
-									if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3905
-										utils.ErrorLog("解析失败:%v", err)
3906
-										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3907
-										return
3908
-									}
3909
-
3910
-								}
3911
-
3912
-								if res3.Infcode == 0 {
3913
-									item.IsChange = 1
3914
-									item.BgBchno = bg_number
3915
-									service.SaveDF2(item)
3916
-								} else {
3917
-									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3918
-								}
3919
-							}
3920
-						}
3875
+						 service.SaveDF(item)
3876
+						//if err5 == nil {
3877
+						//	if item.IsChange == 0 { //没变更,进行变更操作
3878
+						//		bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3879
+						//
3880
+						//		result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3881
+						//		saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
3882
+						//
3883
+						//		var respJSON3 map[string]interface{}
3884
+						//		if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3885
+						//			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3886
+						//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3887
+						//			return
3888
+						//		}
3889
+						//
3890
+						//		if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3891
+						//			if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3892
+						//				utils.ErrorLog("解析失败:%v", err)
3893
+						//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3894
+						//				return
3895
+						//			}
3896
+						//			//if res3507for10188.Infcode
3897
+						//			res3.InfRefmsgid = res3507for10188.InfRefmsgid
3898
+						//			//res.Output = resSix10265.Output
3899
+						//			res3.ErrMsg = res3507for10188.ErrMsg
3900
+						//			res3.Cainfo = res3507for10188.Cainfo
3901
+						//			res3.WarnMsg = res3507for10188.WarnMsg
3902
+						//			infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3903
+						//			res3.Infcode = infocode
3904
+						//		} else {
3905
+						//
3906
+						//			if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3907
+						//				utils.ErrorLog("解析失败:%v", err)
3908
+						//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3909
+						//				return
3910
+						//			}
3911
+						//
3912
+						//		}
3913
+						//
3914
+						//		if res3.Infcode == 0 {
3915
+						//			item.IsChange = 1
3916
+						//			item.BgBchno = bg_number
3917
+						//			service.SaveDF2(item)
3918
+						//		} else {
3919
+						//			err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3920
+						//		}
3921
+						//	}
3922
+						//}
3921 3923
 					} else {
3922 3924
 						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
3923 3925
 					}
3924 3926
 				}
3925 3927
 
3926
-			} else { //还没结算
3928
+			} else
3929
+			{ //还没结算
3927 3930
 				var res3507for10188 FJ3507ResultFor10188
3928 3931
 
3929 3932
 				if item.IsChange == 0 { //没变更,进行变更操作
@@ -3964,212 +3967,6 @@ func (c *HisApiController) ChangeDrugtwo() {
3964 3967
 
3965 3968
 					}
3966 3969
 
3967
-					if res3.Infcode == 0 {
3968
-						item.IsChange = 1
3969
-						item.BgBchno = bg_number
3970
-						service.SaveDF2(item)
3971
-					} else {
3972
-						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3973
-					}
3974
-				}
3975
-			}
3976
-		} else if item.ConsumableType == 7 {
3977
-			var res3507for10188 FJ3507ResultFor10188
3978
-
3979
-			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3980
-			order := service.GetHisOrderByNumber(prescription.BatchNumber)
3981
-			if order.OrderStatus == 2 || order.OrderStatus == 1 { //已经结算
3982
-				//判断是否已经销售
3983
-				if item.IsSale == 2 { //是否已经销售,1是   0否
3984
-					//是否已经变更 1是  0否
3985
-					if item.IsChange == 0 { //没变更,进行变更操作
3986
-						bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3987
-
3988
-						result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
3989
-						saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
3990
-
3991
-						var respJSON3 map[string]interface{}
3992
-						if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3993
-							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3994
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3995
-							return
3996
-						}
3997
-						userJSONBytes3, _ := json.Marshal(respJSON3)
3998
-						if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3999
-							if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4000
-								utils.ErrorLog("解析失败:%v", err)
4001
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4002
-								return
4003
-							}
4004
-							//if res3507for10188.Infcode
4005
-							res3.InfRefmsgid = res3507for10188.InfRefmsgid
4006
-							//res.Output = resSix10265.Output
4007
-							res3.ErrMsg = res3507for10188.ErrMsg
4008
-							res3.Cainfo = res3507for10188.Cainfo
4009
-							res3.WarnMsg = res3507for10188.WarnMsg
4010
-							infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4011
-							res3.Infcode = infocode
4012
-						} else {
4013
-
4014
-							if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4015
-								utils.ErrorLog("解析失败:%v", err)
4016
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4017
-								return
4018
-							}
4019
-
4020
-						}
4021
-						if res3.Infcode == 0 {
4022
-							item.IsChange = 1
4023
-							item.BgBchno = bg_number
4024
-							service.SaveDF2(item)
4025
-						} else {
4026
-							err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4027
-						}
4028
-					}
4029
-				} else { //没销售,
4030
-					//进行商品销售退货接口
4031
-					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3506"
4032
-
4033
-					result111, result222 := CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
4034
-					saveLog(result111, result222, "3506", "销售退货")
4035
-					var res7 FJ3507Result
4036
-
4037
-					//进行商品销售接口
4038
-					//result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles,number)
4039
-					//saveLog(result3, result4, "3506", "自动退库,未销售退货进行销售退货行为,3505")
4040
-					var respJSON3 map[string]interface{}
4041
-					if err := json.Unmarshal([]byte(string(result111)), &respJSON3); err != nil {
4042
-						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4043
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4044
-						return
4045
-					}
4046
-					userJSONBytes3, _ := json.Marshal(respJSON3)
4047
-
4048
-					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4049
-						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4050
-							utils.ErrorLog("解析失败:%v", err)
4051
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4052
-							return
4053
-						}
4054
-						//if res3507for10188.Infcode
4055
-						res7.InfRefmsgid = res3507for10188.InfRefmsgid
4056
-						//res.Output = resSix10265.Output
4057
-						res7.ErrMsg = res3507for10188.ErrMsg
4058
-						res7.Cainfo = res3507for10188.Cainfo
4059
-						res7.WarnMsg = res3507for10188.WarnMsg
4060
-						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4061
-						res7.Infcode = infocode
4062
-					} else {
4063
-
4064
-						if err := json.Unmarshal(userJSONBytes3, &res7); err != nil {
4065
-							utils.ErrorLog("解析失败:%v", err)
4066
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4067
-							return
4068
-						}
4069
-
4070
-					}
4071
-					if res7.Infcode == 0 {
4072
-						item.IsSale = 2
4073
-						item.SaleDate = item.SaleDate
4074
-						item.Bchno = number
4075
-						service.SaveDF(item)
4076
-						if item.IsChange == 0 { //没变更,进行变更操作
4077
-							bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4078
-
4079
-							result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
4080
-							saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
4081
-
4082
-							var respJSON3 map[string]interface{}
4083
-							if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4084
-								utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4085
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4086
-								return
4087
-							}
4088
-							userJSONBytes3, _ := json.Marshal(respJSON3)
4089
-							//if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4090
-							//	utils.ErrorLog("解析失败:%v", err)
4091
-							//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4092
-							//	return
4093
-							//}
4094
-
4095
-							if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4096
-								if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4097
-									utils.ErrorLog("解析失败:%v", err)
4098
-									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4099
-									return
4100
-								}
4101
-								//if res3507for10188.Infcode
4102
-								res3.InfRefmsgid = res3507for10188.InfRefmsgid
4103
-								//res.Output = resSix10265.Output
4104
-								res3.ErrMsg = res3507for10188.ErrMsg
4105
-								res3.Cainfo = res3507for10188.Cainfo
4106
-								res3.WarnMsg = res3507for10188.WarnMsg
4107
-								infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4108
-								res3.Infcode = infocode
4109
-							} else {
4110
-
4111
-								if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4112
-									utils.ErrorLog("解析失败:%v", err)
4113
-									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4114
-									return
4115
-								}
4116
-
4117
-							}
4118
-							if res3.Infcode == 0 {
4119
-								item.IsChange = 1
4120
-								item.BgBchno = bg_number
4121
-								service.SaveDF2(item)
4122
-							} else {
4123
-								err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4124
-							}
4125
-						}
4126
-					} else {
4127
-						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res7.ErrMsg)
4128
-					}
4129
-				}
4130
-			} else { //还没结算
4131
-				if item.IsChange == 0 { //没变更,进行变更操作
4132
-					bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4133
-
4134
-					result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
4135
-					saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
4136
-
4137
-					var respJSON3 map[string]interface{}
4138
-					if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4139
-						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4140
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4141
-						return
4142
-					}
4143
-					userJSONBytes3, _ := json.Marshal(respJSON3)
4144
-					//if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4145
-					//	utils.ErrorLog("解析失败:%v", err)
4146
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4147
-					//	return
4148
-					//}
4149
-
4150
-					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4151
-						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4152
-							utils.ErrorLog("解析失败:%v", err)
4153
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4154
-							return
4155
-						}
4156
-						//if res3507for10188.Infcode
4157
-						res3.InfRefmsgid = res3507for10188.InfRefmsgid
4158
-						//res.Output = resSix10265.Output
4159
-						res3.ErrMsg = res3507for10188.ErrMsg
4160
-						res3.Cainfo = res3507for10188.Cainfo
4161
-						res3.WarnMsg = res3507for10188.WarnMsg
4162
-						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4163
-						res3.Infcode = infocode
4164
-					} else {
4165
-
4166
-						if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4167
-							utils.ErrorLog("解析失败:%v", err)
4168
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4169
-							return
4170
-						}
4171
-
4172
-					}
4173 3970
 					if res3.Infcode == 0 {
4174 3971
 						item.IsChange = 1
4175 3972
 						item.BgBchno = bg_number
@@ -4180,6 +3977,213 @@ func (c *HisApiController) ChangeDrugtwo() {
4180 3977
 				}
4181 3978
 			}
4182 3979
 		}
3980
+		//if item.ConsumableType == 7 {
3981
+		//	var res3507for10188 FJ3507ResultFor10188
3982
+		//
3983
+		//	prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3984
+		//	order := service.GetHisOrderByNumber(prescription.BatchNumber)
3985
+		//	if order.OrderStatus == 2 || order.OrderStatus == 1 { //已经结算
3986
+		//		//判断是否已经销售
3987
+		//		if item.IsSale == 2 { //是否已经销售,1是   0否
3988
+		//			//是否已经变更 1是  0否
3989
+		//			if item.IsChange == 0 { //没变更,进行变更操作
3990
+		//				bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3991
+		//
3992
+		//				result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
3993
+		//				saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
3994
+		//
3995
+		//				var respJSON3 map[string]interface{}
3996
+		//				if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3997
+		//					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3998
+		//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3999
+		//					return
4000
+		//				}
4001
+		//				userJSONBytes3, _ := json.Marshal(respJSON3)
4002
+		//				if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4003
+		//					if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4004
+		//						utils.ErrorLog("解析失败:%v", err)
4005
+		//						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4006
+		//						return
4007
+		//					}
4008
+		//					//if res3507for10188.Infcode
4009
+		//					res3.InfRefmsgid = res3507for10188.InfRefmsgid
4010
+		//					//res.Output = resSix10265.Output
4011
+		//					res3.ErrMsg = res3507for10188.ErrMsg
4012
+		//					res3.Cainfo = res3507for10188.Cainfo
4013
+		//					res3.WarnMsg = res3507for10188.WarnMsg
4014
+		//					infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4015
+		//					res3.Infcode = infocode
4016
+		//				} else {
4017
+		//
4018
+		//					if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4019
+		//						utils.ErrorLog("解析失败:%v", err)
4020
+		//						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4021
+		//						return
4022
+		//					}
4023
+		//
4024
+		//				}
4025
+		//				if res3.Infcode == 0 {
4026
+		//					item.IsChange = 1
4027
+		//					item.BgBchno = bg_number
4028
+		//					service.SaveDF2(item)
4029
+		//				} else {
4030
+		//					err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4031
+		//				}
4032
+		//			}
4033
+		//		} else { //没销售,
4034
+		//			//进行商品销售退货接口
4035
+		//			number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3506"
4036
+		//
4037
+		//			result111, result222 := CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
4038
+		//			saveLog(result111, result222, "3506", "销售退货")
4039
+		//			var res7 FJ3507Result
4040
+		//
4041
+		//			//进行商品销售接口
4042
+		//			//result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles,number)
4043
+		//			//saveLog(result3, result4, "3506", "自动退库,未销售退货进行销售退货行为,3505")
4044
+		//			var respJSON3 map[string]interface{}
4045
+		//			if err := json.Unmarshal([]byte(string(result111)), &respJSON3); err != nil {
4046
+		//				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4047
+		//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4048
+		//				return
4049
+		//			}
4050
+		//			userJSONBytes3, _ := json.Marshal(respJSON3)
4051
+		//
4052
+		//			if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4053
+		//				if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4054
+		//					utils.ErrorLog("解析失败:%v", err)
4055
+		//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4056
+		//					return
4057
+		//				}
4058
+		//				//if res3507for10188.Infcode
4059
+		//				res7.InfRefmsgid = res3507for10188.InfRefmsgid
4060
+		//				//res.Output = resSix10265.Output
4061
+		//				res7.ErrMsg = res3507for10188.ErrMsg
4062
+		//				res7.Cainfo = res3507for10188.Cainfo
4063
+		//				res7.WarnMsg = res3507for10188.WarnMsg
4064
+		//				infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4065
+		//				res7.Infcode = infocode
4066
+		//			} else {
4067
+		//
4068
+		//				if err := json.Unmarshal(userJSONBytes3, &res7); err != nil {
4069
+		//					utils.ErrorLog("解析失败:%v", err)
4070
+		//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4071
+		//					return
4072
+		//				}
4073
+		//
4074
+		//			}
4075
+		//			if res7.Infcode == 0 {
4076
+		//				item.IsSale = 2
4077
+		//				item.SaleDate = item.SaleDate
4078
+		//				item.Bchno = number
4079
+		//				service.SaveDF(item)
4080
+		//				if item.IsChange == 0 { //没变更,进行变更操作
4081
+		//					bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4082
+		//
4083
+		//					result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
4084
+		//					saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
4085
+		//
4086
+		//					var respJSON3 map[string]interface{}
4087
+		//					if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4088
+		//						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4089
+		//						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4090
+		//						return
4091
+		//					}
4092
+		//					userJSONBytes3, _ := json.Marshal(respJSON3)
4093
+		//					//if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4094
+		//					//	utils.ErrorLog("解析失败:%v", err)
4095
+		//					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4096
+		//					//	return
4097
+		//					//}
4098
+		//
4099
+		//					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4100
+		//						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4101
+		//							utils.ErrorLog("解析失败:%v", err)
4102
+		//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4103
+		//							return
4104
+		//						}
4105
+		//						//if res3507for10188.Infcode
4106
+		//						res3.InfRefmsgid = res3507for10188.InfRefmsgid
4107
+		//						//res.Output = resSix10265.Output
4108
+		//						res3.ErrMsg = res3507for10188.ErrMsg
4109
+		//						res3.Cainfo = res3507for10188.Cainfo
4110
+		//						res3.WarnMsg = res3507for10188.WarnMsg
4111
+		//						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4112
+		//						res3.Infcode = infocode
4113
+		//					} else {
4114
+		//
4115
+		//						if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4116
+		//							utils.ErrorLog("解析失败:%v", err)
4117
+		//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4118
+		//							return
4119
+		//						}
4120
+		//
4121
+		//					}
4122
+		//					if res3.Infcode == 0 {
4123
+		//						item.IsChange = 1
4124
+		//						item.BgBchno = bg_number
4125
+		//						service.SaveDF2(item)
4126
+		//					} else {
4127
+		//						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4128
+		//					}
4129
+		//				}
4130
+		//			} else {
4131
+		//				err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res7.ErrMsg)
4132
+		//			}
4133
+		//		}
4134
+		//	} else { //还没结算
4135
+		//		if item.IsChange == 0 { //没变更,进行变更操作
4136
+		//			bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4137
+		//
4138
+		//			result, result2 := ChangeStock(item.Count, item, miConfig, "101", roles, bg_number)
4139
+		//			saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
4140
+		//
4141
+		//			var respJSON3 map[string]interface{}
4142
+		//			if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4143
+		//				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4144
+		//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4145
+		//				return
4146
+		//			}
4147
+		//			userJSONBytes3, _ := json.Marshal(respJSON3)
4148
+		//			//if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4149
+		//			//	utils.ErrorLog("解析失败:%v", err)
4150
+		//			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4151
+		//			//	return
4152
+		//			//}
4153
+		//
4154
+		//			if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
4155
+		//				if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
4156
+		//					utils.ErrorLog("解析失败:%v", err)
4157
+		//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4158
+		//					return
4159
+		//				}
4160
+		//				//if res3507for10188.Infcode
4161
+		//				res3.InfRefmsgid = res3507for10188.InfRefmsgid
4162
+		//				//res.Output = resSix10265.Output
4163
+		//				res3.ErrMsg = res3507for10188.ErrMsg
4164
+		//				res3.Cainfo = res3507for10188.Cainfo
4165
+		//				res3.WarnMsg = res3507for10188.WarnMsg
4166
+		//				infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4167
+		//				res3.Infcode = infocode
4168
+		//			} else {
4169
+		//
4170
+		//				if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4171
+		//					utils.ErrorLog("解析失败:%v", err)
4172
+		//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4173
+		//					return
4174
+		//				}
4175
+		//
4176
+		//			}
4177
+		//			if res3.Infcode == 0 {
4178
+		//				item.IsChange = 1
4179
+		//				item.BgBchno = bg_number
4180
+		//				service.SaveDF2(item)
4181
+		//			} else {
4182
+		//				err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4183
+		//			}
4184
+		//		}
4185
+		//	}
4186
+		//}
4183 4187
 	}
4184 4188
 	if len(err) == 0 {
4185 4189
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -5254,9 +5258,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5254 5258
 	struct3505.FixmedinsHilistName = drug.HisDoctorAdviceInfo.BaseDrugLib.DrugName
5255 5259
 	struct3505.FixmedinsBchno = number
5256 5260
 	struct3505.Opter = role.UserName
5257
-
5261
+	struct3505.Bchno = "---"
5258 5262
 	struct3505.FixmedinsCode = miConfig.Code
5259 5263
 	struct3505.Code = miConfig.Code
5264
+	struct3505.FinlTrnsPric =  drug.HisDoctorAdviceInfo.Price
5265
+
5260 5266
 
5261 5267
 	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
5262 5268
 	struct3505.PrscDrName = roles.UserName
@@ -5315,9 +5321,9 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5315 5321
 	struct3505.MdtrtSn = order.MdtrtId
5316 5322
 	struct3505.ManuLotnum = drug.Number
5317 5323
 	struct3505.ManuDate = time.Unix(drug.ProductDate, 0).Format("2006-01-02")
5318
-	struct3505.ExpyEnd = ""
5324
+	struct3505.ExpyEnd = time.Unix(drug.ExpireDate, 0).Format("2006-01-02")
5319 5325
 	struct3505.RxFlag = "1"
5320
-	struct3505.TrdnFlag = "1"
5326
+	struct3505.TrdnFlag = "0"
5321 5327
 	struct3505.RtalDocno = order.Number
5322 5328
 	struct3505.PsnCertType = "01"
5323 5329
 
@@ -5392,6 +5398,153 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5392 5398
 
5393 5399
 	}
5394 5400
 
5401
+}
5402
+
5403
+func SaleStock10217(org_id int64, pre models.HisPrescription, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5404
+	var struct3505 models.Struct3505
5405
+	struct3505.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5406
+	struct3505.FixmedinsHilistId = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5407
+	struct3505.FixmedinsHilistName = drug.HisDoctorAdviceInfo.BaseDrugLib.DrugName
5408
+	struct3505.FixmedinsBchno = number
5409
+	struct3505.Opter = role.UserName
5410
+
5411
+	struct3505.FixmedinsCode = miConfig.Code
5412
+	struct3505.Code = miConfig.Code
5413
+
5414
+	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
5415
+	struct3505.PrscDrName = roles.UserName
5416
+	if org_id == 10191 {
5417
+		struct3505.PharName = "刘水山"
5418
+		struct3505.PharPracCertNo = "2015026350260000002611351127"
5419
+	}
5420
+
5421
+	if org_id == 10188 {
5422
+		struct3505.PharName = "李汉清"
5423
+		struct3505.PharPracCertNo = "30220200932022010034"
5424
+	}
5425
+
5426
+	if org_id == 10217 {
5427
+		struct3505.PharName = "张敏"
5428
+		struct3505.PharPracCertNo = "30220230432090100108"
5429
+	}
5430
+
5431
+	if org_id == 10318 {
5432
+		struct3505.PharName = "邹刘阳"
5433
+		struct3505.PharPracCertNo = "210441200001378"
5434
+	}
5435
+
5436
+	if org_id == 10402 {
5437
+		struct3505.PharName = "刘韶健"
5438
+		struct3505.PharPracCertNo = "2015026440262015440501001198"
5439
+	}
5440
+
5441
+
5442
+
5443
+	if org_id == 9919 {
5444
+		struct3505.PharName = "周君权"
5445
+		struct3505.PharPracCertNo = "089644396094401375"
5446
+	}
5447
+
5448
+
5449
+	if org_id == 10644 {
5450
+		struct3505.PharName = "陈金娣"
5451
+		struct3505.PharPracCertNo = "20181441500320100066"
5452
+	}
5453
+
5454
+	if org_id == 10567 {
5455
+		struct3505.PharName = "范小兰"
5456
+		struct3505.PharPracCertNo = "0200102079485"
5457
+	}
5458
+	if org_id == 10721 {
5459
+		struct3505.PharName = "孙莉侠"
5460
+		struct3505.PharPracCertNo = "060399"
5461
+	}
5462
+	if org_id == 10726 {
5463
+		struct3505.PharName = "彭建福"
5464
+		struct3505.PharPracCertNo = "D445281006261"
5465
+	}
5466
+	order := service.GetHisOrderByNumber(pre.BatchNumber)
5467
+	struct3505.SetlId = order.SetlId
5468
+	struct3505.MdtrtSn = order.MdtrtId
5469
+	struct3505.ManuLotnum = drug.Number
5470
+	struct3505.ManuDate = time.Unix(drug.ProductDate, 0).Format("2006-01-02")
5471
+	struct3505.ExpyEnd = time.Unix(drug.ExpireDate, 0).Format("2006-01-02")
5472
+	struct3505.RxFlag = "1"
5473
+	struct3505.TrdnFlag = "0"
5474
+	struct3505.RtalDocno = order.Number
5475
+	struct3505.PsnCertType = "01"
5476
+
5477
+	struct3505.CertNo = order.Certno
5478
+	struct3505.PsnNo = order.PsnNo
5479
+	struct3505.PsnName = order.PsnName
5480
+
5481
+	struct3505.Url = miConfig.Url
5482
+	struct3505.AppId = miConfig.Cainfo
5483
+	struct3505.AppSecret = miConfig.AppSecret
5484
+	struct3505.Enckey = miConfig.EncKey
5485
+	struct3505.SignKey = miConfig.SignKey
5486
+	struct3505.SecretKey = miConfig.SecretKey
5487
+	strValue := fmt.Sprintf("%.2f", drug.HisDoctorAdviceInfo.PrescribingNumber)
5488
+	struct3505.SelRetnCnt = strValue
5489
+	struct3505.SelRetnTime = time.Unix(drug.HisDoctorAdviceInfo.CreatedTime, 0).Format("2006-01-02 15:04:05")
5490
+	struct3505.SelRetnOpterName = role.UserName
5491
+	if order.IsMedicineInsurance == 1 {
5492
+		struct3505.MdtrtSetlType = "1"
5493
+	} else {
5494
+		struct3505.MdtrtSetlType = "2"
5495
+	}
5496
+	struct3505.OrgName = miConfig.OrgName
5497
+	struct3505.AccessKey = miConfig.AccessKey
5498
+	struct3505.RequestUrl = miConfig.Url
5499
+	struct3505.SecretKey = miConfig.SecretKey
5500
+	struct3505.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
5501
+	struct3505.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
5502
+	struct3505.Cainfo = miConfig.Cainfo
5503
+	struct3505.DrugTracCodg = drug.DrugCode
5504
+
5505
+	if miConfig.MdtrtareaAdmvs == "350500" {
5506
+		result1, result2, _ := service.FJyb3505(struct3505)
5507
+		return result1, result2
5508
+	} else if miConfig.MdtrtareaAdmvs == "440100" {
5509
+		result1, result2 := service.Gzyb3505(struct3505, struct3505.SecretKey)
5510
+		return result1, result2
5511
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5512
+		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5513
+		return result1, result2
5514
+	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5515
+		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey,struct3505.AccessKey,struct3505.RequestUrl)
5516
+		return result1, result2
5517
+	}else if miConfig.MdtrtareaAdmvs == "340699" {
5518
+		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey,struct3505.RequestUrl)
5519
+		return result1, result2
5520
+	} else {
5521
+		data := make(map[string]interface{})
5522
+		data["struct_3505s"] = struct3505
5523
+		client := &http.Client{}
5524
+		bytesData, _ := json.Marshal(data)
5525
+		var req *http.Request
5526
+		if miConfig.MdtrtareaAdmvs == "320921" {
5527
+			req, _ = http.NewRequest("POST", "http://192.168.2.3:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
5528
+		} else {
5529
+			req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
5530
+		}
5531
+		resp, _ := client.Do(req)
5532
+		defer resp.Body.Close()
5533
+		body, ioErr := ioutil.ReadAll(resp.Body)
5534
+		if ioErr != nil {
5535
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5536
+		}
5537
+		var respJSON map[string]interface{}
5538
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
5539
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5540
+		}
5541
+		//var resSix10265 ResultSix10265 //1101结果
5542
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5543
+		result, _ := json.Marshal(respJSON)
5544
+		return string(result), ""
5545
+
5546
+	}
5547
+
5395 5548
 }
5396 5549
 func CancleSaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5397 5550
 	var struct3506 models.Struct3506
@@ -25856,8 +26009,9 @@ func (c *HisApiController) GetRegisterInfo() {
25856 26009
 					bas := strings.Split(psn_info.CardInfo, "|")
25857 26010
 					cert_no = bas[2]
25858 26011
 				} else if id_card_type == 4 {
25859
-					cert_no = IdCardNo
26012
+					cert_no = psn_info.VerifyNumber
25860 26013
 					psn_info.VerifyNumber = psn_info.VerifyNumber
26014
+					IdCardNo = psn_info.VerifyNumber
25861 26015
 				} else {
25862 26016
 					cert_no = IdCardNo
25863 26017
 					psn_info.VerifyNumber = cert_no
@@ -25918,8 +26072,9 @@ func (c *HisApiController) GetRegisterInfo() {
25918 26072
 					bas := strings.Split(psn_info.CardInfo, "|")
25919 26073
 					cert_no = bas[2]
25920 26074
 				} else if id_card_type == 4 {
25921
-					cert_no = IdCardNo
26075
+					cert_no = psn_info.VerifyNumber
25922 26076
 					psn_info.VerifyNumber = psn_info.VerifyNumber
26077
+					IdCardNo = psn_info.VerifyNumber
25923 26078
 				} else {
25924 26079
 					cert_no = IdCardNo
25925 26080
 					psn_info.VerifyNumber = cert_no
@@ -29290,7 +29445,7 @@ func (c *HisApiController) GetUploadInfo() {
29290 29445
 					psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
29291 29446
 				} else if his.IdCardType == 4 {
29292 29447
 					psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
29293
-					cert_no = his.Certno
29448
+					cert_no =psn_info.VerifyNumber
29294 29449
 					psn_info.VerifyNumber = psn_info.VerifyNumber
29295 29450
 				} else {
29296 29451
 					cert_no = his.Certno
@@ -32491,7 +32646,7 @@ func (c *HisApiController) GetPreUploadInfo() {
32491 32646
 
32492 32647
 						if his.IdCardType == 4 {
32493 32648
 							psn_info.VerifyNumber = psn_info.VerifyNumber
32494
-							cert_no = psn_info.Certno
32649
+							cert_no = psn_info.VerifyNumber
32495 32650
 						} else if his.IdCardType == 2 {
32496 32651
 							cert_no = psn_info.Certno
32497 32652
 							psn_info.VerifyNumber = psn_info.Certno

+ 1 - 1
controllers/zh/zh_his_api_controller.go View File

@@ -1495,7 +1495,7 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1495 1495
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1496 1496
 
1497 1497
 		} else if miConfig.MdtrtareaAdmvs == "360399" ||  miConfig.MdtrtareaAdmvs == "361025" {
1498
-			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1498
+			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code,  miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, patient.Name, patient.IdCardNo, patient.Name)
1499 1499
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1500 1500
 		}else if miConfig.MdtrtareaAdmvs == "341203"{
1501 1501
 			var insuplc_admdvs string

+ 218 - 217
main.go View File

@@ -705,225 +705,226 @@ type ResultSeventeen struct {
705 705
 //}GetAllHisOrder10138
706 706
 //
707 707
 //
708
-func GetblBatchSettleList() {
709
-	org_id, _ := beego.AppConfig.Int64("org_id")
710
-	var orders []*models.HisOrder
711
-	//var orders []*models.HisOrderError
712
-	orders, _ = service.GetAllHisOrder10138()
713
-	for _, item := range orders {
714
-		order_id := item.ID
715
-		order, _ := service.GetHisOrderByIDTwo(order_id)
716
-		if order.MedType == "14" {
717
-			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
718
-			var patientPrescription models.HisPrescriptionInfo
719
-			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
720
-			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
721
-			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
722
-			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
723
-			var configTwo []*models.HisXtDiagnoseConfig
724
-			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
725
-			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
726
-			for _, item := range diagnosis_idstwo {
727
-				id, _ := strconv.ParseInt(item, 10, 64)
728
-				diagnosisConfig, _ := service.FindDiagnoseById(id)
729
-				configTwo = append(configTwo, &diagnosisConfig)
730
-			}
731
-			patient, _ := service.GetPatientByIDTwo(10138, order.PatientId)
732
-
733
-			sickConfig, _ := service.FindSickById(his.SickType)
734
-			//if order.MedType == "1111" || order.MedType == "1112" {
735
-			//	order.MedType = "11"
736
-			//}
737
-			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
738
-
739
-			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
740
-			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
741
-			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
742
-			if order.ID == 0 {
743
-				return
744
-			}
745
-			if his.BalanceAccountsType == 2 {
746
-				continue
747
-			}
748
-			struct4101 := service.Struct4101{
749
-				PsnNo:          order.PsnNo,
750
-				MdtrtId:        order.MdtrtId,
751
-				SetlId:         order.SetlId,
752
-				PsnName:        order.PsnName,
753
-				Gend:           order.Gend,
754
-				Brdy:           his.Brdy,
755
-				Age:            his.Age,
756
-				Naty:           order.Naty,
757
-				PatnCertType:   order.PsnCertType,
758
-				Certno:         order.Certno,
759
-				Prfs:           "90",
760
-				ConerName:      "",
761
-				PatnRlts:       "",
762
-				ConerAddr:      "",
763
-				ConerTel:       "",
764
-				HiType:         order.Insutype,
765
-				Insuplc:        his.InsuplcAdmdvs,
766
-				MaindiagFlag:   "1",
767
-				BillCode:       order.SetlId,
768
-				BillNo:         order.SetlId,
769
-				BizSn:          order.Number,
770
-				PsnSelfPay:     order.PsnPartAmt,
771
-				PsnOwnPay:      order.PsnPartAmt,
772
-				AcctPay:        order.AcctPay,
773
-				PsnCashpay:     order.PsnCashPay,
774
-				HiPaymtd:       "1",
775
-				Hsorg:          his.InsuplcAdmdvs,
776
-				HsorgOpter:     his.InsuplcAdmdvs,
777
-				MedinsFillPsn:  curRoles.UserName,
778
-				MedinsFillDept: depart.Name,
779
-				IptMedType:     "2",
780
-				CurAddr:        patient.HomeAddress,
781
-			}
782
-
783
-			struct4101.SetlBegnDate = order.SetlTime
784
-			struct4101.SetlEndDate = order.SetlTime
785
-
786
-			var rf []CustomFundPay
787
-			json.Unmarshal([]byte(order.SetlDetail), &rf)
788
-
789
-			//var tempFunPays []service.CustomStruct
790
-			//var tempFunPay610100 service.CustomStruct
791
-
792
-			//for _, item := range rf {
793
-			//	if item.FundPayType == "610100" {
794
-			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
795
-			//		tempFunPay610100.FundPayType = item.FundPayType
796
-			//	} else {
797
-			//		var tempFunPay service.CustomStruct
798
-			//		tempFunPay.FundPayamt = item.FundPayamt
799
-			//		tempFunPay.FundPayType = item.FundPayType
800
-			//		tempFunPays = append(tempFunPays, tempFunPay)
801
-			//	}
802
-			//}
803
-			//tempFunPays = append(tempFunPays, tempFunPay610100)
804
-			//struct4101.CustomStruct = tempFunPays
805
-
806
-			var tempDiaginfos []service.DiaginfoStructTwo
807
-			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
808
-			var tempOpspdiseinfos []service.OpspdiseinfoStruct
809
-
810
-			diagnosis_ids := strings.Split(his.Diagnosis, ",")
811
-			var config []*models.HisXtDiagnoseConfig
812
-			for _, item := range diagnosis_ids {
813
-				id, _ := strconv.ParseInt(item, 10, 64)
814
-				if id == 24 {
815
-
816
-					diagnosisConfig, _ := service.FindDiagnoseById(id)
817
-					config = append(config, &diagnosisConfig)
818
-				}
819
-
820
-			}
821
-
822
-			for _, item := range diagnosis_ids {
823
-
824
-				id, _ := strconv.ParseInt(item, 10, 64)
825
-				if id != 24 {
826
-					diagnosisConfig, _ := service.FindDiagnoseById(id)
827
-					config = append(config, &diagnosisConfig)
828
-				}
829
-
830
-			}
831
-
832
-			for index, item := range config {
833
-				if index == 0 {
834
-					var tempDiaginfo service.DiaginfoStructTwo
835
-					tempDiaginfo.DiagCode = item.CountryCode
836
-					tempDiaginfo.DiagName = item.CountryContentName
837
-					tempDiaginfo.DiagType = "1"
838
-					tempDiaginfo.MaindiagFlag = "1"
839
-					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
840
-				} else {
841
-
842
-					var tempDiaginfo service.DiaginfoStructTwo
843
-					tempDiaginfo.DiagCode = item.CountryCode
844
-					tempDiaginfo.DiagName = item.CountryContentName
845
-					tempDiaginfo.DiagType = "1"
846
-					tempDiaginfo.MaindiagFlag = "0"
847
-					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
848
-				}
849
-			}
850
-			struct4101.Diseinfo = tempDiaginfos
851
-			sickConfigTwo, _ := service.FindSickById(his.SickType)
852
-			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
853
-			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
854
-			tempOpspdiseinfo2.OprnOprtCode = ""
855
-			tempOpspdiseinfo2.OprnOprtName = ""
856
-			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
857
-			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
858
-			time_arr := strings.Split(order.SetlTime, " ")
859
-			struct4101.AdmTime = time_arr[0]
860
-			struct4101.AdmEndTime = time_arr[0]
861
-			struct4101.DoctorName = doctor.UserName
862
-			struct4101.DoctorCode = doctor.DoctorNumber
863
-
864
-			struct4101.Ntly = "CHN"
865
-			struct4101.AdmCaty = "A03.06"
866
-			var res ResultSeventeen
867
-
868
-			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
869
-			fmt.Println(result)
870
-			saveLog(result, request, "4101A", "清单上传")
871
-			var dat map[string]interface{}
872
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
873
-				fmt.Println(dat)
874
-			} else {
875
-				fmt.Println(err)
876
-			}
877
-			userJSONBytes, _ := json.Marshal(dat)
878
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
879
-				//utils.ErrorLog("解析失败:%v", err)
880
-				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
881
-				//adminUser := c.GetAdminUserInfo()
882
-				errlog := &models.HisOrderError{
883
-					UserOrgId: org_id,
884
-					Ctime:     time.Now().Unix(),
885
-					Mtime:     time.Now().Unix(),
886
-					ErrMsg:    res.ErrMsg + "解析失败",
887
-					Status:    1,
888
-					PatientId: order_id,
889
-					Stage:     10138600,
890
-				}
891
-				service.CreateErrMsgLog(errlog)
892
-				continue
893
-			}
894
-
895
-			if res.Infcode != 0 {
896
-				//adminUser := c.GetAdminUserInfo()
897
-				errlog := &models.HisOrderError{
898
-					UserOrgId: org_id,
899
-					Ctime:     time.Now().Unix(),
900
-					Mtime:     time.Now().Unix(),
901
-					ErrMsg:    res.ErrMsg,
902
-					Status:    1,
903
-					PatientId: order_id,
904
-					Stage:     10138600,
905
-				}
906
-				service.CreateErrMsgLog(errlog)
907
-				continue
908
-			} else {
909
-				hisFundSettleListResult := &models.HisFundSettleListResult{
910
-					Number:    res.Output.SetlListId,
911
-					Status:    1,
912
-					Ctime:     time.Now().Unix(),
913
-					Mtime:     time.Now().Unix(),
914
-					UserOrgId: org_id,
915
-					IsUpload:  1,
916
-					OrderId:   order_id,
917
-				}
918
-				service.CreateUploadRecord(hisFundSettleListResult)
919
-				continue
920
-			}
921
-		}
922
-	}
923
-}
708
+//func GetblBatchSettleList() {
709
+//	org_id, _ := beego.AppConfig.Int64("org_id")
710
+//	var orders []*models.HisOrder
711
+//	//var orders []*models.HisOrderError
712
+//	orders, _ = service.GetAllHisOrder10138()
713
+//	for _, item := range orders {
714
+//		order_id := item.ID
715
+//		order, _ := service.GetHisOrderByIDTwo(order_id)
716
+//		if order.MedType == "14" {
717
+//			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
718
+//			var patientPrescription models.HisPrescriptionInfo
719
+//			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
720
+//			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
721
+//			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
722
+//			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
723
+//			var configTwo []*models.HisXtDiagnoseConfig
724
+//			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
725
+//			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5320)
726
+//			for _, item := range diagnosis_idstwo {
727
+//				id, _ := strconv.ParseInt(item, 10, 64)
728
+//				diagnosisConfig, _ := service.FindDiagnoseById(id)
729
+//				configTwo = append(configTwo, &diagnosisConfig)
730
+//			}
731
+//			patient, _ := service.GetPatientByIDTwo(10028, order.PatientId)
732
+//
733
+//			sickConfig, _ := service.FindSickById(his.SickType)
734
+//			//if order.MedType == "1111" || order.MedType == "1112" {
735
+//			//	order.MedType = "11"
736
+//			//}
737
+//			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
738
+//
739
+//			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
740
+//			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
741
+//			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
742
+//			if order.ID == 0 {
743
+//				return
744
+//			}
745
+//			if his.BalanceAccountsType == 2 {
746
+//				continue
747
+//			}
748
+//			struct4101 := service.Struct4101{
749
+//				PsnNo:          order.PsnNo,
750
+//				MdtrtId:        order.MdtrtId,
751
+//				SetlId:         order.SetlId,
752
+//				PsnName:        order.PsnName,
753
+//				Gend:           order.Gend,
754
+//				Brdy:           his.Brdy,
755
+//				Age:            his.Age,
756
+//				Naty:           order.Naty,
757
+//				PatnCertType:   order.PsnCertType,
758
+//				Certno:         order.Certno,
759
+//				Prfs:           "90",
760
+//				ConerName:      "",
761
+//				PatnRlts:       "",
762
+//				ConerAddr:      "",
763
+//				ConerTel:       "",
764
+//				HiType:         order.Insutype,
765
+//				Insuplc:        his.InsuplcAdmdvs,
766
+//				MaindiagFlag:   "1",
767
+//				BillCode:       order.SetlId,
768
+//				BillNo:         order.SetlId,
769
+//				BizSn:          order.Number,
770
+//				PsnSelfPay:     order.PsnPartAmt,
771
+//				PsnOwnPay:      order.PsnPartAmt,
772
+//				AcctPay:        order.AcctPay,
773
+//				PsnCashpay:     order.PsnCashPay,
774
+//				HiPaymtd:       "1",
775
+//				Hsorg:          his.InsuplcAdmdvs,
776
+//				HsorgOpter:     his.InsuplcAdmdvs,
777
+//				MedinsFillPsn:  curRoles.UserName,
778
+//				MedinsFillDept: depart.Name,
779
+//				IptMedType:     "2",
780
+//				CurAddr:        patient.HomeAddress,
781
+//			}
782
+//
783
+//			struct4101.SetlBegnDate = order.SetlTime
784
+//			struct4101.SetlEndDate = order.SetlTime
785
+//
786
+//			var rf []CustomFundPay
787
+//			json.Unmarshal([]byte(order.SetlDetail), &rf)
788
+//
789
+//			//var tempFunPays []service.CustomStruct
790
+//			//var tempFunPay610100 service.CustomStruct
791
+//
792
+//			//for _, item := range rf {
793
+//			//	if item.FundPayType == "610100" {
794
+//			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
795
+//			//		tempFunPay610100.FundPayType = item.FundPayType
796
+//			//	} else {
797
+//			//		var tempFunPay service.CustomStruct
798
+//			//		tempFunPay.FundPayamt = item.FundPayamt
799
+//			//		tempFunPay.FundPayType = item.FundPayType
800
+//			//		tempFunPays = append(tempFunPays, tempFunPay)
801
+//			//	}
802
+//			//}
803
+//			//tempFunPays = append(tempFunPays, tempFunPay610100)
804
+//			//struct4101.CustomStruct = tempFunPays
805
+//
806
+//			var tempDiaginfos []service.DiaginfoStructTwo
807
+//			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
808
+//			var tempOpspdiseinfos []service.OpspdiseinfoStruct
809
+//
810
+//			diagnosis_ids := strings.Split(his.Diagnosis, ",")
811
+//			var config []*models.HisXtDiagnoseConfig
812
+//			for _, item := range diagnosis_ids {
813
+//				id, _ := strconv.ParseInt(item, 10, 64)
814
+//				if id == 24 {
815
+//
816
+//					diagnosisConfig, _ := service.FindDiagnoseById(id)
817
+//					config = append(config, &diagnosisConfig)
818
+//				}
819
+//
820
+//			}
821
+//
822
+//			for _, item := range diagnosis_ids {
823
+//
824
+//				id, _ := strconv.ParseInt(item, 10, 64)
825
+//				if id != 24 {
826
+//					diagnosisConfig, _ := service.FindDiagnoseById(id)
827
+//					config = append(config, &diagnosisConfig)
828
+//				}
829
+//
830
+//			}
831
+//
832
+//			for index, item := range config {
833
+//				if index == 0 {
834
+//					var tempDiaginfo service.DiaginfoStructTwo
835
+//					tempDiaginfo.DiagCode = item.CountryCode
836
+//					tempDiaginfo.DiagName = item.CountryContentName
837
+//					tempDiaginfo.DiagType = "1"
838
+//					tempDiaginfo.MaindiagFlag = "1"
839
+//					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
840
+//				} else {
841
+//
842
+//					var tempDiaginfo service.DiaginfoStructTwo
843
+//					tempDiaginfo.DiagCode = item.CountryCode
844
+//					tempDiaginfo.DiagName = item.CountryContentName
845
+//					tempDiaginfo.DiagType = "1"
846
+//					tempDiaginfo.MaindiagFlag = "0"
847
+//					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
848
+//				}
849
+//			}
850
+//			struct4101.Diseinfo = tempDiaginfos
851
+//			sickConfigTwo, _ := service.FindSickById(his.SickType)
852
+//			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
853
+//			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
854
+//			tempOpspdiseinfo2.OprnOprtCode = ""
855
+//			tempOpspdiseinfo2.OprnOprtName = ""
856
+//			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
857
+//			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
858
+//			time_arr := strings.Split(order.SetlTime, " ")
859
+//			struct4101.AdmTime = time_arr[0]
860
+//			struct4101.AdmEndTime = time_arr[0]
861
+//			struct4101.DoctorName = doctor.UserName
862
+//			struct4101.DoctorCode = doctor.DoctorNumber
863
+//
864
+//			struct4101.Ntly = "CHN"
865
+//			struct4101.AdmCaty = "A03.06"
866
+//			var res ResultSeventeen
867
+//
868
+//			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
869
+//			fmt.Println(result)
870
+//			saveLog(result, request, "4101A", "清单上传")
871
+//			var dat map[string]interface{}
872
+//			if err := json.Unmarshal([]byte(result), &dat); err == nil {
873
+//				fmt.Println(dat)
874
+//			} else {
875
+//				fmt.Println(err)
876
+//			}
877
+//			userJSONBytes, _ := json.Marshal(dat)
878
+//			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
879
+//				//utils.ErrorLog("解析失败:%v", err)
880
+//				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
881
+//				//adminUser := c.GetAdminUserInfo()
882
+//				errlog := &models.HisOrderError{
883
+//					UserOrgId: org_id,
884
+//					Ctime:     time.Now().Unix(),
885
+//					Mtime:     time.Now().Unix(),
886
+//					ErrMsg:    res.ErrMsg + "解析失败",
887
+//					Status:    1,
888
+//					PatientId: order_id,
889
+//					Stage:     10138600,
890
+//				}
891
+//				service.CreateErrMsgLog(errlog)
892
+//				continue
893
+//			}
894
+//
895
+//			if res.Infcode != 0 {
896
+//				//adminUser := c.GetAdminUserInfo()
897
+//				errlog := &models.HisOrderError{
898
+//					UserOrgId: org_id,
899
+//					Ctime:     time.Now().Unix(),
900
+//					Mtime:     time.Now().Unix(),
901
+//					ErrMsg:    res.ErrMsg,
902
+//					Status:    1,
903
+//					PatientId: order_id,
904
+//					Stage:     10138600,
905
+//				}
906
+//				service.CreateErrMsgLog(errlog)
907
+//				continue
908
+//			} else {
909
+//				hisFundSettleListResult := &models.HisFundSettleListResult{
910
+//					Number:    res.Output.SetlListId,
911
+//					Status:    1,
912
+//					Ctime:     time.Now().Unix(),
913
+//					Mtime:     time.Now().Unix(),
914
+//					UserOrgId: org_id,
915
+//					IsUpload:  1,
916
+//					OrderId:   order_id,
917
+//				}
918
+//				service.CreateUploadRecord(hisFundSettleListResult)
919
+//				continue
920
+//			}
921
+//		}
922
+//	}
923
+//}
924 924
 
925 925
 func GetblbrBatchSettleList() {
926 926
 	org_id, _ := beego.AppConfig.Int64("org_id")
927
+	org_id = 10278
927 928
 	var orders []*models.HisOrder
928 929
 	//var orders []*models.HisOrderError
929 930
 	orders, _ = service.GetAllHisOrder10278()
@@ -939,7 +940,7 @@ func GetblbrBatchSettleList() {
939 940
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
940 941
 			var configTwo []*models.HisXtDiagnoseConfig
941 942
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
942
-			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
943
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2791)
943 944
 			for _, item := range diagnosis_idstwo {
944 945
 				id, _ := strconv.ParseInt(item, 10, 64)
945 946
 				diagnosisConfig, _ := service.FindDiagnoseById(id)

+ 4 - 4
models/models_3501.go View File

@@ -84,7 +84,7 @@ type Struct3503 struct {
84 84
 	Aprvno              string
85 85
 	ManuDate            string
86 86
 	ExpyEnd             string
87
-	FinlTrnsPric        string
87
+	FinlTrnsPric        float64
88 88
 	PurcRetnCnt         string
89 89
 	PurcInvoCodg        string
90 90
 	PurcInvoNo          string
@@ -121,7 +121,7 @@ type Struct3504 struct {
121 121
 	SplerPmtno          string
122 122
 	ManuDate            string
123 123
 	ExpyEnd             string
124
-	FinlTrnsPric        string
124
+	FinlTrnsPric        float64
125 125
 	PurcRetnCnt         string
126 126
 	PurcInvoCodg        string
127 127
 	PurcInvoNo          string
@@ -173,7 +173,7 @@ type Struct3505 struct {
173 173
 	ExpyEnd             string
174 174
 	RxFlag              string
175 175
 	TrdnFlag            string
176
-	FinlTrnsPric        string
176
+	FinlTrnsPric        float64
177 177
 	Rxno                string
178 178
 	RxCircFlag          string
179 179
 	RtalDocno           string
@@ -220,7 +220,7 @@ type Struct3506 struct {
220 220
 	ExpyEnd             string
221 221
 	RxFlag              string
222 222
 	TrdnFlag            string
223
-	FinlTrnsPric        string
223
+	FinlTrnsPric        float64
224 224
 	SelTrnsPric         string
225 225
 	SelRetnCnt          string
226 226
 	SelRetnTime         string

+ 1 - 1
models/new_stock_models.go View File

@@ -423,7 +423,7 @@ type DrugFlow struct {
423 423
 	LastStockMaxNumber        int64                `gorm:"column:last_stock_max_number" json:"last_stock_max_number" form:"last_stock_max_number"`
424 424
 	LastStockMinNumber        int64                `gorm:"column:last_stock_min_number" json:"last_stock_min_number" form:"last_stock_min_number"`
425 425
 	AdviceId                  int64                `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
426
-	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:PatientID,RecordDate,DrugId;AssociationForeignKey:PatientID,SystemTime,DrugId" json:"advice"`
426
+	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
427 427
 	SupplyWarehouseId         int64                `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
428 428
 	SupplyCancelOutId         int64                `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
429 429
 	SupplyWarehouseDetailInfo int64                `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`

+ 12 - 10
service/ahyb_service.go View File

@@ -3468,7 +3468,7 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string
3468 3468
 
3469 3469
 	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
3470 3470
 	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
3471
-	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
3471
+	inputData["hi_feesetl_type"] = "1"    // 人员编号 (来自1101接口返回)
3472 3472
 	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
3473 3473
 	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
3474 3474
 	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
@@ -3483,14 +3483,14 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string
3483 3483
 	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
3484 3484
 
3485 3485
 	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
3486
-	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
3487
-	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
3486
+	inputData["rxno"] = "---"                  // 人员编号 (来自1101接口返回)
3487
+	inputData["rx_circ_flag"] = "---"     // 人员编号 (来自1101接口返回)
3488 3488
 
3489 3489
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
3490
-	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
3490
+	inputData["stoout_no"] = "---"   // 人员编号 (来自1101接口返回)
3491 3491
 
3492
-	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
3493
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
3492
+	inputData["bchno"] = "---"                          // 人员编号 (来自1101接口返回)
3493
+	//inputData["drug_trac_codg"] = ""         // 人员编号 (来自1101接口返回)
3494 3494
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
3495 3495
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
3496 3496
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
@@ -3505,9 +3505,11 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string
3505 3505
 
3506 3506
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
3507 3507
 	for _, item := range codes {
3508
-		druginputData := make(map[string]interface{})
3509
-		druginputData["drug_trac_codg"] = item
3510
-		feedetail = append(feedetail, druginputData)
3508
+		if len(item) > 0 {
3509
+			druginputData := make(map[string]interface{})
3510
+			druginputData["drug_trac_codg"] = item
3511
+			feedetail = append(feedetail, druginputData)
3512
+		}
3511 3513
 	}
3512 3514
 	inputData["drugtracinfo"] = feedetail
3513 3515
 	input["selinfo"] = inputData
@@ -3527,7 +3529,7 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string
3527 3529
 	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3528 3530
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3529 3531
 	//url := gdyb_url + "3505"
3530
-	request_url = request_url + "1101"
3532
+	request_url = request_url + "3505"
3531 3533
 
3532 3534
 	request, err := http.NewRequest("POST", request_url, reader)
3533 3535
 	if err != nil {

+ 9 - 2
service/his_service.go View File

@@ -1560,7 +1560,7 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1560 1560
 	return
1561 1561
 }
1562 1562
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1563
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1563
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1564 1564
 	fmt.Println(err)
1565 1565
 	return
1566 1566
 }
@@ -1570,7 +1570,7 @@ func GetOrderError10138() (order []*models.HisOrderError, err error) {
1570 1570
 }
1571 1571
 
1572 1572
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1573
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' AND setl_time <= '2024-09-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1573
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-10-01 00:00:00' AND setl_time <= '2024-10-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574 1574
 	fmt.Println(err)
1575 1575
 	return
1576 1576
 }
@@ -1770,6 +1770,13 @@ func GetNewDrugFlowInfothree() (flows []*models.DrugFlow, err error) {
1770 1770
 	return
1771 1771
 }
1772 1772
 
1773
+func GetNewDrugFlowInfothree123() (flows []*models.DrugFlow, err error) {
1774
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = 10217 and status = 1 and length(drug_code) > 0   and consumable_type = 3 and is_sale = 0").Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775
+		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1776
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1777
+	return
1778
+}
1779
+
1773 1780
 func GetNewDrugFlowInforTen(system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1774 1781
 	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775 1782
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")

+ 1 - 1
service/jx_service.go View File

@@ -1127,7 +1127,7 @@ func JxybZY1101(certNo string, org_name string, doctor string, fixmedins_code st
1127 1127
 	}
1128 1128
 
1129 1129
 	inputData["begntime"] = "" // 开始时间
1130
-	inputData["psn_name"] = "" // 人员姓名
1130
+	inputData["psn_name"] = cainfo // 人员姓名
1131 1131
 	input["data"] = inputData
1132 1132
 	inputMessage["input"] = input //交易输入
1133 1133