|
@@ -124,10 +124,10 @@ func (c *InspectionApiController) CreatePatientInspection() {
|
124
|
124
|
return
|
125
|
125
|
}
|
126
|
126
|
|
127
|
|
- timeLayout := "2006-01-02 15:04:05"
|
|
127
|
+ timeLayout := "2006-01-02 15:04"
|
128
|
128
|
loc, _ := time.LoadLocation("Local")
|
129
|
129
|
|
130
|
|
- theTime, err := time.ParseInLocation(timeLayout, from.InspectDate+" 00:00:00", loc)
|
|
130
|
+ theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
|
131
|
131
|
if err != nil {
|
132
|
132
|
utils.ErrorLog(err.Error())
|
133
|
133
|
c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
|
|
@@ -226,13 +226,11 @@ func (c *InspectionApiController) CreatePatientInspection() {
|
226
|
226
|
}
|
227
|
227
|
|
228
|
228
|
func (c *InspectionApiController) EditPatientInspection() {
|
229
|
|
- fmt.Println("触发了没有---------------------------------------")
|
230
|
229
|
patient, _ := c.GetInt64("patient", 0)
|
231
|
230
|
remind_cycle, _ := c.GetInt64("remind_cycle", 0)
|
232
|
|
- dates := c.GetString("dates")
|
233
|
|
- projectid := c.GetString("projectid")
|
234
|
|
- fmt.Println("日期---", dates)
|
235
|
|
- fmt.Println("projectid", projectid)
|
|
231
|
+ // dates := c.GetString("dates")
|
|
232
|
+ // projectid := c.GetString("projectid")
|
|
233
|
+
|
236
|
234
|
if patient <= 0 {
|
237
|
235
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
238
|
236
|
return
|
|
@@ -253,23 +251,31 @@ func (c *InspectionApiController) EditPatientInspection() {
|
253
|
251
|
return
|
254
|
252
|
}
|
255
|
253
|
|
256
|
|
- timeLayout := "2006-01-02 15:04:05"
|
|
254
|
+ timeLayout := "2006-01-02 15:04"
|
257
|
255
|
loc, _ := time.LoadLocation("Local")
|
258
|
256
|
|
259
|
|
- theTime, err := time.ParseInLocation(timeLayout, from.InspectDate+" 00:00:00", loc)
|
|
257
|
+ theTime, err := time.ParseInLocation(timeLayout, from.InspectDate , loc)
|
260
|
258
|
if err != nil {
|
261
|
259
|
utils.ErrorLog(err.Error())
|
262
|
260
|
c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
|
263
|
261
|
return
|
264
|
262
|
}
|
265
|
263
|
|
|
264
|
+ oldTime, olderr := time.ParseInLocation(timeLayout, from.OldInspectDate , loc)
|
|
265
|
+ if olderr != nil {
|
|
266
|
+ utils.ErrorLog(olderr.Error())
|
|
267
|
+ c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
|
|
268
|
+ return
|
|
269
|
+ }
|
|
270
|
+
|
266
|
271
|
if len(from.FormItem) == 0 {
|
267
|
272
|
c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未填写项目")
|
268
|
273
|
return
|
269
|
274
|
}
|
270
|
275
|
|
271
|
276
|
date := theTime.Unix()
|
272
|
|
- insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
|
|
277
|
+ oldDate := oldTime.Unix()
|
|
278
|
+ insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, oldDate, from.ProjectId)
|
273
|
279
|
if err != nil {
|
274
|
280
|
utils.ErrorLog("%v", err)
|
275
|
281
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -306,10 +312,10 @@ func (c *InspectionApiController) EditPatientInspection() {
|
306
|
312
|
inspection.CreatedTime = time.Now().Unix()
|
307
|
313
|
inspection.UpdatedTime = time.Now().Unix()
|
308
|
314
|
addinsp = append(addinsp, inspection)
|
309
|
|
- } else if _, exi := inspMap[item.ID]; exi {
|
310
|
|
- fmt.Println("2222222222")
|
|
315
|
+ } else {
|
311
|
316
|
inspection := *inspMap[item.ID]
|
312
|
317
|
inspection.InspectValue = item.Value
|
|
318
|
+ inspection.InspectDate = date
|
313
|
319
|
inspection.UpdatedTime = time.Now().Unix()
|
314
|
320
|
editinsp = append(editinsp, inspection)
|
315
|
321
|
noMap = append(noMap, item.ID)
|
|
@@ -373,15 +379,15 @@ func (c *InspectionApiController) DeletePatientInspection() {
|
373
|
379
|
patient, _ := c.GetInt64("patient", 0)
|
374
|
380
|
ProjectId, _ := c.GetInt64("project_id", 0)
|
375
|
381
|
InspectDate := c.GetString("date")
|
376
|
|
- if patient <= 0 || ProjectId <= 0 || len(InspectDate) != 10 {
|
|
382
|
+ if patient <= 0 || ProjectId <= 0 || len(InspectDate) < 10 {
|
377
|
383
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
378
|
384
|
return
|
379
|
385
|
}
|
380
|
386
|
|
381
|
|
- timeLayout := "2006-01-02 15:04:05"
|
|
387
|
+ timeLayout := "2006-01-02 15:04"
|
382
|
388
|
loc, _ := time.LoadLocation("Local")
|
383
|
389
|
|
384
|
|
- theTime, err := time.ParseInLocation(timeLayout, InspectDate+" 00:00:00", loc)
|
|
390
|
+ theTime, err := time.ParseInLocation(timeLayout, InspectDate, loc)
|
385
|
391
|
if err != nil {
|
386
|
392
|
utils.ErrorLog(err.Error())
|
387
|
393
|
c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
|