|
@@ -183,16 +183,16 @@ func (c *PatientApiController) CreatePatient() {
|
183
|
183
|
remind_cycle, _ := c.GetInt64("remind_cycle")
|
184
|
184
|
|
185
|
185
|
adminUserInfo := c.GetAdminUserInfo()
|
186
|
|
- patientTotal := service.GetLapsetoPatientCount(adminUserInfo.CurrentOrgId, 1)
|
|
186
|
+ //patientTotal := service.GetLapsetoPatientCount(adminUserInfo.CurrentOrgId, 1)
|
187
|
187
|
|
188
|
|
- subscibes := adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId]
|
189
|
|
- if subscibes.State == 2 && patientTotal >= 20 { //免费试用版,不过期,限制患者数20
|
190
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
191
|
|
- return
|
192
|
|
- } else if subscibes.State == 1 && patientTotal >= 60 { //标准版,不过期,限制患者数60
|
193
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
194
|
|
- return
|
195
|
|
- }
|
|
188
|
+ //subscibes := adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId]
|
|
189
|
+ //if subscibes.State == 2 && patientTotal >= 20 { //免费试用版,不过期,限制患者数20
|
|
190
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
|
191
|
+ // return
|
|
192
|
+ //} else if subscibes.State == 1 && patientTotal >= 60 { //标准版,不过期,限制患者数60
|
|
193
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
|
194
|
+ // return
|
|
195
|
+ //}
|
196
|
196
|
|
197
|
197
|
var patient models.Patients
|
198
|
198
|
contagions, diseases, code, formItems := patientFormData(&patient, c.Ctx.Input.RequestBody, "create")
|
|
@@ -234,6 +234,7 @@ func (c *PatientApiController) CreatePatient() {
|
234
|
234
|
// patient.Lapseto = 1
|
235
|
235
|
|
236
|
236
|
err := service.CreatePatient(&patient, contagions, diseases)
|
|
237
|
+ fmt.Println("创建病人失败---------------------------------------------err")
|
237
|
238
|
if err != nil {
|
238
|
239
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePatient)
|
239
|
240
|
return
|
|
@@ -242,29 +243,29 @@ func (c *PatientApiController) CreatePatient() {
|
242
|
243
|
//获取老表的最后一条数据
|
243
|
244
|
patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
|
244
|
245
|
patientsNew := models.XtPatientsNew{
|
245
|
|
- UserOrgId: adminUserInfo.CurrentOrgId,
|
246
|
|
- UserId: 0,
|
247
|
|
- Avatar: patients.Avatar,
|
248
|
|
- PatientType: patients.PatientType,
|
249
|
|
- DialysisNo: patients.DialysisNo,
|
250
|
|
- AdmissionNumber: patients.AdmissionNumber,
|
251
|
|
- Source: patients.Source,
|
252
|
|
- Lapseto: patients.Lapseto,
|
253
|
|
- PartitionId: patients.PartitionId,
|
254
|
|
- BedId: patients.BedId,
|
255
|
|
- Name: patients.Name,
|
256
|
|
- Alias: patients.Alias,
|
257
|
|
- Gender: patients.Gender,
|
258
|
|
- MaritalStatus: patients.MaritalStatus,
|
259
|
|
- IdCardNo: patients.IdCardNo,
|
260
|
|
- Birthday: patients.Birthday,
|
261
|
|
- ReimbursementWayId: patients.ReimbursementWayId,
|
262
|
|
- HealthCareType: patients.HealthCareType,
|
263
|
|
- HealthCareNo: patients.HealthCareNo,
|
264
|
|
- HealthCareDueDate: patients.HealthCareDueDate,
|
265
|
|
- Height: patients.Height,
|
266
|
|
- BloodType: patients.BloodType,
|
267
|
|
- Rh: patients.Rh,
|
|
246
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
247
|
+ UserId: 0,
|
|
248
|
+ Avatar: patients.Avatar,
|
|
249
|
+ PatientType: patients.PatientType,
|
|
250
|
+ DialysisNo: patients.DialysisNo,
|
|
251
|
+ AdmissionNumber: patients.AdmissionNumber,
|
|
252
|
+ Source: patients.Source,
|
|
253
|
+ Lapseto: patients.Lapseto,
|
|
254
|
+ PartitionId: patients.PartitionId,
|
|
255
|
+ BedId: patients.BedId,
|
|
256
|
+ Name: patients.Name,
|
|
257
|
+ Alias: patients.Alias,
|
|
258
|
+ Gender: patients.Gender,
|
|
259
|
+ MaritalStatus: patients.MaritalStatus,
|
|
260
|
+ IdCardNo: patients.IdCardNo,
|
|
261
|
+ Birthday: patients.Birthday,
|
|
262
|
+ ReimbursementWayId: patients.ReimbursementWayId,
|
|
263
|
+ HealthCareType: patients.HealthCareType,
|
|
264
|
+ HealthCareNo: patients.HealthCareNo,
|
|
265
|
+ HealthCareDueDate: patients.HealthCareDueDate,
|
|
266
|
+ Height: patients.Height,
|
|
267
|
+ BloodType: patients.BloodType,
|
|
268
|
+ Rh: patients.Rh,
|
268
|
269
|
HealthCareDueAlertDate: patients.HealthCareDueAlertDate,
|
269
|
270
|
EducationLevel: patients.EducationLevel,
|
270
|
271
|
Profession: patients.Profession,
|
|
@@ -310,27 +311,27 @@ func (c *PatientApiController) CreatePatient() {
|
310
|
311
|
Nation: patients.Nation,
|
311
|
312
|
NativePlace: patients.NativePlace,
|
312
|
313
|
Age: patients.Age,
|
313
|
|
- InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
|
314
|
|
- IsInfectious: patients.IsInfectious,
|
315
|
|
- RemindCycle: patients.RemindCycle,
|
316
|
|
- ResponseResult: patients.ResponseResult,
|
317
|
|
- IsOpenRemind: patients.IsOpenRemind,
|
318
|
|
- FirstTreatmentDate: patients.FirstTreatmentDate,
|
319
|
|
- DialysisAge: patients.DialysisAge,
|
320
|
|
- ExpenseKind: patients.ExpenseKind,
|
321
|
|
- TellPhone: patients.TellPhone,
|
322
|
|
- ContactName: patients.ContactName,
|
323
|
|
- BloodPatients: 1,
|
324
|
|
- SlowPatients: 0,
|
325
|
|
- MemberPatients: 0,
|
326
|
|
- EcommerPatients: "",
|
327
|
|
- BloodId: patients.ID,
|
328
|
|
- SlowId: 0,
|
329
|
|
- MemberId: 0,
|
330
|
|
- MemberFistdate: 0,
|
331
|
|
- MemberPatienttype: 0,
|
332
|
|
- MemberTreatement: 0,
|
333
|
|
- EquitmentId: "",
|
|
314
|
+ InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
|
|
315
|
+ IsInfectious: patients.IsInfectious,
|
|
316
|
+ RemindCycle: patients.RemindCycle,
|
|
317
|
+ ResponseResult: patients.ResponseResult,
|
|
318
|
+ IsOpenRemind: patients.IsOpenRemind,
|
|
319
|
+ FirstTreatmentDate: patients.FirstTreatmentDate,
|
|
320
|
+ DialysisAge: patients.DialysisAge,
|
|
321
|
+ ExpenseKind: patients.ExpenseKind,
|
|
322
|
+ TellPhone: patients.TellPhone,
|
|
323
|
+ ContactName: patients.ContactName,
|
|
324
|
+ BloodPatients: 1,
|
|
325
|
+ SlowPatients: 0,
|
|
326
|
+ MemberPatients: 0,
|
|
327
|
+ EcommerPatients: "",
|
|
328
|
+ BloodId: patients.ID,
|
|
329
|
+ SlowId: 0,
|
|
330
|
+ MemberId: 0,
|
|
331
|
+ MemberFistdate: 0,
|
|
332
|
+ MemberPatienttype: 0,
|
|
333
|
+ MemberTreatement: 0,
|
|
334
|
+ EquitmentId: "",
|
334
|
335
|
}
|
335
|
336
|
|
336
|
337
|
err = service.CreatePatientsNew(&patientsNew)
|
|
@@ -411,6 +412,7 @@ func (c *PatientApiController) CreatePatient() {
|
411
|
412
|
//EditPatient 修改
|
412
|
413
|
func (c *PatientApiController) EditPatient() {
|
413
|
414
|
id, _ := c.GetInt64("id", 0)
|
|
415
|
+
|
414
|
416
|
record_date := c.GetString("record_date")
|
415
|
417
|
is_infectious, _ := c.GetInt64("is_infectious")
|
416
|
418
|
remind_cycle, _ := c.GetInt64("remind_cycle")
|
|
@@ -455,6 +457,87 @@ func (c *PatientApiController) EditPatient() {
|
455
|
457
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdatePatient)
|
456
|
458
|
return
|
457
|
459
|
}
|
|
460
|
+ fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
|
|
461
|
+ patientsNew := models.XtPatientsNew{
|
|
462
|
+ UserOrgId: patient.UserOrgId,
|
|
463
|
+ UserId: patient.UserId,
|
|
464
|
+ Avatar: patient.Avatar,
|
|
465
|
+ PatientType: patient.PatientType,
|
|
466
|
+ DialysisNo: patient.DialysisNo,
|
|
467
|
+ AdmissionNumber: patient.AdmissionNumber,
|
|
468
|
+ Source: patient.Source,
|
|
469
|
+ Lapseto: patient.Lapseto,
|
|
470
|
+ PartitionId: patient.PartitionId,
|
|
471
|
+ BedId: patient.BedId,
|
|
472
|
+ Name: patient.Name,
|
|
473
|
+ Alias: patient.Alias,
|
|
474
|
+ Gender: patient.Gender,
|
|
475
|
+ MaritalStatus: patient.MaritalStatus,
|
|
476
|
+ IdCardNo: patient.IdCardNo,
|
|
477
|
+ Birthday: patient.Birthday,
|
|
478
|
+ ReimbursementWayId: patient.ReimbursementWayId,
|
|
479
|
+ HealthCareType: patient.HealthCareType,
|
|
480
|
+ HealthCareNo: patient.HealthCareNo,
|
|
481
|
+ HealthCareDueDate: patient.HealthCareDueDate,
|
|
482
|
+ Height: patient.Height,
|
|
483
|
+ BloodType: patient.BloodType,
|
|
484
|
+ Rh: patient.Rh,
|
|
485
|
+ HealthCareDueAlertDate: patient.HealthCareDueAlertDate,
|
|
486
|
+ EducationLevel: patient.EducationLevel,
|
|
487
|
+ Profession: patient.Profession,
|
|
488
|
+ Phone: patient.Phone,
|
|
489
|
+ HomeTelephone: patient.HomeTelephone,
|
|
490
|
+ RelativePhone: patient.RelativePhone,
|
|
491
|
+ RelativeRelations: patient.RelativeRelations,
|
|
492
|
+ HomeAddress: patient.HomeAddress,
|
|
493
|
+ WorkUnit: patient.WorkUnit,
|
|
494
|
+ UnitAddress: patient.UnitAddress,
|
|
495
|
+ Children: patient.Children,
|
|
496
|
+ ReceivingDate: patient.ReceivingDate,
|
|
497
|
+ IsHospitalFirstDialysis: patient.IsHospitalFirstDialysis,
|
|
498
|
+ FirstDialysisDate: patient.FirstDialysisDate,
|
|
499
|
+ FirstDialysisHospital: patient.FirstDialysisHospital,
|
|
500
|
+ PredialysisCondition: patient.PredialysisCondition,
|
|
501
|
+ PreHospitalDialysisTimes: patient.PreHospitalDialysisTimes,
|
|
502
|
+ HospitalFirstDialysisDate: patient.HospitalFirstDialysisDate,
|
|
503
|
+ InductionPeriod: patient.InductionPeriod,
|
|
504
|
+ InitialDialysis: patient.InitialDialysis,
|
|
505
|
+ TotalDialysis: patient.TotalDialysis,
|
|
506
|
+ AttendingDoctorId: patient.AttendingDoctorId,
|
|
507
|
+ HeadNurseId: patient.HeadNurseId,
|
|
508
|
+ Evaluate: patient.Evaluate,
|
|
509
|
+ Diagnose: patient.Diagnose,
|
|
510
|
+ Remark: patient.Remark,
|
|
511
|
+ RegistrarsId: patient.RegistrarsId,
|
|
512
|
+ Registrars: patient.Registrars,
|
|
513
|
+ QrCode: patient.QrCode,
|
|
514
|
+ BindingState: patient.BindingState,
|
|
515
|
+ PatientComplains: patient.PatientComplains,
|
|
516
|
+ PresentHistory: patient.PresentHistory,
|
|
517
|
+ PastHistory: patient.PastHistory,
|
|
518
|
+ Temperature: patient.Temperature,
|
|
519
|
+ Pulse: patient.Pulse,
|
|
520
|
+ Respiratory: patient.Respiratory,
|
|
521
|
+ Sbp: patient.SBP,
|
|
522
|
+ Dbp: patient.DBP,
|
|
523
|
+ Nation: patient.Nation,
|
|
524
|
+ NativePlace: patient.NativePlace,
|
|
525
|
+ Age: patient.Age,
|
|
526
|
+ InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
|
|
527
|
+ IsInfectious: patient.IsInfectious,
|
|
528
|
+ RemindCycle: patient.RemindCycle,
|
|
529
|
+ ResponseResult: patient.ResponseResult,
|
|
530
|
+ IsOpenRemind: patient.IsOpenRemind,
|
|
531
|
+ FirstTreatmentDate: patient.FirstTreatmentDate,
|
|
532
|
+ DialysisAge: patient.DialysisAge,
|
|
533
|
+ ExpenseKind: patient.ExpenseKind,
|
|
534
|
+ TellPhone: patient.TellPhone,
|
|
535
|
+ ContactName: patient.ContactName,
|
|
536
|
+ UpdatedTime: time.Now().Unix(),
|
|
537
|
+ }
|
|
538
|
+ // //更新病人ID获取新表病人ID
|
|
539
|
+ err = service.UpdatepatientTwo(&patientsNew, id)
|
|
540
|
+ fmt.Println("更新病人失败---------------------------------------", err)
|
458
|
541
|
|
459
|
542
|
if len(record_date) > 0 {
|
460
|
543
|
var recordTime int64
|
|
@@ -587,17 +670,17 @@ func (c *PatientApiController) EditLapseto() {
|
587
|
670
|
lapseto.Status = 1
|
588
|
671
|
patient.Lapseto = lapseto.LapsetoType
|
589
|
672
|
|
590
|
|
- if patient.Lapseto == 1 {
|
591
|
|
- patientTotal := service.GetLapsetoPatientCount(adminUserInfo.CurrentOrgId, 1)
|
592
|
|
- subscibes := adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId]
|
593
|
|
- if subscibes.State == 2 && patientTotal >= 100 { //免费试用版,不过期,限制患者数20
|
594
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
595
|
|
- return
|
596
|
|
- } else if subscibes.State == 1 && patientTotal >= 200 { //标准版,不过期,限制患者数60
|
597
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
598
|
|
- return
|
599
|
|
- }
|
600
|
|
- }
|
|
673
|
+ //if patient.Lapseto == 1 {
|
|
674
|
+ // patientTotal := service.GetLapsetoPatientCount(adminUserInfo.CurrentOrgId, 1)
|
|
675
|
+ // subscibes := adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId]
|
|
676
|
+ // if subscibes.State == 2 && patientTotal >= 100 { //免费试用版,不过期,限制患者数20
|
|
677
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
|
678
|
+ // return
|
|
679
|
+ // } else if subscibes.State == 1 && patientTotal >= 200 { //标准版,不过期,限制患者数60
|
|
680
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientReachLimit)
|
|
681
|
+ // return
|
|
682
|
+ // }
|
|
683
|
+ //}
|
601
|
684
|
|
602
|
685
|
err = service.EditPatientLapseto(&patient, &lapseto)
|
603
|
686
|
if err != nil {
|