Przeglądaj źródła

打印单单位修改

mainqaq 2 lat temu
rodzic
commit
7e3ab37fd1

+ 16 - 0
controllers/dialysis_api_controller.go Wyświetl plik

3312
 						childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3312
 						childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3313
 						child.SingleDose = childSingleDose
3313
 						child.SingleDose = childSingleDose
3314
 					}
3314
 					}
3315
+					if childMap["single_dose"] != nil && reflect.TypeOf(childMap["single_dose"]).String() == "float64" {
3316
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3317
+						child.SingleDose = childMap["single_dose"].(float64)
3318
+					}
3319
+					if childMap["remark"] != nil && reflect.TypeOf(childMap["remark"]).String() == "string" {
3320
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3321
+						child.Remark = childMap["remark"].(string)
3322
+					}
3323
+					if childMap["drug_id"] != nil && reflect.TypeOf(childMap["drug_id"]).String() == "float64" {
3324
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3325
+						child.DrugId = int64(childMap["drug_id"].(float64))
3326
+					}
3315
 
3327
 
3316
 					if childMap["single_dose_unit"] != nil && reflect.TypeOf(childMap["single_dose_unit"]).String() == "string" {
3328
 					if childMap["single_dose_unit"] != nil && reflect.TypeOf(childMap["single_dose_unit"]).String() == "string" {
3317
 						childSingleDoseUnit, _ := childMap["single_dose_unit"].(string)
3329
 						childSingleDoseUnit, _ := childMap["single_dose_unit"].(string)
3322
 						childPrescribingNumber, _ := strconv.ParseFloat(childMap["prescribing_number"].(string), 64)
3334
 						childPrescribingNumber, _ := strconv.ParseFloat(childMap["prescribing_number"].(string), 64)
3323
 						child.PrescribingNumber = childPrescribingNumber
3335
 						child.PrescribingNumber = childPrescribingNumber
3324
 					}
3336
 					}
3337
+					if childMap["prescribing_number"] != nil && reflect.TypeOf(childMap["prescribing_number"]).String() == "float64" {
3338
+						//childPrescribingNumber, _ := strconv.ParseFloat(childMap["prescribing_number"].(string), 64)
3339
+						child.PrescribingNumber = childMap["prescribing_number"].(float64)
3340
+					}
3325
 
3341
 
3326
 					if childMap["prescribing_number_unit"] != nil && reflect.TypeOf(childMap["prescribing_number_unit"]).String() == "string" {
3342
 					if childMap["prescribing_number_unit"] != nil && reflect.TypeOf(childMap["prescribing_number_unit"]).String() == "string" {
3327
 						childPrescribingNumberUnit, _ := childMap["prescribing_number_unit"].(string)
3343
 						childPrescribingNumberUnit, _ := childMap["prescribing_number_unit"].(string)

+ 4 - 4
controllers/patient_api_controller.go Wyświetl plik

1935
 						prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
1935
 						prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
1936
 						fmt.Println("prescriptionConfigwodweweeeweweweweweewewewwewew", prescriptionConfig)
1936
 						fmt.Println("prescriptionConfigwodweweeeweweweweweewewewwewew", prescriptionConfig)
1937
 						if prescriptionConfig.IsOpen == 1 {
1937
 						if prescriptionConfig.IsOpen == 1 {
1938
-							if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId,item.UserOrgId){
1938
+							if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
1939
 								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1939
 								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1940
 								//查询默认仓库
1940
 								//查询默认仓库
1941
 								storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
1941
 								storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
1972
 						}
1972
 						}
1973
 
1973
 
1974
 					} else {
1974
 					} else {
1975
-						if medical.IsUse == 2 {
1975
+						if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
1976
 							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1976
 							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1977
 							//更新字典里面的库存
1977
 							//更新字典里面的库存
1978
 							var sum_count int64
1978
 							var sum_count int64
2252
 					}
2252
 					}
2253
 
2253
 
2254
 					if prescribing_number_total <= total {
2254
 					if prescribing_number_total <= total {
2255
-						if medical.IsUse == 2 {
2255
+						if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
2256
 
2256
 
2257
 							if config.IsOpen != 1 {
2257
 							if config.IsOpen != 1 {
2258
 								service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2258
 								service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
3307
 
3307
 
3308
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "string" {
3308
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "string" {
3309
 		drug_id, _ := dataBody["drug_id"].(string)
3309
 		drug_id, _ := dataBody["drug_id"].(string)
3310
-		tmpDrugId,_ := strconv.ParseInt(drug_id,10,64)
3310
+		tmpDrugId, _ := strconv.ParseInt(drug_id, 10, 64)
3311
 		advice.DrugId = tmpDrugId
3311
 		advice.DrugId = tmpDrugId
3312
 	}
3312
 	}
3313
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "float64" {
3313
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "float64" {

+ 167 - 162
controllers/pharmacy_controller.go Wyświetl plik

14
 }
14
 }
15
 
15
 
16
 func PharmacyApiRegistRouters() {
16
 func PharmacyApiRegistRouters() {
17
-	beego.Router("/api/pharmacy/ceshili",&PharmacyController{},"get:Tlili")
18
-	beego.Router("/api/pharmacy/todaynumber",&PharmacyController{},"get:TodayNumber")//查询今天的待发药,已发药人数(
19
-	beego.Router("/api/pharmacy/waitingdrug",&PharmacyController{},"get:WaitingDrug")//获取当天待发药的所有患者(
20
-	beego.Router("/api/pharmacy/issueddrugs",&PharmacyController{},"get:IssuedDrug")//获取当天已发药的所有患者(
21
-	beego.Router("/api/pharmacy/getpharmacycontent",&PharmacyController{},"get:GetPharmacyContent")//获取当天该患者的所有信息(
22
-	beego.Router("/api/pharmacy/dispensingmedicine",&PharmacyController{},"get:DispensingMedicine")//患者发药按钮点击(
23
-	beego.Router("/api/pharmacy/drugwithdrawal",&PharmacyController{},"get:DrugWithdrawal")//退药按钮点击
24
-	beego.Router("/api/pharmacy/dispensingdetails",&PharmacyController{},"get:DispensingDetails")//获取发药明细的患者列表(
25
-	beego.Router("/api/pharmacy/prescriptiondetails",&PharmacyController{},"get:PrescriptionDetails")//发药明细-详情(
26
-	beego.Router("/api/pharmacy/dispensemedicine",&PharmacyController{},"get:DispenseMedicine")//获取当天已发药的药品(
27
-	beego.Router("/api/pharmacy/waitingmedicine",&PharmacyController{},"get:WaitingMedicine")//获取当天待发药的药品(
28
-	beego.Router("/api/pharmacy/getpatientswithdrugs",&PharmacyController{},"get:GetPatientsWithDrugs")//获取当天该药品的所有患者(
29
-	beego.Router("/api/pharmacy/medicinedeparture",&PharmacyController{},"get:MedicineDeparture")//药品发药按钮点击(
30
-	beego.Router("/api/pharmacy/getcurrentname",&PharmacyController{},"get:GetCurrentName")//获取当前登录账号的名字(
17
+	beego.Router("/api/pharmacy/ceshili", &PharmacyController{}, "get:Tlili")
18
+	beego.Router("/api/pharmacy/todaynumber", &PharmacyController{}, "get:TodayNumber")                   //查询今天的待发药,已发药人数(
19
+	beego.Router("/api/pharmacy/waitingdrug", &PharmacyController{}, "get:WaitingDrug")                   //获取当天待发药的所有患者(
20
+	beego.Router("/api/pharmacy/issueddrugs", &PharmacyController{}, "get:IssuedDrug")                    //获取当天已发药的所有患者(
21
+	beego.Router("/api/pharmacy/getpharmacycontent", &PharmacyController{}, "get:GetPharmacyContent")     //获取当天该患者的所有信息(
22
+	beego.Router("/api/pharmacy/dispensingmedicine", &PharmacyController{}, "get:DispensingMedicine")     //患者发药按钮点击(
23
+	beego.Router("/api/pharmacy/drugwithdrawal", &PharmacyController{}, "get:DrugWithdrawal")             //退药按钮点击
24
+	beego.Router("/api/pharmacy/dispensingdetails", &PharmacyController{}, "get:DispensingDetails")       //获取发药明细的患者列表(
25
+	beego.Router("/api/pharmacy/prescriptiondetails", &PharmacyController{}, "get:PrescriptionDetails")   //发药明细-详情(
26
+	beego.Router("/api/pharmacy/dispensemedicine", &PharmacyController{}, "get:DispenseMedicine")         //获取当天已发药的药品(
27
+	beego.Router("/api/pharmacy/waitingmedicine", &PharmacyController{}, "get:WaitingMedicine")           //获取当天待发药的药品(
28
+	beego.Router("/api/pharmacy/getpatientswithdrugs", &PharmacyController{}, "get:GetPatientsWithDrugs") //获取当天该药品的所有患者(
29
+	beego.Router("/api/pharmacy/medicinedeparture", &PharmacyController{}, "get:MedicineDeparture")       //药品发药按钮点击(
30
+	beego.Router("/api/pharmacy/getcurrentname", &PharmacyController{}, "get:GetCurrentName")             //获取当前登录账号的名字(
31
 }
31
 }
32
-func (this *PharmacyController)Tlili(){
33
-	times := this.GetString("time","")
32
+func (this *PharmacyController) Tlili() {
33
+	times := this.GetString("time", "")
34
 	timeLayout := "2006-01-02"
34
 	timeLayout := "2006-01-02"
35
 	loc, _ := time.LoadLocation("Local")
35
 	loc, _ := time.LoadLocation("Local")
36
-	var stime,etime int64
37
-	if times == ""{
38
-		stime,etime = service.GetNowTime()
39
-	}else {
36
+	var stime, etime int64
37
+	if times == "" {
38
+		stime, etime = service.GetNowTime()
39
+	} else {
40
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
40
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
41
 		stime = stmp.Unix()
41
 		stime = stmp.Unix()
42
 		etime = stime + 86399
42
 		etime = stime + 86399
43
 	}
43
 	}
44
-	//orgid := this.GetAdminUserInfo().CurrentOrgId
45
-	service.InitDrugidIsNil(9675,stime,etime)
44
+	orgid := this.GetAdminUserInfo().CurrentOrgId
45
+	service.InitDrugidIsNil(orgid, stime, etime)
46
 	this.ServeSuccessJSON(map[string]interface{}{
46
 	this.ServeSuccessJSON(map[string]interface{}{
47
 		"list": "err",
47
 		"list": "err",
48
 	})
48
 	})
49
 	return
49
 	return
50
 }
50
 }
51
-func (this *PharmacyController)GetCurrentName(){
51
+func (this *PharmacyController) GetCurrentName() {
52
 	create := this.GetAdminUserInfo().AdminUser.Id
52
 	create := this.GetAdminUserInfo().AdminUser.Id
53
 	this.ServeSuccessJSON(map[string]interface{}{
53
 	this.ServeSuccessJSON(map[string]interface{}{
54
 		"list": create,
54
 		"list": create,
55
 	})
55
 	})
56
 	return
56
 	return
57
 }
57
 }
58
+
58
 //查询今天的待发药,已发药人数
59
 //查询今天的待发药,已发药人数
59
-func (this *PharmacyController)TodayNumber(){
60
+func (this *PharmacyController) TodayNumber() {
60
 	var err error
61
 	var err error
61
 	defer func() {
62
 	defer func() {
62
-		if err != nil{
63
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
63
+		if err != nil {
64
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
64
 		}
65
 		}
65
 	}()
66
 	}()
66
 	orgid := this.GetAdminUserInfo().CurrentOrgId
67
 	orgid := this.GetAdminUserInfo().CurrentOrgId
67
-	times := this.GetString("time","")
68
+	times := this.GetString("time", "")
68
 	timeLayout := "2006-01-02"
69
 	timeLayout := "2006-01-02"
69
 	loc, _ := time.LoadLocation("Local")
70
 	loc, _ := time.LoadLocation("Local")
70
-	var stime,etime int64
71
-	if times == ""{
72
-		stime,etime = service.GetNowTime()
73
-	}else {
71
+	var stime, etime int64
72
+	if times == "" {
73
+		stime, etime = service.GetNowTime()
74
+	} else {
74
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
75
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
75
 		stime = stmp.Unix()
76
 		stime = stmp.Unix()
76
 		etime = stime + 86399
77
 		etime = stime + 86399
77
 	}
78
 	}
78
 	//查询表里当天的数据
79
 	//查询表里当天的数据
79
 	var wtotal int
80
 	var wtotal int
80
-	wtotal,err = service.GetTodayPharmacy(stime,etime,orgid,1)
81
-	if err != nil{
81
+	wtotal, err = service.GetTodayPharmacy(stime, etime, orgid, 1)
82
+	if err != nil {
82
 		utils.ErrorLog(err.Error())
83
 		utils.ErrorLog(err.Error())
83
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
84
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
84
 		return
85
 		return
85
 	}
86
 	}
86
 	var itotal int
87
 	var itotal int
87
-	itotal,err = service.GetTodayPharmacy(stime,etime,orgid,0)
88
-	if err != nil{
88
+	itotal, err = service.GetTodayPharmacy(stime, etime, orgid, 0)
89
+	if err != nil {
89
 		utils.ErrorLog(err.Error())
90
 		utils.ErrorLog(err.Error())
90
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
91
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
91
 		return
92
 		return
96
 	})
97
 	})
97
 	return
98
 	return
98
 }
99
 }
99
-func (this *PharmacyController)IssuedDrug(){
100
+func (this *PharmacyController) IssuedDrug() {
100
 	var err error
101
 	var err error
101
 	defer func() {
102
 	defer func() {
102
-		if err != nil{
103
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
103
+		if err != nil {
104
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
104
 		}
105
 		}
105
 	}()
106
 	}()
106
-	keyword := this.GetString("keyword","")
107
-	times := this.GetString("time","")
107
+	keyword := this.GetString("keyword", "")
108
+	times := this.GetString("time", "")
108
 	orgid := this.GetAdminUserInfo().CurrentOrgId
109
 	orgid := this.GetAdminUserInfo().CurrentOrgId
109
 	timeLayout := "2006-01-02"
110
 	timeLayout := "2006-01-02"
110
 	loc, _ := time.LoadLocation("Local")
111
 	loc, _ := time.LoadLocation("Local")
111
-	var stime,etime int64
112
-	if times == ""{
113
-		stime,etime = service.GetNowTime()
114
-	}else {
112
+	var stime, etime int64
113
+	if times == "" {
114
+		stime, etime = service.GetNowTime()
115
+	} else {
115
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
116
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
116
 		stime = stmp.Unix()
117
 		stime = stmp.Unix()
117
 		etime = stime + 86399
118
 		etime = stime + 86399
118
 	}
119
 	}
119
 	//查询表里当天的数据
120
 	//查询表里当天的数据
120
 	var flist []*models.TmpPatient
121
 	var flist []*models.TmpPatient
121
-	flist,err = service.GetTodayDrug(stime,etime,orgid,1,keyword)
122
-	if err != nil{
122
+	flist, err = service.GetTodayDrug(stime, etime, orgid, 1, keyword)
123
+	if err != nil {
123
 		utils.ErrorLog(err.Error())
124
 		utils.ErrorLog(err.Error())
124
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
125
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
125
 		return
126
 		return
129
 	})
130
 	})
130
 	return
131
 	return
131
 }
132
 }
132
-func (this *PharmacyController)WaitingDrug(){
133
+func (this *PharmacyController) WaitingDrug() {
133
 	var err error
134
 	var err error
134
 	defer func() {
135
 	defer func() {
135
-		if err != nil{
136
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
136
+		if err != nil {
137
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
137
 		}
138
 		}
138
 	}()
139
 	}()
139
-	keyword := this.GetString("keyword","")
140
-	times := this.GetString("time","")
140
+	keyword := this.GetString("keyword", "")
141
+	times := this.GetString("time", "")
141
 	orgid := this.GetAdminUserInfo().CurrentOrgId
142
 	orgid := this.GetAdminUserInfo().CurrentOrgId
142
 	timeLayout := "2006-01-02"
143
 	timeLayout := "2006-01-02"
143
 	loc, _ := time.LoadLocation("Local")
144
 	loc, _ := time.LoadLocation("Local")
144
-	var stime,etime int64
145
-	if times == ""{
146
-		stime,etime = service.GetNowTime()
147
-	}else {
145
+	var stime, etime int64
146
+	if times == "" {
147
+		stime, etime = service.GetNowTime()
148
+	} else {
148
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
149
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
149
 		stime = stmp.Unix()
150
 		stime = stmp.Unix()
150
 		etime = stime + 86399
151
 		etime = stime + 86399
151
 	}
152
 	}
152
 	//查询表里当天的数据
153
 	//查询表里当天的数据
153
 	var flist []*models.TmpPatient
154
 	var flist []*models.TmpPatient
154
-	flist,err = service.GetTodayDrug(stime,etime,orgid,0,keyword)
155
-	if err != nil{
155
+	flist, err = service.GetTodayDrug(stime, etime, orgid, 0, keyword)
156
+	if err != nil {
156
 		utils.ErrorLog(err.Error())
157
 		utils.ErrorLog(err.Error())
157
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
158
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
158
 		return
159
 		return
162
 	})
163
 	})
163
 	return
164
 	return
164
 }
165
 }
166
+
165
 //
167
 //
166
-func (this *PharmacyController)GetPharmacyContent(){
168
+func (this *PharmacyController) GetPharmacyContent() {
167
 	var err error
169
 	var err error
168
 	defer func() {
170
 	defer func() {
169
-		if err != nil{
170
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
171
+		if err != nil {
172
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
171
 		}
173
 		}
172
 	}()
174
 	}()
173
-	patient_id,_ := this.GetInt64("patient_id",0)
174
-	is_medicine,_ := this.GetInt64("is_medicine",0)//0:待发药,1:已发药
175
-	times := this.GetString("time","")
175
+	patient_id, _ := this.GetInt64("patient_id", 0)
176
+	is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
177
+	times := this.GetString("time", "")
176
 	orgid := this.GetAdminUserInfo().CurrentOrgId
178
 	orgid := this.GetAdminUserInfo().CurrentOrgId
177
 	timeLayout := "2006-01-02"
179
 	timeLayout := "2006-01-02"
178
 	loc, _ := time.LoadLocation("Local")
180
 	loc, _ := time.LoadLocation("Local")
179
-	var stime,etime int64
180
-	if times == ""{
181
-		stime,etime = service.GetNowTime()
182
-	}else {
181
+	var stime, etime int64
182
+	if times == "" {
183
+		stime, etime = service.GetNowTime()
184
+	} else {
183
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
185
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
184
 		stime = stmp.Unix()
186
 		stime = stmp.Unix()
185
 		etime = stime + 86399
187
 		etime = stime + 86399
186
 	}
188
 	}
187
 	var list []*models.PharmacyContent
189
 	var list []*models.PharmacyContent
188
-	list,err = service.GetPatientMedication(orgid,patient_id,stime,etime,is_medicine)
189
-	if err != nil{
190
+	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
191
+	if err != nil {
190
 		utils.ErrorLog(err.Error())
192
 		utils.ErrorLog(err.Error())
191
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
193
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
192
 		return
194
 		return
200
 	return
202
 	return
201
 
203
 
202
 }
204
 }
205
+
203
 //发药按钮点击
206
 //发药按钮点击
204
-func (this *PharmacyController)DispensingMedicine()  {
207
+func (this *PharmacyController) DispensingMedicine() {
205
 	var err error
208
 	var err error
206
 	defer func() {
209
 	defer func() {
207
-		if err != nil{
208
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
210
+		if err != nil {
211
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
209
 		}
212
 		}
210
 	}()
213
 	}()
211
-	patient_id,_ := this.GetInt64("patient_id",0)
212
-	times := this.GetString("time","")
214
+	patient_id, _ := this.GetInt64("patient_id", 0)
215
+	times := this.GetString("time", "")
213
 	orgid := this.GetAdminUserInfo().CurrentOrgId
216
 	orgid := this.GetAdminUserInfo().CurrentOrgId
214
 	creater := this.GetAdminUserInfo().AdminUser.Id
217
 	creater := this.GetAdminUserInfo().AdminUser.Id
215
 	timeLayout := "2006-01-02"
218
 	timeLayout := "2006-01-02"
216
 	loc, _ := time.LoadLocation("Local")
219
 	loc, _ := time.LoadLocation("Local")
217
-	var stime,etime int64
218
-	if times == ""{
219
-		stime,etime = service.GetNowTime()
220
-	}else {
220
+	var stime, etime int64
221
+	if times == "" {
222
+		stime, etime = service.GetNowTime()
223
+	} else {
221
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
224
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
222
 		stime = stmp.Unix()
225
 		stime = stmp.Unix()
223
 		etime = stime + 86399
226
 		etime = stime + 86399
224
 	}
227
 	}
225
-	err = service.DispensingMedicine(orgid,patient_id,stime,etime,creater)
226
-	if err != nil{
228
+	err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
229
+	if err != nil {
227
 		utils.ErrorLog(err.Error())
230
 		utils.ErrorLog(err.Error())
228
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
231
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
229
 		return
232
 		return
233
 	})
236
 	})
234
 	return
237
 	return
235
 }
238
 }
239
+
236
 //退药按钮点击
240
 //退药按钮点击
237
-func (this *PharmacyController)DrugWithdrawal(){
241
+func (this *PharmacyController) DrugWithdrawal() {
238
 	var err error
242
 	var err error
239
 	defer func() {
243
 	defer func() {
240
-		if err != nil{
241
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
244
+		if err != nil {
245
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
242
 		}
246
 		}
243
 	}()
247
 	}()
244
-	patient_id,_ := this.GetInt64("patient_id",0)
245
-	times := this.GetString("time","")
248
+	patient_id, _ := this.GetInt64("patient_id", 0)
249
+	times := this.GetString("time", "")
246
 	orgid := this.GetAdminUserInfo().CurrentOrgId
250
 	orgid := this.GetAdminUserInfo().CurrentOrgId
247
 	creater := this.GetAdminUserInfo().AdminUser.Id
251
 	creater := this.GetAdminUserInfo().AdminUser.Id
248
 	timeLayout := "2006-01-02"
252
 	timeLayout := "2006-01-02"
249
 	loc, _ := time.LoadLocation("Local")
253
 	loc, _ := time.LoadLocation("Local")
250
-	var stime,etime int64
251
-	if times == ""{
252
-		stime,etime = service.GetNowTime()
253
-	}else {
254
+	var stime, etime int64
255
+	if times == "" {
256
+		stime, etime = service.GetNowTime()
257
+	} else {
254
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
258
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
255
 		stime = stmp.Unix()
259
 		stime = stmp.Unix()
256
 		etime = stime + 86399
260
 		etime = stime + 86399
257
 	}
261
 	}
258
-	err = service.DrugWithdrawal(orgid,patient_id,stime,etime,creater)
259
-	if err != nil{
262
+	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
263
+	if err != nil {
260
 		utils.ErrorLog(err.Error())
264
 		utils.ErrorLog(err.Error())
261
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
265
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
262
 		return
266
 		return
269
 }
273
 }
270
 
274
 
271
 //发药明细列表
275
 //发药明细列表
272
-func (this *PharmacyController)DispensingDetails(){
276
+func (this *PharmacyController) DispensingDetails() {
273
 	var err error
277
 	var err error
274
 	defer func() {
278
 	defer func() {
275
-		if err != nil{
276
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
279
+		if err != nil {
280
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
277
 		}
281
 		}
278
 	}()
282
 	}()
279
-	keyword := this.GetString("keyword","")//患者名称
280
-	start_time := this.GetString("start_time","")//开始时间
281
-	end_time := this.GetString("end_time","")//结束时间
282
-	page, _ := this.GetInt64("page",1)               //页码
283
-	limit, _ := this.GetInt64("limit",10)             //每一页查出来的条数
283
+	keyword := this.GetString("keyword", "")       //患者名称
284
+	start_time := this.GetString("start_time", "") //开始时间
285
+	end_time := this.GetString("end_time", "")     //结束时间
286
+	page, _ := this.GetInt64("page", 1)            //页码
287
+	limit, _ := this.GetInt64("limit", 10)         //每一页查出来的条数
284
 	orgid := this.GetAdminUserInfo().CurrentOrgId
288
 	orgid := this.GetAdminUserInfo().CurrentOrgId
285
 	timeLayout := "2006-01-02"
289
 	timeLayout := "2006-01-02"
286
 	loc, _ := time.LoadLocation("Local")
290
 	loc, _ := time.LoadLocation("Local")
287
-	var stime,etime int64
288
-	if start_time == ""{
291
+	var stime, etime int64
292
+	if start_time == "" {
289
 		stime = 1
293
 		stime = 1
290
-	}else {
294
+	} else {
291
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
295
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
292
 		stime = stmp.Unix()
296
 		stime = stmp.Unix()
293
 	}
297
 	}
294
-	if end_time == ""{
295
-		_,etime = service.GetNowTime()
296
-	}else {
297
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59",loc)
298
+	if end_time == "" {
299
+		_, etime = service.GetNowTime()
300
+	} else {
301
+		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
298
 		etime = etmp.Unix()
302
 		etime = etmp.Unix()
299
 	}
303
 	}
300
 	var dislist []*models.DispensingList
304
 	var dislist []*models.DispensingList
301
 	var total int64
305
 	var total int64
302
-	dislist,total,err = service.DispensingDetailsList(stime,etime,orgid,page,limit,keyword)
303
-	if err != nil{
306
+	dislist, total, err = service.DispensingDetailsList(stime, etime, orgid, page, limit, keyword)
307
+	if err != nil {
304
 		utils.ErrorLog(err.Error())
308
 		utils.ErrorLog(err.Error())
305
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
309
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
306
 		return
310
 		return
307
 	}
311
 	}
308
 
312
 
309
 	this.ServeSuccessJSON(map[string]interface{}{
313
 	this.ServeSuccessJSON(map[string]interface{}{
310
-		"list": dislist,
311
-		"total":total,
314
+		"list":  dislist,
315
+		"total": total,
312
 	})
316
 	})
313
 	return
317
 	return
314
 }
318
 }
319
+
315
 //处方详情
320
 //处方详情
316
-func (this *PharmacyController)PrescriptionDetails(){
321
+func (this *PharmacyController) PrescriptionDetails() {
317
 	var err error
322
 	var err error
318
 	defer func() {
323
 	defer func() {
319
-		if err != nil{
320
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
324
+		if err != nil {
325
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
321
 		}
326
 		}
322
 	}()
327
 	}()
323
 	//患者姓名
328
 	//患者姓名
324
-	patient_id,_ := this.GetInt64("patient_id",0)
329
+	patient_id, _ := this.GetInt64("patient_id", 0)
325
 	//发药时间
330
 	//发药时间
326
-	record_date,_ := this.GetInt64("record_date",0)
331
+	record_date, _ := this.GetInt64("record_date", 0)
327
 	orgid := this.GetAdminUserInfo().CurrentOrgId
332
 	orgid := this.GetAdminUserInfo().CurrentOrgId
328
-	if record_date == 0 || patient_id == 0{
333
+	if record_date == 0 || patient_id == 0 {
329
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
334
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
330
 		return
335
 		return
331
 	}
336
 	}
332
 	var list []*models.PrescripDetails
337
 	var list []*models.PrescripDetails
333
-	list,err = service.PrescriptionDetails(patient_id,record_date,orgid)
334
-	if err != nil{
338
+	list, err = service.PrescriptionDetails(patient_id, record_date, orgid)
339
+	if err != nil {
335
 		utils.ErrorLog(err.Error())
340
 		utils.ErrorLog(err.Error())
336
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
341
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
337
 		return
342
 		return
343
 }
348
 }
344
 
349
 
345
 //已发药品的信息
350
 //已发药品的信息
346
-func (this *PharmacyController)DispenseMedicine(){
351
+func (this *PharmacyController) DispenseMedicine() {
347
 	var err error
352
 	var err error
348
 	defer func() {
353
 	defer func() {
349
-		if err != nil{
350
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
354
+		if err != nil {
355
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
351
 		}
356
 		}
352
 	}()
357
 	}()
353
-	keyword := this.GetString("keyword","")
354
-	times := this.GetString("time","")
358
+	keyword := this.GetString("keyword", "")
359
+	times := this.GetString("time", "")
355
 	orgid := this.GetAdminUserInfo().CurrentOrgId
360
 	orgid := this.GetAdminUserInfo().CurrentOrgId
356
 	timeLayout := "2006-01-02"
361
 	timeLayout := "2006-01-02"
357
 	loc, _ := time.LoadLocation("Local")
362
 	loc, _ := time.LoadLocation("Local")
358
-	var stime,etime int64
359
-	if times == ""{
360
-		stime,etime = service.GetNowTime()
361
-	}else {
363
+	var stime, etime int64
364
+	if times == "" {
365
+		stime, etime = service.GetNowTime()
366
+	} else {
362
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
367
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
363
 		stime = stmp.Unix()
368
 		stime = stmp.Unix()
364
 		etime = stime + 86399
369
 		etime = stime + 86399
365
 	}
370
 	}
366
 	//查询表里当天的数据
371
 	//查询表里当天的数据
367
 	var flist []*models.ListOfDrugs
372
 	var flist []*models.ListOfDrugs
368
-	flist,err = service.GetTodayMedicine(stime,etime,orgid,1,keyword)
369
-	if err != nil{
373
+	flist, err = service.GetTodayMedicine(stime, etime, orgid, 1, keyword)
374
+	if err != nil {
370
 		utils.ErrorLog(err.Error())
375
 		utils.ErrorLog(err.Error())
371
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
376
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
372
 		return
377
 		return
376
 	})
381
 	})
377
 	return
382
 	return
378
 }
383
 }
384
+
379
 //待发药的药品信息
385
 //待发药的药品信息
380
-func (this *PharmacyController)WaitingMedicine(){
386
+func (this *PharmacyController) WaitingMedicine() {
381
 	var err error
387
 	var err error
382
 	defer func() {
388
 	defer func() {
383
-		if err != nil{
384
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
389
+		if err != nil {
390
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
385
 		}
391
 		}
386
 	}()
392
 	}()
387
-	keyword := this.GetString("keyword","")
388
-	times := this.GetString("time","")
393
+	keyword := this.GetString("keyword", "")
394
+	times := this.GetString("time", "")
389
 	orgid := this.GetAdminUserInfo().CurrentOrgId
395
 	orgid := this.GetAdminUserInfo().CurrentOrgId
390
 	timeLayout := "2006-01-02"
396
 	timeLayout := "2006-01-02"
391
 	loc, _ := time.LoadLocation("Local")
397
 	loc, _ := time.LoadLocation("Local")
392
-	var stime,etime int64
393
-	if times == ""{
394
-		stime,etime = service.GetNowTime()
395
-	}else {
398
+	var stime, etime int64
399
+	if times == "" {
400
+		stime, etime = service.GetNowTime()
401
+	} else {
396
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
402
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
397
 		stime = stmp.Unix()
403
 		stime = stmp.Unix()
398
 		etime = stime + 86399
404
 		etime = stime + 86399
399
 	}
405
 	}
400
 	//查询表里当天的数据
406
 	//查询表里当天的数据
401
 	var flist []*models.ListOfDrugs
407
 	var flist []*models.ListOfDrugs
402
-	flist,err = service.GetTodayMedicine(stime,etime,orgid,0,keyword)
403
-	if err != nil{
408
+	flist, err = service.GetTodayMedicine(stime, etime, orgid, 0, keyword)
409
+	if err != nil {
404
 		utils.ErrorLog(err.Error())
410
 		utils.ErrorLog(err.Error())
405
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
411
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
406
 		return
412
 		return
412
 }
418
 }
413
 
419
 
414
 //获取药品的所有患者信息
420
 //获取药品的所有患者信息
415
-func (this *PharmacyController)GetPatientsWithDrugs(){
421
+func (this *PharmacyController) GetPatientsWithDrugs() {
416
 	var err error
422
 	var err error
417
 	defer func() {
423
 	defer func() {
418
-		if err != nil{
419
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
424
+		if err != nil {
425
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
420
 		}
426
 		}
421
 	}()
427
 	}()
422
-	drug_id,_ := this.GetInt64("drug_id",0)
423
-	is_medicine,_ := this.GetInt64("is_medicine",0)//0:待发药,1:已发药
424
-	times := this.GetString("time","")
428
+	drug_id, _ := this.GetInt64("drug_id", 0)
429
+	is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
430
+	times := this.GetString("time", "")
425
 	orgid := this.GetAdminUserInfo().CurrentOrgId
431
 	orgid := this.GetAdminUserInfo().CurrentOrgId
426
 	timeLayout := "2006-01-02"
432
 	timeLayout := "2006-01-02"
427
 	loc, _ := time.LoadLocation("Local")
433
 	loc, _ := time.LoadLocation("Local")
428
-	var stime,etime int64
429
-	if times == ""{
430
-		stime,etime = service.GetNowTime()
431
-	}else {
434
+	var stime, etime int64
435
+	if times == "" {
436
+		stime, etime = service.GetNowTime()
437
+	} else {
432
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
438
 		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
433
 		stime = stmp.Unix()
439
 		stime = stmp.Unix()
434
 		etime = stime + 86399
440
 		etime = stime + 86399
435
 	}
441
 	}
436
 	var list []*models.PatientInformation
442
 	var list []*models.PatientInformation
437
-	list,err = service.FindMedicationList(orgid,drug_id,stime,etime,is_medicine)
438
-	if err != nil{
443
+	list, err = service.FindMedicationList(orgid, drug_id, stime, etime, is_medicine)
444
+	if err != nil {
439
 		utils.ErrorLog(err.Error())
445
 		utils.ErrorLog(err.Error())
440
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
446
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
441
 		return
447
 		return
445
 	})
451
 	})
446
 	return
452
 	return
447
 }
453
 }
454
+
448
 //药品管理发药按钮点击
455
 //药品管理发药按钮点击
449
-func (this *PharmacyController)MedicineDeparture(){
456
+func (this *PharmacyController) MedicineDeparture() {
450
 	var err error
457
 	var err error
451
 	defer func() {
458
 	defer func() {
452
-		if err != nil{
453
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
459
+		if err != nil {
460
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
454
 		}
461
 		}
455
 	}()
462
 	}()
456
-	creater,_ := this.GetInt64("creater",0)//领药人
457
-	ids := this.GetString("ids","")//发药的数据
463
+	creater, _ := this.GetInt64("creater", 0) //领药人
464
+	ids := this.GetString("ids", "")          //发药的数据
458
 	orgid := this.GetAdminUserInfo().CurrentOrgId
465
 	orgid := this.GetAdminUserInfo().CurrentOrgId
459
-	orgid = 9675
460
-	creater = 809
461
-	if ids == ""{
466
+	if ids == "" {
462
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
467
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
463
 		return
468
 		return
464
 	}
469
 	}
465
-	err = service.MedicineDeparture(ids,creater,orgid)
466
-	if err != nil{
470
+	err = service.MedicineDeparture(ids, creater, orgid)
471
+	if err != nil {
467
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
472
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
468
 		return
473
 		return
469
 	}
474
 	}

+ 10 - 2
controllers/supply_order_api_contorller.go Wyświetl plik

123
 
123
 
124
 //获取供应商列表GetSupplyList
124
 //获取供应商列表GetSupplyList
125
 func (this *SupplyOrderApiController) GetSupplyList() {
125
 func (this *SupplyOrderApiController) GetSupplyList() {
126
+	var err error
127
+	defer func() {
128
+		if err != nil {
129
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
130
+		}
131
+	}()
126
 	ctype, _ := this.GetInt64("ctype") //供应商类别
132
 	ctype, _ := this.GetInt64("ctype") //供应商类别
127
 	page, _ := this.GetInt64("page")   //页码
133
 	page, _ := this.GetInt64("page")   //页码
128
 	limit, _ := this.GetInt64("limit") //每一页查出来的条数
134
 	limit, _ := this.GetInt64("limit") //每一页查出来的条数
130
 		"page":  {"must", "string", "page"},
136
 		"page":  {"must", "string", "page"},
131
 		"limit": {"must", "string", "limit"},
137
 		"limit": {"must", "string", "limit"},
132
 	}
138
 	}
133
-	_, err := CheckParams(this, &check)
139
+	_, err = CheckParams(this, &check)
134
 	if err != nil {
140
 	if err != nil {
135
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
141
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
136
 	}
142
 	}
137
 	keyword := this.GetString("keyword") //供应商编号\供应商名称\联系人名字
143
 	keyword := this.GetString("keyword") //供应商编号\供应商名称\联系人名字
138
 	orgId := this.GetAdminUserInfo().CurrentOrgId
144
 	orgId := this.GetAdminUserInfo().CurrentOrgId
139
 	//获取分页的数据
145
 	//获取分页的数据
140
-	list, total, err := service.GetSupplyList(ctype, page, limit, keyword, orgId)
146
+	var list []*models.SpSupplierName
147
+	var total int64
148
+	list, total, err = service.GetSupplyList(ctype, page, limit, keyword, orgId)
141
 	//获取供应商类别
149
 	//获取供应商类别
142
 	costClassify := "供应商类别"
150
 	costClassify := "供应商类别"
143
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
151
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)

Plik diff jest za duży
+ 497 - 470
service/pharmacy_service.go