|
@@ -148,6 +148,18 @@ func PatientApiRegistRouters() {
|
148
|
148
|
|
149
|
149
|
beego.Router("/api/patient/gettreamentplan", &PatientApiController{}, "Get:GetTreatMentPlanList")
|
150
|
150
|
|
|
151
|
+ beego.Router("/api/patient/getpatientbypatientid", &PatientApiController{}, "Get:GetPatientByPatientId")
|
|
152
|
+
|
|
153
|
+ beego.Router("/api/patient/savepatientlapse", &PatientApiController{}, "Post:SavePatientLapse")
|
|
154
|
+
|
|
155
|
+ beego.Router("/api/patient/getpatientlapsorecord", &PatientApiController{}, "Get:GetPatientLapsorecord")
|
|
156
|
+
|
|
157
|
+ beego.Router("/api/patient/getpatientlapserecord", &DialysisApiController{}, "Get:GetPatientLapseRecord")
|
|
158
|
+
|
|
159
|
+ beego.Router("/api/patient/updatepatientlapserecord", &DialysisApiController{}, "Post:UpdatePatientLapseRecord")
|
|
160
|
+
|
|
161
|
+ beego.Router("/api/patient/deletepatientlapsorecord", &DialysisApiController{}, "Get:DeletePatientLapseRecord")
|
|
162
|
+
|
151
|
163
|
}
|
152
|
164
|
func (c *PatientApiController) GetExportList() {
|
153
|
165
|
startTime := c.GetString("start_time")
|
|
@@ -7506,3 +7518,184 @@ func (c *PatientApiController) GetTreatMentPlanList() {
|
7506
|
7518
|
"treamentPlan": treamentPlan,
|
7507
|
7519
|
})
|
7508
|
7520
|
}
|
|
7521
|
+
|
|
7522
|
+func (c *PatientApiController) GetPatientByPatientId() {
|
|
7523
|
+
|
|
7524
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
7525
|
+
|
|
7526
|
+ id, _ := c.GetInt64("id")
|
|
7527
|
+
|
|
7528
|
+ patients, _ := service.GetPatientByIDOne(orgId, id)
|
|
7529
|
+
|
|
7530
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
7531
|
+ "patients": patients,
|
|
7532
|
+ })
|
|
7533
|
+}
|
|
7534
|
+
|
|
7535
|
+func (c *PatientApiController) SavePatientLapse() {
|
|
7536
|
+
|
|
7537
|
+ dataBody := make(map[string]interface{}, 0)
|
|
7538
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
7539
|
+ fmt.Println(err)
|
|
7540
|
+
|
|
7541
|
+ patient_id := int64(dataBody["patient_id"].(float64))
|
|
7542
|
+
|
|
7543
|
+ admin_user_id := int64(dataBody["admin_user_id"].(float64))
|
|
7544
|
+
|
|
7545
|
+ lapse_class := int64(dataBody["lapse_class"].(float64))
|
|
7546
|
+
|
|
7547
|
+ lapse_type := int64(dataBody["lapse_type"].(float64))
|
|
7548
|
+
|
|
7549
|
+ lapse_reason := dataBody["lapse_reason"].(string)
|
|
7550
|
+
|
|
7551
|
+ start_time := dataBody["record_date"].(string)
|
|
7552
|
+
|
|
7553
|
+ timeLayout := "2006-01-02"
|
|
7554
|
+ loc, _ := time.LoadLocation("Local")
|
|
7555
|
+ var startTime int64
|
|
7556
|
+ if len(start_time) > 0 {
|
|
7557
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
7558
|
+ if err != nil {
|
|
7559
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
7560
|
+ return
|
|
7561
|
+ }
|
|
7562
|
+ startTime = theTime.Unix()
|
|
7563
|
+ }
|
|
7564
|
+
|
|
7565
|
+ remark := dataBody["remark"].(string)
|
|
7566
|
+
|
|
7567
|
+ org_id := c.GetAdminUserInfo().CurrentOrgId
|
|
7568
|
+
|
|
7569
|
+ record := models.XtPatientLaspseRecord{
|
|
7570
|
+ PatientId: patient_id,
|
|
7571
|
+ RecordDate: startTime,
|
|
7572
|
+ LapseDate: startTime,
|
|
7573
|
+ LapseType: lapse_type,
|
|
7574
|
+ LapseClass: lapse_class,
|
|
7575
|
+ LapseReason: lapse_reason,
|
|
7576
|
+ AdminUserId: admin_user_id,
|
|
7577
|
+ Remark: remark,
|
|
7578
|
+ UserOrgId: org_id,
|
|
7579
|
+ Ctime: time.Now().Unix(),
|
|
7580
|
+ Mtime: time.Now().Unix(),
|
|
7581
|
+ Status: 1,
|
|
7582
|
+ }
|
|
7583
|
+
|
|
7584
|
+
|
|
7585
|
+ if lapse_type == 1 {
|
|
7586
|
+ service.UpdateScheduleByDeathTime(patient_id, startTime)
|
|
7587
|
+ service.UpdateScheduleItemByPatientId(patient_id)
|
|
7588
|
+ }
|
|
7589
|
+ service.CreatePatientRecord(record)
|
|
7590
|
+
|
|
7591
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
7592
|
+ "record": record,
|
|
7593
|
+ })
|
|
7594
|
+
|
|
7595
|
+}
|
|
7596
|
+
|
|
7597
|
+func (c *PatientApiController) GetPatientLapsorecord() {
|
|
7598
|
+
|
|
7599
|
+ id, _ := c.GetInt64("id")
|
|
7600
|
+
|
|
7601
|
+ lapsorecord, _ := service.GetPatientLapsorecord(id)
|
|
7602
|
+
|
|
7603
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
7604
|
+ "lapsorecord": lapsorecord,
|
|
7605
|
+ })
|
|
7606
|
+}
|
|
7607
|
+
|
|
7608
|
+func (this *DialysisApiController) GetPatientLapseRecord() {
|
|
7609
|
+
|
|
7610
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
7611
|
+
|
|
7612
|
+ limit, _ := this.GetInt64("limit")
|
|
7613
|
+
|
|
7614
|
+ page, _ := this.GetInt64("page")
|
|
7615
|
+
|
|
7616
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
7617
|
+
|
|
7618
|
+ record, total, _ := service.GetPatientLapseRecord(patient_id, limit, page, orgId)
|
|
7619
|
+
|
|
7620
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
7621
|
+ "record": record,
|
|
7622
|
+ "total": total,
|
|
7623
|
+ })
|
|
7624
|
+}
|
|
7625
|
+
|
|
7626
|
+func (c *DialysisApiController) UpdatePatientLapseRecord() {
|
|
7627
|
+
|
|
7628
|
+ dataBody := make(map[string]interface{}, 0)
|
|
7629
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
7630
|
+ fmt.Println(err)
|
|
7631
|
+
|
|
7632
|
+ patient_id := int64(dataBody["patient_id"].(float64))
|
|
7633
|
+
|
|
7634
|
+ admin_user_id := int64(dataBody["admin_user_id"].(float64))
|
|
7635
|
+
|
|
7636
|
+ lapse_class := int64(dataBody["lapse_class"].(float64))
|
|
7637
|
+
|
|
7638
|
+ lapse_type := int64(dataBody["lapse_type"].(float64))
|
|
7639
|
+
|
|
7640
|
+ lapse_reason := dataBody["lapse_reason"].(string)
|
|
7641
|
+
|
|
7642
|
+ start_time := dataBody["record_date"].(string)
|
|
7643
|
+
|
|
7644
|
+ timeLayout := "2006-01-02"
|
|
7645
|
+ loc, _ := time.LoadLocation("Local")
|
|
7646
|
+ var startTime int64
|
|
7647
|
+ if len(start_time) > 0 {
|
|
7648
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
7649
|
+ if err != nil {
|
|
7650
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
7651
|
+ return
|
|
7652
|
+ }
|
|
7653
|
+ startTime = theTime.Unix()
|
|
7654
|
+ }
|
|
7655
|
+
|
|
7656
|
+ remark := dataBody["remark"].(string)
|
|
7657
|
+
|
|
7658
|
+ id := int64(dataBody["id"].(float64))
|
|
7659
|
+
|
|
7660
|
+ org_id := c.GetAdminUserInfo().CurrentOrgId
|
|
7661
|
+
|
|
7662
|
+ record := models.XtPatientLaspseRecord{
|
|
7663
|
+ ID: id,
|
|
7664
|
+ PatientId: patient_id,
|
|
7665
|
+ RecordDate: startTime,
|
|
7666
|
+ LapseDate: startTime,
|
|
7667
|
+ LapseType: lapse_type,
|
|
7668
|
+ LapseClass: lapse_class,
|
|
7669
|
+ LapseReason: lapse_reason,
|
|
7670
|
+ AdminUserId: admin_user_id,
|
|
7671
|
+ Remark: remark,
|
|
7672
|
+ UserOrgId: org_id,
|
|
7673
|
+ Ctime: time.Now().Unix(),
|
|
7674
|
+ Mtime: time.Now().Unix(),
|
|
7675
|
+ Status: 1,
|
|
7676
|
+ }
|
|
7677
|
+
|
|
7678
|
+
|
|
7679
|
+ if lapse_type == 1 {
|
|
7680
|
+ service.UpdateScheduleByDeathTime(patient_id, startTime)
|
|
7681
|
+ service.UpdateScheduleItemByPatientId(patient_id)
|
|
7682
|
+ }
|
|
7683
|
+
|
|
7684
|
+ service.SavePatientLapseRecord(record)
|
|
7685
|
+
|
|
7686
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
7687
|
+ "record": record,
|
|
7688
|
+ })
|
|
7689
|
+}
|
|
7690
|
+
|
|
7691
|
+func (c *DialysisApiController) DeletePatientLapseRecord() {
|
|
7692
|
+
|
|
7693
|
+ id, _ := c.GetInt64("id")
|
|
7694
|
+
|
|
7695
|
+ service.DeletePatientLapseRecord(id)
|
|
7696
|
+
|
|
7697
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
7698
|
+ "msg": "删除成功",
|
|
7699
|
+ })
|
|
7700
|
+
|
|
7701
|
+}
|