|
@@ -243,72 +243,91 @@ func (this *NewDialysisApiController) SavePatient() {
|
243
|
243
|
|
244
|
244
|
//如果是血透病人
|
245
|
245
|
if bloodPatient == 1 {
|
246
|
|
- _, errcode := service.GetPatientData(phone, orgid)
|
247
|
|
- if errcode == gorm.ErrRecordNotFound {
|
248
|
|
- patients := models.Patients{
|
249
|
|
- Name: name,
|
250
|
|
- Gender: sex,
|
251
|
|
- Birthday: birth,
|
252
|
|
- Age: ages,
|
253
|
|
- Phone: phone,
|
254
|
|
- Lapseto: lapseto,
|
255
|
|
- AdmissionNumber: adminssionNumber,
|
256
|
|
- FirstDialysisDate: fisttime,
|
257
|
|
- Diagnose: diagonse,
|
258
|
|
- Source: patientsoure,
|
259
|
|
- DialysisNo: dialysis,
|
260
|
|
- UserOrgId: orgid,
|
261
|
|
- Status: 1,
|
262
|
|
- CreatedTime: time.Now().Unix(),
|
263
|
|
- Avatar: avatar,
|
264
|
|
- IdCardNo: idCard,
|
265
|
|
- IsInfectious: is_infectious,
|
266
|
|
- }
|
267
|
|
- err := service.CreateOldPatient(&patients)
|
268
|
|
- fmt.Print("报错", err)
|
269
|
|
- patient, err := service.GetLastOldPatient(orgid)
|
270
|
|
- fmt.Print("病人ID", patient.ID)
|
271
|
|
- err = service.AddContagions(patient.ID, patient.CreatedTime, patient.UpdatedTime, ids)
|
272
|
|
- fmt.Println("添加传染病失败", err)
|
273
|
|
-
|
274
|
|
- patientsNew := models.XtPatientsNew{
|
275
|
|
- Name: name,
|
276
|
|
- Gender: sex,
|
277
|
|
- Birthday: birth,
|
278
|
|
- Age: ages,
|
279
|
|
- Phone: phone,
|
280
|
|
- Lapseto: lapseto,
|
281
|
|
- AdmissionNumber: adminssionNumber,
|
282
|
|
- FirstDialysisDate: fisttime,
|
283
|
|
- Diagnose: diagonse,
|
284
|
|
- Source: patientsoure,
|
285
|
|
- DialysisNo: dialysis,
|
286
|
|
- UserOrgId: orgid,
|
287
|
|
- Status: 1,
|
288
|
|
- CreatedTime: time.Now().Unix(),
|
289
|
|
- Avatar: avatar,
|
290
|
|
- MemberPatients: memberpatient,
|
291
|
|
- BloodPatients: bloodPatient,
|
292
|
|
- SlowPatients: slowpatient,
|
293
|
|
- BloodId: patient.ID,
|
294
|
|
- IsInfectious: is_infectious,
|
295
|
|
- IdCardNo: idCard,
|
296
|
|
- }
|
297
|
|
- err = service.CreateNewPatient(&patientsNew)
|
298
|
|
- fmt.Print("报错", err)
|
299
|
|
- if err != nil {
|
300
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
301
|
|
- return
|
302
|
|
- }
|
303
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
304
|
|
- "patient": patientsNew,
|
305
|
|
- })
|
306
|
|
- } else if errcode == nil {
|
307
|
|
- fmt.Print("病人已存在")
|
|
246
|
+ //查询身份证号码是否存在
|
|
247
|
+ thisPatientOne, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
|
|
248
|
+ if thisPatientOne.ID > 0 {
|
|
249
|
+ returnData := make(map[string]interface{}, 0)
|
|
250
|
+ returnData["msg"] = "身份证号码已存在"
|
|
251
|
+ this.ServeSuccessJSON(returnData)
|
308
|
252
|
return
|
309
|
|
- } else {
|
|
253
|
+ }
|
|
254
|
+
|
|
255
|
+ //查询手机号码是否存在
|
|
256
|
+ thisPatient, err := service.FindPatientByMobileOne(phone, orgid)
|
|
257
|
+ if thisPatient.ID > 0 {
|
|
258
|
+ returnData := make(map[string]interface{}, 0)
|
|
259
|
+ returnData["msg"] = "手机号码已存在"
|
|
260
|
+ this.ServeSuccessJSON(returnData)
|
|
261
|
+ return
|
|
262
|
+ }
|
310
|
263
|
|
|
264
|
+ //查询透析号是否存在
|
|
265
|
+ thisPatientTwo, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
|
|
266
|
+ if thisPatientTwo.ID > 0 {
|
|
267
|
+ returnData := make(map[string]interface{}, 0)
|
|
268
|
+ returnData["msg"] = "透析号已存在"
|
|
269
|
+ this.ServeSuccessJSON(returnData)
|
|
270
|
+ return
|
|
271
|
+ }
|
|
272
|
+
|
|
273
|
+ patients := models.Patients{
|
|
274
|
+ Name: name,
|
|
275
|
+ Gender: sex,
|
|
276
|
+ Birthday: birth,
|
|
277
|
+ Age: ages,
|
|
278
|
+ Phone: phone,
|
|
279
|
+ Lapseto: lapseto,
|
|
280
|
+ AdmissionNumber: adminssionNumber,
|
|
281
|
+ FirstDialysisDate: fisttime,
|
|
282
|
+ Diagnose: diagonse,
|
|
283
|
+ Source: patientsoure,
|
|
284
|
+ DialysisNo: dialysis,
|
|
285
|
+ UserOrgId: orgid,
|
|
286
|
+ Status: 1,
|
|
287
|
+ CreatedTime: time.Now().Unix(),
|
|
288
|
+ Avatar: avatar,
|
|
289
|
+ IdCardNo: idCard,
|
|
290
|
+ IsInfectious: is_infectious,
|
311
|
291
|
}
|
|
292
|
+ err = service.CreateOldPatient(&patients)
|
|
293
|
+ fmt.Print("报错", err)
|
|
294
|
+ patient, err := service.GetLastOldPatient(orgid)
|
|
295
|
+ fmt.Print("病人ID", patient.ID)
|
|
296
|
+ err = service.AddContagions(patient.ID, patient.CreatedTime, patient.UpdatedTime, ids)
|
|
297
|
+ fmt.Println("添加传染病失败", err)
|
|
298
|
+
|
|
299
|
+ patientsNew := models.XtPatientsNew{
|
|
300
|
+ Name: name,
|
|
301
|
+ Gender: sex,
|
|
302
|
+ Birthday: birth,
|
|
303
|
+ Age: ages,
|
|
304
|
+ Phone: phone,
|
|
305
|
+ Lapseto: lapseto,
|
|
306
|
+ AdmissionNumber: adminssionNumber,
|
|
307
|
+ FirstDialysisDate: fisttime,
|
|
308
|
+ Diagnose: diagonse,
|
|
309
|
+ Source: patientsoure,
|
|
310
|
+ DialysisNo: dialysis,
|
|
311
|
+ UserOrgId: orgid,
|
|
312
|
+ Status: 1,
|
|
313
|
+ CreatedTime: time.Now().Unix(),
|
|
314
|
+ Avatar: avatar,
|
|
315
|
+ MemberPatients: memberpatient,
|
|
316
|
+ BloodPatients: bloodPatient,
|
|
317
|
+ SlowPatients: slowpatient,
|
|
318
|
+ BloodId: patient.ID,
|
|
319
|
+ IsInfectious: is_infectious,
|
|
320
|
+ IdCardNo: idCard,
|
|
321
|
+ }
|
|
322
|
+ err = service.CreateNewPatient(&patientsNew)
|
|
323
|
+ fmt.Print("报错", err)
|
|
324
|
+ if err != nil {
|
|
325
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
326
|
+ return
|
|
327
|
+ }
|
|
328
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
329
|
+ "patient": patientsNew,
|
|
330
|
+ })
|
312
|
331
|
}
|
313
|
332
|
|
314
|
333
|
fmt.Print("slowpatient", slowpatient)
|
|
@@ -511,7 +530,7 @@ func (this *NewDialysisApiController) SavePatient() {
|
511
|
530
|
MemberTreatement: treatmentmethod,
|
512
|
531
|
}
|
513
|
532
|
err = service.CreateNewPatient(&patientsNew)
|
514
|
|
- fmt.Print("报错-----------------------", err)
|
|
533
|
+ fmt.Print("报错", err)
|
515
|
534
|
if err != nil {
|
516
|
535
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
517
|
536
|
return
|
|
@@ -578,7 +597,7 @@ func (this *NewDialysisApiController) GetDoctorAdvices() {
|
578
|
597
|
fmt.Print("开始时间", startime)
|
579
|
598
|
end := this.GetString("endtime")
|
580
|
599
|
fmt.Print("end", end)
|
581
|
|
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
|
|
600
|
+ endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 23:59:59", loc)
|
582
|
601
|
endtime := endTimes.Unix()
|
583
|
602
|
fmt.Print("结束时间", endtime)
|
584
|
603
|
limit, _ := this.GetInt64("limit")
|
|
@@ -607,7 +626,8 @@ func (this *NewDialysisApiController) GetDryWeight() {
|
607
|
626
|
startime := startTimes.Unix()
|
608
|
627
|
fmt.Print("startime", startime)
|
609
|
628
|
end := this.GetString("endtime")
|
610
|
|
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
|
|
629
|
+ endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 23:59:59", loc)
|
|
630
|
+
|
611
|
631
|
endtime := endTimes.Unix()
|
612
|
632
|
fmt.Print("endtime", endtime)
|
613
|
633
|
limit, _ := this.GetInt64("limit")
|
|
@@ -652,7 +672,7 @@ func (this *NewDialysisApiController) GetCourseManagement() {
|
652
|
672
|
startime := startTimes.Unix()
|
653
|
673
|
fmt.Print("startime", startime)
|
654
|
674
|
end := this.GetString("endtime")
|
655
|
|
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
|
|
675
|
+ endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 23:59:59", loc)
|
656
|
676
|
endtime := endTimes.Unix()
|
657
|
677
|
fmt.Print("endtime", endtime)
|
658
|
678
|
limit, _ := this.GetInt64("limit")
|
|
@@ -814,7 +834,7 @@ func (this *NewDialysisApiController) GetRescuerecord() {
|
814
|
834
|
startime := startTimes.Unix()
|
815
|
835
|
fmt.Print("startime", startime)
|
816
|
836
|
end := this.GetString("endtime")
|
817
|
|
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
|
|
837
|
+ endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 23:59:59", loc)
|
818
|
838
|
endtime := endTimes.Unix()
|
819
|
839
|
fmt.Print("endtime", endtime)
|
820
|
840
|
limit, _ := this.GetInt64("limit")
|
|
@@ -1241,6 +1261,34 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1241
|
1261
|
if bloodPatient == 1 {
|
1242
|
1262
|
//根据新表ID获取老表病人ID
|
1243
|
1263
|
patient, _ := service.GetNewPatient(id)
|
|
1264
|
+
|
|
1265
|
+ //判断身份证号是否相同
|
|
1266
|
+ thisPatient, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
|
|
1267
|
+ if thisPatient.ID > 0 && thisPatient.ID != patient.BloodId {
|
|
1268
|
+ returnData := make(map[string]interface{}, 0)
|
|
1269
|
+ returnData["msg"] = "身份证号码已存在"
|
|
1270
|
+ this.ServeSuccessJSON(returnData)
|
|
1271
|
+ return
|
|
1272
|
+ }
|
|
1273
|
+
|
|
1274
|
+ //查询手机号码是否存在
|
|
1275
|
+ thisPatientOne, err := service.FindPatientByMobileOne(phone, orgid)
|
|
1276
|
+ if thisPatientOne.ID > 0 && thisPatientOne.ID != patient.BloodId {
|
|
1277
|
+ returnData := make(map[string]interface{}, 0)
|
|
1278
|
+ returnData["msg"] = "手机号码已存在"
|
|
1279
|
+ this.ServeSuccessJSON(returnData)
|
|
1280
|
+ return
|
|
1281
|
+ }
|
|
1282
|
+
|
|
1283
|
+ //查询号透析号是否相同
|
|
1284
|
+ thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
|
|
1285
|
+ if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
|
|
1286
|
+ returnData := make(map[string]interface{}, 0)
|
|
1287
|
+ returnData["msg"] = "透析号码已存在"
|
|
1288
|
+ this.ServeSuccessJSON(returnData)
|
|
1289
|
+ return
|
|
1290
|
+ }
|
|
1291
|
+
|
1244
|
1292
|
patients := models.Patients{
|
1245
|
1293
|
Name: name,
|
1246
|
1294
|
Gender: sex,
|
|
@@ -1260,7 +1308,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1260
|
1308
|
IdCardNo: idCard,
|
1261
|
1309
|
IsInfectious: is_infectious,
|
1262
|
1310
|
}
|
1263
|
|
- err := service.UpdatedPatient(patients, patient.BloodId)
|
|
1311
|
+ err = service.UpdatedPatient(patients, patient.BloodId)
|
1264
|
1312
|
patientsNew := models.XtPatientsNew{
|
1265
|
1313
|
ID: id,
|
1266
|
1314
|
Name: name,
|
|
@@ -1289,6 +1337,12 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1289
|
1337
|
this.ServeSuccessJSON(map[string]interface{}{
|
1290
|
1338
|
"patients": patientsNew,
|
1291
|
1339
|
})
|
|
1340
|
+ //更改传染病
|
|
1341
|
+ updateContagions, err := service.UpdateContagions(patient.BloodId)
|
|
1342
|
+ fmt.Print("更新传染病失败", err)
|
|
1343
|
+ fmt.Print("up", updateContagions)
|
|
1344
|
+ err = service.AddContagions(patient.BloodId, patient.CreatedTime, patient.UpdatedTime, ids)
|
|
1345
|
+ fmt.Println("添加传染病失败", err)
|
1292
|
1346
|
}
|
1293
|
1347
|
if slowpatient == 1 {
|
1294
|
1348
|
patient, _ := service.GetNewPatient(id)
|