Browse Source

2024/6/17

28169 8 months ago
parent
commit
ce2e6a1ab8

+ 1 - 1
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4 4
 #dev/prod
5 5
 
6 6
 #

+ 6 - 6
controllers/base_api_controller.go View File

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10697 //机构id
86
+		subscibe.OrgId = 9671 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10697 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 18217 //4
96
+		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 3244 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10697 //机构id小英9675或4
332
+		subscibe.OrgId = 9671 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10697 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 18217 //4
342
+		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 3244 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 0
controllers/dialysis_api_controller.go View File

@@ -150,6 +150,7 @@ func DialysisApiRegistRouters() {
150 150
 	beego.Router("/api/patient/getdialysistotalcount", &DialysisApiController{}, "Get:GetDialysisTotalCount")
151 151
 
152 152
 	beego.Router("/api/schedule/getdialysisproject", &DialysisApiController{}, "Get:GetDialysisProject")
153
+
153 154
 }
154 155
 
155 156
 func (c *DialysisApiController) GetQueueCall() {

+ 8 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -6421,6 +6421,14 @@ func (c *PatientApiController) ExecProject() {
6421 6421
 
6422 6422
 	project, _ := service.FindHisProjectById(adminInfo.Org.Id, project_id)
6423 6423
 
6424
+	//针对舒和
6425
+	if adminInfo.Org.Id == 10644 {
6426
+		if project.StartTime > theTime.Unix() {
6427
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
6428
+			return
6429
+		}
6430
+	}
6431
+
6424 6432
 	if project.Type == 3 {
6425 6433
 		good, _ := service.GetGoodInformationByGoodId(project.ProjectId)
6426 6434
 		if good.IsUser != 1 {

+ 193 - 0
controllers/patient_api_controller.go View File

@@ -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
+}

+ 21 - 0
models/patient_models.go View File

@@ -2764,3 +2764,24 @@ func (XtTreatmentPlan) TableName() string {
2764 2764
 
2765 2765
 	return "xt_treatment_plan"
2766 2766
 }
2767
+
2768
+type XtPatientLaspseRecord struct {
2769
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
2770
+	PatientId   int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2771
+	RecordDate  int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2772
+	LapseDate   int64  `gorm:"column:lapse_date" json:"lapse_date" form:"lapse_date"`
2773
+	LapseType   int64  `gorm:"column:lapse_type" json:"lapse_type" form:"lapse_type"`
2774
+	LapseClass  int64  `gorm:"column:lapse_class" json:"lapse_class" form:"lapse_class"`
2775
+	LapseReason string `gorm:"column:lapse_reason" json:"lapse_reason" form:"lapse_reason"`
2776
+	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2777
+	Remark      string `gorm:"column:remark" json:"remark" form:"remark"`
2778
+	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2779
+	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2780
+	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2781
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
2782
+}
2783
+
2784
+func (XtPatientLaspseRecord) TableName() string {
2785
+
2786
+	return "xt_patient_laspse_record"
2787
+}

+ 48 - 1
service/patient_service.go View File

@@ -2099,7 +2099,7 @@ func FindRemindAdvice(user_org_id int64, advice_name string, advice_desc string,
2099 2099
 }
2100 2100
 
2101 2101
 func UpdateScheduleByDeathTime(patientid int64, shcheduledate int64) error {
2102
-	err := XTWriteDB().Model(models.XtSchedule{}).Where("patient_id = ? and schedule_date > ?", patientid, shcheduledate).Updates(map[string]interface{}{"status": 12}).Error
2102
+	err := XTWriteDB().Model(models.XtSchedule{}).Where("patient_id = ? and schedule_date > ? and status=1", patientid, shcheduledate).Updates(map[string]interface{}{"status": 0}).Error
2103 2103
 	return err
2104 2104
 }
2105 2105
 
@@ -4106,3 +4106,50 @@ func GetEditAdviceActionList(id int64, org_id int64) (models.XtDoctorAdviceOne,
4106 4106
 
4107 4107
 	return doctorAdviceOne, err
4108 4108
 }
4109
+
4110
+func CreatePatientRecord(record models.XtPatientLaspseRecord) error {
4111
+
4112
+	err := XTWriteDB().Create(&record).Error
4113
+
4114
+	return err
4115
+}
4116
+
4117
+func GetPatientLapseRecord(patient_id int64, limit int64, page int64, user_org_id int64) (record []*models.XtPatientLaspseRecord, total int64, err error) {
4118
+
4119
+	db := XTReadDB().Model(&record).Where("status=1")
4120
+	offset := (page - 1) * limit
4121
+	if patient_id > 0 {
4122
+		db = db.Where("patient_id = ?", patient_id)
4123
+	}
4124
+	if user_org_id > 0 {
4125
+		db = db.Where("user_org_id = ?", user_org_id)
4126
+	}
4127
+	err = db.Count(&total).Offset(offset).Limit(limit).Find(&record).Error
4128
+
4129
+	return record, total, err
4130
+}
4131
+
4132
+func GetPatientLapsorecord(id int64) (models.XtPatientLaspseRecord, error) {
4133
+
4134
+	laspseRecord := models.XtPatientLaspseRecord{}
4135
+
4136
+	err := XTReadDB().Where("id = ? and status= 1", id).Find(&laspseRecord).Error
4137
+
4138
+	return laspseRecord, err
4139
+}
4140
+
4141
+func SavePatientLapseRecord(record models.XtPatientLaspseRecord) error {
4142
+
4143
+	err := XTWriteDB().Save(&record).Error
4144
+
4145
+	return err
4146
+}
4147
+
4148
+func DeletePatientLapseRecord(id int64) error {
4149
+
4150
+	record := models.XtPatientLaspseRecord{}
4151
+
4152
+	err := XTWriteDB().Model(&record).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4153
+
4154
+	return err
4155
+}