|
@@ -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
|
311
|
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,
|
|
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)
|
|
@@ -1412,14 +1466,32 @@ func (this *NewDialysisApiController) GetAllDoctor() {
|
1412
|
1466
|
|
1413
|
1467
|
func (this *NewDialysisApiController) GetAllInspection() {
|
1414
|
1468
|
|
1415
|
|
- inspection, err := service.GetAllInspection(0)
|
1416
|
|
- if err != nil {
|
1417
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1418
|
|
- return
|
|
1469
|
+ //查询该机构是否存在检验检测项目
|
|
1470
|
+ orgid := this.GetMobileAdminUserInfo().Org.Id
|
|
1471
|
+ fmt.Print("orgid", orgid)
|
|
1472
|
+ _, errcode := service.GetInspectionByOrgId(orgid)
|
|
1473
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1474
|
+ inspection, err := service.GetAllInspection(0)
|
|
1475
|
+ if err != nil {
|
|
1476
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1477
|
+ return
|
|
1478
|
+ }
|
|
1479
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1480
|
+ "inspection": inspection,
|
|
1481
|
+ })
|
|
1482
|
+ } else if errcode == nil {
|
|
1483
|
+ inspection, err := service.GetAllInspection(orgid)
|
|
1484
|
+ if err != nil {
|
|
1485
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1486
|
+ return
|
|
1487
|
+ }
|
|
1488
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1489
|
+ "inspection": inspection,
|
|
1490
|
+ })
|
|
1491
|
+ } else {
|
|
1492
|
+
|
1419
|
1493
|
}
|
1420
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
1421
|
|
- "inspection": inspection,
|
1422
|
|
- })
|
|
1494
|
+
|
1423
|
1495
|
}
|
1424
|
1496
|
|
1425
|
1497
|
func (this *NewDialysisApiController) GetInspection() {
|
|
@@ -1444,6 +1516,12 @@ func (this *NewDialysisApiController) GetInspection() {
|
1444
|
1516
|
orgid := adminInfo.Org.Id
|
1445
|
1517
|
fmt.Print("patient", patient)
|
1446
|
1518
|
fmt.Print("orgid", orgid)
|
|
1519
|
+
|
|
1520
|
+ //查询该机构是否存在
|
|
1521
|
+ //inspection, _ := service.GetInspectionById(patient.BloodId, startime, endtime, orgid)
|
|
1522
|
+ //if len(inspection) == 0 {
|
|
1523
|
+ //
|
|
1524
|
+ //}
|
1447
|
1525
|
inspection, total, err := service.GetInspection(patient.BloodId, startime, endtime, limit, page, orgid)
|
1448
|
1526
|
if err != nil {
|
1449
|
1527
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -1459,7 +1537,7 @@ func (this *NewDialysisApiController) GetMyInformation() {
|
1459
|
1537
|
adminUserInfo := this.GetMobileAdminUserInfo()
|
1460
|
1538
|
|
1461
|
1539
|
roleInfo := adminUserInfo.AppRole
|
1462
|
|
-
|
|
1540
|
+ fmt.Print("aa")
|
1463
|
1541
|
es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
|
1464
|
1542
|
|
1465
|
1543
|
this.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -1468,3 +1546,72 @@ func (this *NewDialysisApiController) GetMyInformation() {
|
1468
|
1546
|
})
|
1469
|
1547
|
return
|
1470
|
1548
|
}
|
|
1549
|
+
|
|
1550
|
+func (this *NewDialysisApiController) GetPatientName() {
|
|
1551
|
+ id, _ := this.GetInt64("id")
|
|
1552
|
+ patients, _ := service.GetPatientDetailTwo(id)
|
|
1553
|
+ fmt.Print("paitents", patients.ID)
|
|
1554
|
+ patientName, err := service.GetPatientName(patients.BloodId)
|
|
1555
|
+ fmt.Print("err", err)
|
|
1556
|
+ if err != nil {
|
|
1557
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1558
|
+ return
|
|
1559
|
+ }
|
|
1560
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1561
|
+ "patientName": patientName,
|
|
1562
|
+ })
|
|
1563
|
+}
|
|
1564
|
+
|
|
1565
|
+func (this *NewDialysisApiController) GetInspectionDetail() {
|
|
1566
|
+
|
|
1567
|
+ patientid, _ := this.GetInt64("patientid")
|
|
1568
|
+ fmt.Print("patientid", patientid)
|
|
1569
|
+ patients, _ := service.GetPatientDetailTwo(patientid)
|
|
1570
|
+ date, _ := this.GetInt64("date")
|
|
1571
|
+ fmt.Print("date", date)
|
|
1572
|
+ projectid, _ := this.GetInt64("projectid")
|
|
1573
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
1574
|
+ orgid := adminUser.Org.Id
|
|
1575
|
+ InspectionDetail, err := service.GetInspectionDetail(patients.BloodId, date, orgid, projectid)
|
|
1576
|
+ if err != nil {
|
|
1577
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1578
|
+ return
|
|
1579
|
+ }
|
|
1580
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1581
|
+ "InspectionDetail": InspectionDetail,
|
|
1582
|
+ })
|
|
1583
|
+}
|
|
1584
|
+
|
|
1585
|
+func (this *NewDialysisApiController) SaveFeed() {
|
|
1586
|
+
|
|
1587
|
+ question, _ := this.GetInt64("question")
|
|
1588
|
+ fmt.Print("question", question)
|
|
1589
|
+ title := this.GetString("title")
|
|
1590
|
+ fmt.Print("title", title)
|
|
1591
|
+ content := this.GetString("content")
|
|
1592
|
+ fmt.Print("content", content)
|
|
1593
|
+ phone := this.GetString("phone")
|
|
1594
|
+ fmt.Print("phone", phone)
|
|
1595
|
+ times, _ := this.GetInt64("time")
|
|
1596
|
+ fmt.Print("time", times)
|
|
1597
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
1598
|
+ orgid := adminUser.Org.Id
|
|
1599
|
+ feedback := models.XtPatientFeedback{
|
|
1600
|
+ ProblemType: question,
|
|
1601
|
+ Title: title,
|
|
1602
|
+ Content: content,
|
|
1603
|
+ Phone: phone,
|
|
1604
|
+ TimeQuantum: times,
|
|
1605
|
+ UserOrgId: orgid,
|
|
1606
|
+ Ctime: time.Now().Unix(),
|
|
1607
|
+ Status: 1,
|
|
1608
|
+ }
|
|
1609
|
+ err := service.CreateFeedBack(&feedback)
|
|
1610
|
+ if err != nil {
|
|
1611
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1612
|
+ return
|
|
1613
|
+ }
|
|
1614
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1615
|
+ "feedback": feedback,
|
|
1616
|
+ })
|
|
1617
|
+}
|