XMLWAN vor 4 Jahren
Ursprung
Commit
0c735641b6

+ 12 - 3
controllers/his_project_api_controller.go Datei anzeigen

@@ -757,6 +757,9 @@ func (this *HisProjectApiController) SaveHisPatient() {
757 757
 	totals_float, _ := strconv.ParseFloat(totals, 64)
758 758
 	adminUserInfo := this.GetAdminUserInfo()
759 759
 	orgId := adminUserInfo.CurrentOrgId
760
+	timeStr := time.Now().Format("2006-01-02")
761
+	fmt.Println("timeStr:", timeStr)
762
+	timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
760 763
 
761 764
 	bloodPatient, errcode := service.GetBloodPatientByIdCard(idcard, orgId)
762 765
 	if errcode == gorm.ErrRecordNotFound {
@@ -779,6 +782,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
779 782
 			Gender:                 sex,
780 783
 			Total:                  totals_float,
781 784
 			UserOrgId:              orgId,
785
+			Status:                 1,
786
+			RecordDate:             timeStringToTime.Unix(),
782 787
 		}
783 788
 		err := service.CreateHisPatient(&patient)
784 789
 		if err != nil {
@@ -864,13 +869,17 @@ func (this *HisProjectApiController) GetHisPatientHistory() {
864 869
 	fmt.Println(keyword, start_time, end_time, register_type, limit, page)
865 870
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
866 871
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
867
-	history, total, err := service.GetHisPatientHistory(keyword, startTime.Unix(), endTime.Unix(), register_type, limit, page)
872
+	adminUserInfo := this.GetAdminUserInfo()
873
+	orgId := adminUserInfo.CurrentOrgId
874
+	history, total, err := service.GetHisPatientHistory(keyword, startTime.Unix(), endTime.Unix(), register_type, limit, page, orgId)
875
+	department, err := service.GetAllDepartMent(orgId)
868 876
 	if err != nil {
869 877
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
870 878
 		return
871 879
 	}
872 880
 	this.ServeSuccessJSON(map[string]interface{}{
873
-		"history": history,
874
-		"total":   total,
881
+		"history":    history,
882
+		"total":      total,
883
+		"department": department,
875 884
 	})
876 885
 }

+ 1 - 0
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go Datei anzeigen

@@ -42,6 +42,7 @@ func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
42 42
 	fmt.Println("partiontype", partitionType)
43 43
 	scheduleType, _ := this.GetInt64("scheduleType")
44 44
 	fmt.Println(scheduleType)
45
+
45 46
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
46 47
 	if len(keywords) > 0 {
47 48
 

+ 5 - 1
service/his_project_service.go Datei anzeigen

@@ -284,10 +284,11 @@ func GetProjectListById(orgid int64, ids []string) (project []*models.XtHisProje
284 284
 	return project, err
285 285
 }
286 286
 
287
-func GetHisPatientHistory(keyword string, startime int64, endtime int64, registtype int64, limit int64, page int64) (hisPatient []*models.XtHisPatient, total int64, err error) {
287
+func GetHisPatientHistory(keyword string, startime int64, endtime int64, registtype int64, limit int64, page int64, orgid int64) (hisPatient []*models.XtHisPatient, total int64, err error) {
288 288
 	offset := (page - 1) * limit
289 289
 	likeKey := "%" + keyword + "%"
290 290
 	db := XTReadDB().Table("his_patient as x").Where("x.status = 1")
291
+
291 292
 	if len(keyword) > 0 {
292 293
 		db = db.Where("x.name like ?", likeKey)
293 294
 	}
@@ -300,6 +301,9 @@ func GetHisPatientHistory(keyword string, startime int64, endtime int64, registt
300 301
 	if registtype > 0 {
301 302
 		db = db.Where("x.register_type = ?", registtype)
302 303
 	}
304
+	if orgid > 0 {
305
+		db = db.Where("x.user_org_id = ?", orgid)
306
+	}
303 307
 	err = db.Select("x.id,x.balance_accounts_type,x.medical_insurance_number,x.name,x.gender,x.id_type,x.medical_treatment_type,x.birthday,x.record_date,x.age,x.phone_number,x.id_card_no,x.register_type,x.admin_user_id,x.departments,x.is_need_cost_of_production,x.register_cost,x.treatment_cost,x.cost_of_production,x.total,x.user_org_id,x.patient_id,x.number").Count(&total).Offset(offset).Limit(limit).Find(&hisPatient).Error
304 308
 	return hisPatient, total, err
305 309
 }